Home   Help Search Login Register  

Author Topic: Problem with Vehicle Respawn Script, Help Needed  (Read 1353 times)

0 Members and 1 Guest are viewing this topic.

24Gamer

  • Guest
Problem with Vehicle Respawn Script, Help Needed
« on: 03 May 2004, 19:08:37 »
Here is the Script i made;

?!(local Server):exit

_obj = _this select 0
_vdelay = _this select 1
_type = _this select 2

_pos = getPos _obj
_dir = getDir _obj

#alive
?(getdammage _obj < 1): goto "alive"
Hint Format ["%1 Destroyed, It will respawn in %2s", _type, _vdelay]

#Spawn
~_vdelay
deleteVehicle _obj
~1
_obj = _type createVehicle _pos
_obj setDir _dir
Hint Format ["%1 Has Respawned", _type]
goto "init"


the following code is attached to each object i wish to spawn;
[this, 30, "Truck5tReammo"] exec "vehicle.sqs"


the problem is that a vehicle is spawned for every player playing.
when i was testing it on my own it was ok but once i tested it online it kept spawning multiples.
i think it has something to do with the script running on all the computers.
is ?!(local Server):exit wrong?
« Last Edit: 03 May 2004, 19:09:04 by 24Gamer »

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Problem with Vehicle Respawn Script, Help Needed
« Reply #1 on: 03 May 2004, 19:20:33 »
It's right, but I bet you haven't placed a gamelogic named as 'Server' in editor have you?

What the '?!(local Server):exit' line actually does is that it checks if a unit called 'Server' is local to the machine where the script is executed and if not it exits the script. The 'unit' should be a gamelogic because gamelogics are local on server only.
Not all is lost.

24Gamer

  • Guest
Re:Problem with Vehicle Respawn Script, Help Needed
« Reply #2 on: 03 May 2004, 19:41:18 »
you guessed right   ;)
thanks ill try it and hope it works  :D

24Gamer

  • Guest
Re:Problem with Vehicle Respawn Script, Help Needed
« Reply #3 on: 03 May 2004, 19:53:48 »
well erm  :-\
it worked but now it only spawns the vehicle once
vehicle destroyed = vehicle respawned -> vehicle destroyed = script not called

24Gamer

  • Guest
Re:Problem with Vehicle Respawn Script, Help Needed
« Reply #4 on: 03 May 2004, 19:58:22 »
don't worry just a little bug in my script
it is now fully functional  :D
thanks for the help  :)