Jump to content
Sign in to follow this  
barcode6

ArmA vehicle respawn script

Recommended Posts

Hello,

I wrote a simple ArmA sqf script that respawns vehicles. It accepts variables for respawn delay, respawn repititions and location. I would like to know if there is anything specific that should be present to use this in MP. OFP had ? !(local LocalServerObject):Exit to run only on server, avoiding multiple spawned vehicles, does ArmA have similar? I have not found that information thus far in my searches of this board and ofpec. This is also my first ArmA script so if there are any issues please post.

Anyhow here it is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_veh","_time","_reps","_marker","_type","_pos","_dir","_i"];

_veh = _this select 0;

_time = _this select 1;

_reps = _this select 2;

_marker = _this select 3;

_type = typeof _veh;

_pos = [(getpos _marker select 0),(getpos _marker select 1)];

_dir = getDir _veh;

_i = 0;

while {_i < _reps} do {

if (alive _veh) then {

sleep 10;

}

else {

sleep 30;

deletevehicle _veh;

sleep _time;

_veh = _type createvehicle _pos;

_veh setDir _dir;

_i = (_i+1);

sleep 20;

}

}

it is called with [AH_1,340,4,spawn01] execVM "scr\bar_spawn.sqf"; as a line in the missions init.sqs where AH_1 is the named target unit in the mission, 340 is the respawn delay, 4 is the number of times the unit will respawn, and spawn_01 is a named target (usually an invisible marker).

Barcode

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  

×