Home   Help Search Login Register  

Author Topic: vehicle respawn  (Read 452 times)

0 Members and 1 Guest are viewing this topic.

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
vehicle respawn
« on: 06 Nov 2004, 22:05:56 »
hi guys! it's me the pasky Trash Can Man!  ;D. I know how to make vehicles respawn via scripting, but what I need to know now is how to set my script so that they (The vehicles) only respawn a certain number of times. For example, 3 times. How do I add this to my exsisting script?

Regards,
Trash Can Man

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:vehicle respawn
« Reply #1 on: 06 Nov 2004, 22:21:14 »
We need to look at the script then don't we? ;)

:beat: *Gets Shot* :beat:

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re:vehicle respawn
« Reply #2 on: 06 Nov 2004, 23:36:00 »
ummmmmmmmmmm  of course!!  silly me! here it is:


_vlogic = []
_vtime = []
_count = count vehicles
_delay = 10

_i = 0
#load
_v = vehicles select _i
_vl = "Logic" createVehicle getPos _v
_vl setDir getDir _v
_vlogic = _vlogic + [_vl]
_vtime = _vtime +

_i = _i + 1
?_i < _count : goto "load"

#init
_i = 0
~3
#alive
_v = vehicles select _i
_vl = _vlogic select _i
?alive _v and _vl distance _v < 100 : goto "continue"
?alive _v and count crew _v != 0 : _vtime set [_i, 0]; goto "continue"
_vt = _vtime select _i
?_vt != 0 and _vt < _time : goto "notalive"
?_vt == 0 : _vtime set [_i, _time + _delay]
#continue
_i = _i + 1
?_i < _count : goto "alive"
goto "init"

#notalive
_vtype = typeOf _v
deleteVehicle _v
~1
_v = _vtype createVehicle getPos _vl
_v setDir getDir _vl
vehicles set [_i, _v]
_vtime set [_i, 0]

publicObject = _v
publicVariable "publicObject"
goto "continue"

well, this is the vehicle respawn i use
« Last Edit: 06 Nov 2004, 23:36:21 by Trash Can Man »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:vehicle respawn
« Reply #3 on: 07 Nov 2004, 03:35:06 »
at the beginning you could have something like:
_respawnCount = 3

and then at the end of the part that respawns them put:
_respawnCount = _respawnCount - 1
?respawnCount == 0:goto "end"

and of course, "end" is the very last thing on the script and it would just be:
#end
exit

although looking at the script you use it might not work..... :hmm: