Jump to content
Sign in to follow this  

Spawned enemy from a script keep respawning once killed?

Recommended Posts

My mission has various scripts that spawn enemy units at various locations and different times through out the mission. The problem that I have noticed is that the enemy will re spawn.

An example is this I have a truck spawn full of enemy units. I engage with Nlaw and destroy the truck, some of the enemy jump out and start to fire back.

I kill some of them and then the next thing the truck re spawns with all the men in it and we start again??

Do I need to put something to end the script once it has been called?

Here is one of the scripts that I use:

_spawn = [getmarkerpos "sup11", "Kamaz", "ssp1a",0] execVM "mission7a.sqf";
_spawn = [getmarkerpos "sup12", "BTR90", "ssp1c",0] execVM "mission7a.sqf";


_spawn_zone = _this select 0;
_veh_type = _this select 1;
_name = _this select 2;
_dir = _this select 3;// new

_group = createGroup east;
_veh = createVehicle [_veh_type, _spawn_zone, [], 0, "NONE"];
_driver = _veh emptyPositions "driver";
_gunner = _veh emptyPositions "gunner";

_cargo = (_veh emptyPositions "cargo") - 1;
if (_driver > 0) then {"RU_Soldier_AR" createUnit [_spawn_zone, _group, "this moveinDriver _veh;this assignAsDriver _veh;this setskill [""general"",1];"];};
if (_gunner > 0) then {"RU_Soldier_AR" createUnit [_spawn_zone, _group, "this moveinGunner _veh;this assignAsGunner _veh;this setskill [""general"",1];"];};
if (_commander > 0) then {"RU_Soldier_Crew" createUnit [_spawn_zone, _group, "this moveinCommander _veh;this assignAsCommander _veh;this setskill [""general"",1];"];};
for "_i" from 0 to _cargo do
"RU_Soldier_AR" createUnit [_spawn_zone, _group, "this moveinCargo _veh;this assignAsCargo _veh;"];
_veh setdir _dir;// new
_veh SetVehicleVarName _name;
call compile format["%1 = _veh", _name];
_patrol = [_group, getmarkerpos "pat71", 400] call bis_fnc_taskPatrol;

Share this post

Link to post
Share on other sites

I think I have found the problem in my mission, I have a caching script running in the back ground. I have removed this and it seems ok at the moment

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this