Home   Help Search Login Register  

Author Topic: Random vehicle respawn  (Read 1170 times)

0 Members and 1 Guest are viewing this topic.

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Random vehicle respawn
« on: 14 Jun 2008, 19:01:00 »
After doing an extensive search , I've drawn a blank for results for my topic. For the mission I'm working on presently, I would like vehicles to repawn in different areas on a particular Island. Could someone please explain how to make this happen.

Regards,
TCM

Offline Rommel92

  • Members
  • *
Re: Random vehicle respawn
« Reply #1 on: 14 Jun 2008, 19:58:15 »
Code: [Select]
private ["_veh","_dir","_pos","_type","_unit","_wait"];

if !( IsServer ) exitWith {};

_veh = _this select 0;
_dir = getDir _veh;
_pos = getPos _veh;
_type = typeOf _veh;
_unit = driver _veh;

sleep 5;

while {true} do
{
while {_veh distance _pos < 5 && canMove _veh} do
{
sleep (random 10);
};
while {canMove _veh && count crew _veh > 0 && ({damage _x}forEach crew _veh)!= 1} do
{
sleep (random 10);
};

_wait = time + 137;

while {canMove _veh && count crew _veh < 1 && Time < _wait} do
{
sleep (random 10);
};
while {canMove _veh && {damage _x} forEach crew _veh >= 1 && Time < _wait} do
{
sleep (random 10);
};

sleep 163;

deleteVehicle _veh;
_veh = _type createVehicle _pos;
_veh setDir _dir;
_veh setPos _pos;
sleep 1.0;
_veh setVelocity [0,0,0];
sleep (random 20);
};

 ;)

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re: Random vehicle respawn
« Reply #2 on: 14 Jun 2008, 21:11:57 »
since I'm not a scripting guru, can you please explain how do do this in mission editor? I'm going to assume I would need markers but how is everything work?

TCM

Offline Rommel92

  • Members
  • *
Re: Random vehicle respawn
« Reply #3 on: 15 Jun 2008, 23:48:37 »
I'm in not state atm to explain it, however heres an example mission to show you how to implement it.


Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re: Random vehicle respawn
« Reply #4 on: 21 Jun 2008, 06:12:56 »
Thanks for your help romm!

TCM