Home   Help Search Login Register  

Author Topic: Vehicle Respawn Problem  (Read 1322 times)

0 Members and 1 Guest are viewing this topic.

DBR_ONIX

  • Guest
Vehicle Respawn Problem
« on: 12 Oct 2004, 15:08:15 »
I wrote this script for my squad's (RCIR) training island map :
Code: [Select]
_veh = _this select 0
_pos = getpos _veh
_vehtype = typeof _veh

#loop
?!(alive _veh): GOTO "fix"
~1
GOTO "loop"

#fix
~5
newveh = _vehtype createvehicle _pos
deletevehicle _veh
[newveh] exec "veh.sqs"
EXIT

It works fine if there is one player using it.. But when two people are playing, 2 vehicles respawn, 3 players, 3 vheicles spawn etc...

I know all I'm missing is a bit of code before the bit that creates the veichle, but I'm not sure what it is..
?(player=server):then create the vehicle

Or something like that, but not sure.. I've not tested that bit of code btw  ::)

Thanks!
- Ben

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Vehicle Respawn Problem
« Reply #1 on: 13 Oct 2004, 05:50:05 »
put a game logic on the map named server

then the first line of your script should be:
?!(local server):goto "end"

then at the end put:
#end
exit

Also I don't think you need to call the script again as you have:
Quote
[newveh] exec "veh.sqs"
I use karillions vrs script, which is similar and it does not call the script again, also he uses @!canmove _veh to initiate the the respawn, and here too I have had no probs.
  Hope this helps

DBR_ONIX

  • Guest
Re:Vehicle Respawn Problem
« Reply #2 on: 14 Oct 2004, 19:42:45 »
?!(local server):exit
Thats the code ;D
Thanks a million :)

Oh, because I use deletevehicle to remove the dammaged car, it no longer has the respawn script attached to it, thus the line of code to run it again (The vehicle doesn't get setdammaged back)

The multiple vehicles was the only problem I could see

I'll add a second option with the canmove bit, that adds an action to the vehicle to respawn it (Sometimes a inombile car might be used as cover etc)

Thanks soo much tho :)
- Ben