OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: MRsteve 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
-
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"
***************************************
; 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
-
bmpsot is a Game Logic and i think that cracked it removing the eventhandlers that is,
Thanks for your time
MRsteve