这是一个测试脚本如果是创建物品就没问题,是步兵单位运行不到一分钟游戏就崩溃了不知道问题出在哪里希望大家帮忙测试一下
player allowDamage false;
hint "开始...";
[[["O_Soldier_AR_F"], {
xxxyy = {
_Class = _this select 0;
_width = _this select 1;
_length = _this select 2;
_shells = _this select 3;
_side = if((playerSide == west)||{playerSide == resistance}||{playerSide == civilian})then{east}else{west};
_grp = createGroup _side;
_Pos = getPosASL player;
_dir = random 360;
_shellsPerMetre = _shells / _length;
for [{ _i = -(_length / 2) }, {_i < (_length / 2) }, { _i = _i + (1 / _shellsPerMetre) }] do {
_rnd = (random _width) - (_width / 2);
_Pos1 = [(_Pos select 0) + (_i * sin _dir) + (_rnd * cos _dir), (_Pos select 1) + (_i * cos _dir) + (_rnd * sin _dir), 9999];
_round = if(_Class isKindOf "man")then[{if(_Class isKindOf "Animal")then[{createAgent [_class, _Pos1, [], 0, "FORM"]},{_grp createUnit [_class, _Pos1, [], 0, "NONE"]}]},{_Class createVehicle _Pos1}];
_Pos1 set [2, getPosASL player select 2];
_round setPosASL _Pos1;
_round setDir (random 360);
sleep 0.1;
}};
(_this select 0) spawn {
while {true} do {
waitUntil {!isNull player && {alive player}};
[_this, 30+(random 170), 50+(random 150), 50+(random 150)] call xxxyy;
};
};
}], "BIS_fnc_spawn", true, true] call BIS_fnc_MP; |