Jump to content
Sign in to follow this  
curtcooll

setting AI unit name after respawn

Recommended Posts

ok im using AI re spawn script is there anyway i can make it so the ai has the same name as when it re spawns it resets with no name?

Share this post


Link to post
Share on other sites

ok so i had a look around and the script i use to respawn vehicle allows it to keep the units name when it respawns so how can i change code for a AI unit name.

// Respawn vehicle
     if (_dead) then 
{	
	if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};
	if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
	if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit; hint "dude";};
	sleep 0.1;

	deleteVehicle _unit;
	sleep 2;
	_unit = _type createVehicle _position;
	_unit setPosASL _position;
	_unit setDir _dir;

	if (_haveinit) then 
				{_unit setVehicleInit format ["%1;", _unitinit];
				processInitCommands;};
	if (_hasname) then 
				{_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];
				processInitCommands;};
	_dead = false;

	// Check respawn amount
	if !(_noend) then {_rounds = _rounds + 1};
	if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
};
};

---------- Post added at 21:48 ---------- Previous post was at 20:15 ----------

someone please help me spent 3 days trying to solve this one thing what i just did is change everything in vehicle respawn script to spawn the ai pilot it spawns unit but it still does not retain its name im pulling my hair out it looks so simple yet i cannot do it.

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  

×