I have a single-player tank that all players will use. The tanks are locked so they cannot escape. I am still working on it, but eventually I hope to guarantee that the player goes when the tank goes, and vice versa. That's not the problem here -- just assume for now that I am able to destroy the tank and the player when I suicide (blow up a gas station point blank).
I need the players to respawn in fresh single-player tanks. I have gotten that working for the initial spawn, based on some tips I saw in the respawning thread. The problem seems to be that when a player dies, they are respawned as a copy, and my script doesn't take affect for them. I haven't proven it comprehensively yet, but you'll see why I think this from my code.
Here's the Init.sqs file:titleCut ["","BLACK IN", 3]
estimatedTimeLeft Param1
flag_scoreable = preprocessFile "flag_scoreable.sqf"
assign_flag_west = preprocessFile "assign_flag_west.sqf"
assign_flag_east = preprocessFile "assign_flag_east.sqf"
[E1] exec "assign_vehicle.sqs"
The assign_vehicle script is what actually puts the players into tanks. E1 is the text for the unit I am using for testing. Here's the code for assign_vehicle.sqs:? not local Server : exit
_player = _this select 0
_player_pos = getPos _player
_player_dir = getDir _player
; Assign this player a tank
#AssignTank
hint "Player gets a tank!!!!"
_new_tank = "M1A1_1P" createVehicle _player_pos
_player moveInDriver _new_tank
_new_tank lock true
@!alive _player
hint "Player is Dead"
@alive _player
hint "Player is Alive"
goto "AssignTank"
So what happens is I get the "Player is Dead" hint but never the "Player is Alive" hint. My player respawns at the spawn point with just an M16 and some ammo. No tank.
So to recap:
- I can initially spawn in the tank.
- I can never spawn in it afterwards.
I think there's a fundamental problem I am missing, and this isn't vehicle-specific. Any tips would be valueable.