组行为
{_x setBehaviour "stealth"} forEach units group a1
{_x 这里可以自定义 } forEach units group a1
count units group _s1 < 4 以一个组的人数作为条件
cameraOn = NAME;NAME switchCamera "GUNNER";
"INTERNAL" (1st person)
"EXTERNAL" (3rd person)
"GUNNER" (optics / sights)
"GROUP" (commander view)
以上命令用于锁定到一个单位的身上录像跟随~而且不论跪下还是趴下都一致的,头也跟随摆动的
_gridPos = mapGridPosition getPos player 转换getpos坐标为 GPS坐标
_veh = createVehicle ["ah1w", position player, [], 0, "FLY"]
这样可以刷出一出生就是飞行的单位
以多个条件为触发
@((Not alive _ap)||(player distance _ap <= random 50)||(getdammage _ap >= 0.000001)) 满足一个条件即可
@((Not alive _ap)AND(player distance _ap <= random 50)AND(getdammage _ap >= 0.000001)) 满足所有条件
?(()||()||()) 例子
@({_x == "SmokeShellRed"} count magazines player == 0) 检测玩家身上是否携带有烟雾弹无即触发
检测高度作为条件 // ?(position XXX select 2 <= 60):goto "xxx"
检测速度条件 // ?(speed player) >= 10
检测单位不等于某些事情 ?(_mm != player)
如果单位不在载具里 @not (_ma in _fly1)
如果单位在载具里 @(_ma in _fly1)
?(_ap in (units group GroupName))判断单位在不在一个指定的小队里
player setUnitRecoilCoefficient 10 调整玩家后助力 1.62和AA3可用
this addEventHandler ["handleDamage", { (damage (_this select 0)) + ((_this select 2) * 0.03) }];
使命召唤一样的HP~后面那个0.03越小越难死,从0到1 该脚本代表中一枪扣多少血~一枪一0.1的话那么就是十枪,一枪0.01就是一百枪
player addAction ["call Medic", "mdd.sqs"];给玩家增加一个菜单,菜单里不能给脚本定义单位,所以菜单里的脚本是用来调用另外一个脚本的
mdd.sqs里面只要一句话:[md] exec "jiaoben.sqs"这样就能给予某个单位定义了
[_unit] joinSilent GrpNull;//单位脱离一个小队
({_x distance _ap <= 20} count (AllUnits - [_ap])) == 1 出去单位_ap 其他任何单位只要一个靠近都触发
{this reveal _x} forEach allUnits 该单位了解整个地图上的任何单位
Floor random 3.5 向下化整数
Ceil random 3.5 向上化整数
_sp = speed _h1 * 0.28 就可以吧速度单位化为向量中的数值单位
_h1 setvelocity[_sp*sin(getdir _h1),_sp*cos(getdir _h1),0]
{addswitchableunit _x} foreach units group this;整个小队都是可以控制的
删除死亡单位 { deleteVehicle _x } forEach allDead;重复执行就可以了~删除所有死的单位
镜头抖动
抖动强度 抖动时间 抖动节奏
addCamShake [10, 10, 5]
沙尘暴 0.01为沙尘暴间隔 0.8为颜色,单位越小颜色越深 设置为true则为飞报纸 必须用触发器触发否则无效
[name,0.01,0.8,false] call BIS_fnc_sandstorm;
添加一个F7 function INIT那里填上下句,风沙的脚本才能执行
必须用触发器触发或者脚本触发不能直接天道INIT上
THIS attachTo [player,[-5,20,0]]约束四个游戏逻辑在玩家四周就可以模拟出很多沙尘在周围了
下面为例子 分别四个游戏逻辑 P1 P2 P1_1 P2_1
[p1,0.005,0.5,false] call BIS_fnc_sandstorm;[p2,0.005,0.5,false] call BIS_fnc_sandstorm;[p1_1,0.005,0.5,false] call BIS_fnc_sandstorm;[p2_1,0.005,0.5,false] call BIS_fnc_sandstorm;p1 attachTo [player,[5,10,0]];p1_1 attachTo [player,[-5,10,0]];p2 attachTo [player,[5,-10,0]];p2_1 attachTo [player,[5,-10,0]]
触发器内所有单位或者特定阵型单位统一做一样事情
{_x stop true} foreach thislist 单位统一不动
{_x 任意自定义} foreach thislist
this EnableIRLasers true 单位作战时自动打开镭射灯
{_x EnableIRLasers true} forEach units group a1
unitName enableGunLights true 单位使用枪灯
{_x EnableIRLasers true} forEach units group this;{_x enableGunLights true} forEach units group this;
n1 reveal n2
{_x = _TA} foreach thislist
约束电脑的行为
setspeedmode "limited" 设置速度为慢
h1 dowatch sd 单位朝向方向 载具单位没效果
dofire不可用于锁定单位攻击的目标,但是 dotarget可以
this setunitpos "middle" 保持蹲姿
this setunitpos "up" 站姿
this setunitpos "kneelDown" 蹲下或者趴下
this setunitpos "auto" 自己选择
this forceSpeed 2; 移动速度
disableuserinput true 玩家失去操作效果
让电脑移动和直接传送电脑
n1 setpos getpos n2 、、 n1 move getpos n2、、n1 domove getpos n2
锁定一个单位离不开另一个单位身边,以000为中心最后一个数值是高度
THIS attachTo [XXX,[0,0,0]]
detach player 解锁以上命令
治疗~ 第一个name是接受治疗的单位
name action ["heal",name2]
5 fadeMusic 0 音乐五秒内渐变为0
5 fadeSound 0 所有游戏声音渐变为0 音乐播放不会被干扰
5 fadeRadio 0.1 无线电声音渐变为0
让一个叫NA的单位 移动到我希望移动到的地方 地图点击功能 触发一下后 点开地图来点一下地图就会发生
onMapSingleClick "na domove _pos; onMapSingleClick """";";
房屋内放置随机位置一个组 似乎附近的房屋的房间有多少才能写随机数字否则随机进大海
{_x setpos(nearestBuilding this buildingpos random 5)} foreach units n1
治疗~ 第一个name是接受治疗的单位
name action ["heal",name2]
this addeventhandler ["fired",{(_this select 0) setunitpos "up"}];this addeventhandler ["hit", {(_this select 0) setunitpos "middle"}]
单位一开火就站,一中枪就蹲
this setvelocity[5*sin(getdir _h1),5*cos(getdir _h1),0] 某单位恒定速度前进 需要脚本配合
Name disableAI "Move" – 单位不动
Name disableAI "Target" – 单位不瞄准
Name disableAI "Autotarget" – 单位变瞎子
Name disableAI "Anim" – 电脑单位失去所有能力
this enableAI "Move" 恢复电脑移动能力
{_x disableAI "Move"} forEach units group s2
电脑一组人全部不会跑
{_x enableSimulation false} foreach thislist
让一个触发器内的东西定住,但是恢复触发器的东西走动就要用班组命令才可以
而且载具要一个一个用h1 enableSimulation true 分开搞才可以
{_x enableSimulation true} forEach units group s2 用于解锁定住的命令 为班组命令
在脚本中使用 ?(xxx = true)为条件时,必须在此之前设置一个 xxx = false
@(g1); 在脚本中意为:直到等待g1 = true 的时候才继续运行脚本,可以简化脚本不需要运行goto
名子 = 职为 载具名
名子可以写你喜欢的,之后编写任务也很方便。
职为可以填上crew(这是指全部机组员)、driver(驾驶)、gunner(炮手)、commander(指挥官)等等,可能还有些我忘了吧。
载具名则填上你为你那个载具取的名子。
我已以下是例子,我有一台叫做"heli01"的直升机,我想把他的驾驶命名叫作"Pilot01"
所以就这样打 Pilot01 = driver heli01;
这样之后就可以对这台直升机的驾驶另外给script了~!
hintSilent format ["玩家分数:%1 \n 玩家杀敌数:%2",rating Player,_zhi]
""以内的%1就是""号以外的后面的第一个 第二个 数值等等
player addAction ["***", "a1.sqf", [①], ②15, ③false, ④true, "⑤", "⑥(_target == player)"];
我把知道的说一下
*** 动作菜单显示名字
①输入参数可传递到 a1.sqf脚本声明的变量中
②菜单显示的上下优先排序
③④这两布尔值啥意思???
⑤按下菜单时同时执行输入的命令?
⑥菜单显示的条件(循环检测)
{:soso_e144:} 我就不排版咯。。当时锻炼下看程序的能力。。。高手们的脚本可比这乱得多 |