有些任务要AI从A点到B点快速行军进行支援,要是途中遇敌如果距离比较近威胁比较大停下来自卫还击并尽可能快速结束战斗无可厚非,但是AI发现敌军却是蛋疼的趴在地上慢慢爬和还击时间拖得很长影响了任务节奏,本脚本能在一定程度改善这个问题。
通过第一个路点执行 EAST setFriend [WEST,1]; nul = [this] execVM "*.sqf";
_t = time;
_group = _this select 0;
_distance = 300;//两个距离根据需要设置
_distance2 = 100;
_a = {
{
Tag_u = _this select 0;
_x doFire Tag_u;
} forEach units group _group;
};
_b = true;
_on_off = true;
while {_on_off} do {
{
if(((_x distance _group) < _distance) && ((side _x)==WEST) && _b) then {
[_x] call _a;
waitUntil {(!alive Tag_u) or ((time - _t) >=2)};
_t = time;
};
if(((_x distance _group) < distance2) && ((side _x)==WEST)) then {
EAST setFriend [WEST,0];
_b = false;
}else{
EAST setFriend [WEST,1];
_b = true;
};
} forEach allUnits;
sleep 1;
};
/*到达目的地后在你的脚本或任务路点激活栏中输入:
_on_off = false;
EAST setFriend [WEST,0];
*/
|