Home   Help Search Login Register  

Author Topic: hi all, yet another vehicle respawn  (Read 1168 times)

0 Members and 1 Guest are viewing this topic.

MRsteve

  • Guest
hi all, yet another vehicle respawn
« on: 06 Mar 2004, 20:43:12 »
Hi all,
        MRsteve here,
                               Just got back into editing and playing OFP since the days of 1.20 and WOW!
 Ok I tried to make an easy unit specific respawn script for MP(not wanting to use the work of others and wanting to learn also)
So I made this .sqs:

; ***************************************
; BMP2 vehicle respawn
; ***************************************
; Select the Unit
_unit = _this select 0
;-Delay the delete after death
~10
;  delete old
deletevehicle _unit
; Create a new BMP2
_unit = "BMP2" createVehicle getpos bmpspot
_unit addeventhandler ["killed", {_this exec "bmpspawn.sqs"}]
exit

 It works a treat ,but after a while  the vehicles stop getting destroyed and will not blow up, any ideas other than use a already known script most welcome.
It seemed that this would be an efficient way of doing respawn(with eventhandlers)
Also in init of orig BMP:this addeventhandler ["killed", {_this exec "bmpspawn.sqs"}]

Any ideas or similar encountered? The map kicks ass when i played online, but a shame when vehicles stop spawning.
Thanks all
MRsteve

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:hi all, yet another vehicle respawn
« Reply #1 on: 07 Mar 2004, 15:39:39 »
first of all the script needs to run server side only

secondly I see you have a setpos command for location bmpspot
What is bmpspot, is it a marker, gamelogic, what ???

Just to be on the safeside i would also remove the event handler from the old destroyed vehicle

eg.
_Unit removeAllEventHandlers "Killed"

Quote
***************************************
; BMP2 vehicle respawn
; ***************************************
; Select the Unit
_unit = _this select 0
;-Delay the delete after death
_Unit removeAllEventHandlers "Killed"
~10
;  delete old
deletevehicle _unit
; Create a new BMP2
_unit = "BMP2" createVehicle getpos bmpspot
_unit addeventhandler ["killed", {_this exec "bmpspawn.sqs"}]
exit
« Last Edit: 07 Mar 2004, 15:43:03 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

MRsteve

  • Guest
Re:hi all, yet another vehicle respawn
« Reply #2 on: 07 Mar 2004, 15:57:29 »
bmpsot is a Game Logic and i think that cracked it removing the eventhandlers that is,
Thanks for your time
MRsteve