Respawn = 3What i want to do, is have my player leave his group after being killed and respawned, until a reinforcement phase occurs (During which he is placed in a spectate mode cutscene system)
(if he is the group leader), when he is brought back into the game at reinforcement phase he then needs to become the group leader again
The problem is, because of a planned implementation for a mission commander command dialog, this needs to be the same group he was in at the start and not a new group
working off a killed event handler on all players i have the following
(None reletaed lines of code have been removed for clarity)
INIT.sqs;; ____ Respawn Module _____
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
?(local player):tx_mygroup = group player
?(local player)&& (leader player == player):tx_leader = true
playerkilled.sqsPlayer removealleventhandlers "Killed"
@alive player
[player] join grpnull
Player setcaptive true
enableradio false
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
(some rearming stuff, spectate mode stuff, other unrelated code, until reinforcement phase occurs, then script runs to #RESPAWN_NOW label
#RESPAWN_NOW
cutText ["Respawning","Black out",0.1]
~2
;;?! (tx_leader):[Player] join tx_mygroup
?(tx_leader):_squad = units tx_mygroup
?(tx_leader):_mygroup = group player
;;?(tx_leader):_unit = "SoldierWB" createUnit [getMarkerPos "respawn_guerilla", tx_mygroup]
?(tx_leader):_squad join _mygroup
?(tx_leader):_squad = units _mygroup
?(tx_leader):_squad join tx_mygroup
;;?(tx_leader):_unit setdammage 1
enableradio true
~1
Player setcaptive false
~5
?(tx_debug):titletext[format["tx_mygroup = %1\n\n_mygroup = %2",tx_mygroup],"PLAIN"]
exit
problem is
tx_mygroup becomes <grpnull>
if i use the blue lines to create a unit and add it to the tx_mygroup, prior to removing the existing units, and then try to join units in _mygroup to tx_mygroup, the player will not retake leadership.
because the _unit is created by script, i cannot deletevehicle it, hence the use of setdammage 1
I basically need the player to retake leadership in the existing group.
Any ideas
?
Thx in advance for any help offered