Jump to content

Recommended Posts

Hello,

 

I make a mission via editor just to make some fire training exercices.

 

I tested different Arma 3 respawn script, but i don't find a way to respawn objects (Land_balloon_01_water_F, soldiers...)

 

Do you have an idea ?

 

Thanks

 

463470201707301832011.jpg

Share this post


Link to post
Share on other sites

i tried this:

if (!alive this) then {sleep 1; "Land_Balloon_01_water_F" createvehicle position this};

dont seem to work tho :-/

Share this post


Link to post
Share on other sites

Hi @flyingcoyotus,

Try this code, it should works at least to setup yourself a little.

Spoiler

/**
 * Replace a "destroyed" object by a new one.
 * @param {Object} 		_obj 		The object to replace
 * @param {Array}		_pos		Position ATL of the object
 * @param {String}		_objType	Type of the object.
 * @param {Number}		_delay		Delay before cloning
 */
my_fnc_replaceObj = {
	_obj = _this select 0;
	_pos = _this select 1;
	_objType = _this select 2;
	_delay = _this select 3;
	sleep _delay;
	deleteVehicle _obj;
	_newObj = createVehicle [_objType, _pos, [], 0, "CAN_COLLIDE"];
	[_newObj, _delay] call my_fnc_respawnSystem;
};

/**
 * Detects when an object is "killed" and respawn it after a delay
 * @param {Object}	_obj 		The object
 * @param {Number}	delay 		Delay between each respawn in seconds
 */
my_fnc_respawnSystem = {
	_obj = _this select 0;
	delay = _this select 1;

	_obj addEventHandler ["killed", {
		_obj = _this select 0;
		_pos = getPosATL _obj;
		_objType = typeOf _obj;
		[_obj, _pos, _objType, delay] spawn my_fnc_replaceObj;
	}];
};

_objectsToSpawn = [balloon_1,balloon_2]; // Variable names for the objects. Set in the Editor "Variable Name"

{
  [_x, 1] call my_fnc_respawnSystem;
} forEach _objectsToSpawn;

 


There is probably better ways to achieve the same, but maybe you'll find it useful.

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

×