Home   Help Search Login Register  

Author Topic: making old leader, new leader in old group  (Read 1157 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
making old leader, new leader in old group
« on: 27 Mar 2005, 16:12:05 »
Respawn = 3

What 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 _____
Quote
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
?(local player):tx_mygroup = group player
?(local player)&& (leader player == player):tx_leader = true

playerkilled.sqs
Quote
Player 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
« Last Edit: 27 Mar 2005, 16:14:16 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Blanco

  • Former Staff
  • ****
Re:making old leader, new leader in old group
« Reply #1 on: 27 Mar 2005, 17:56:25 »
Can this help you?

Search or search or search before you ask.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:making old leader, new leader in old group
« Reply #2 on: 27 Mar 2005, 22:57:47 »
Just the job thx

playerkilled.sqs

Quote
Player 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
[Player] join tx_mygroup
?(tx_leader):_squad = units tx_mygroup
?(tx_leader):_squad = _squad - [Player]
?(tx_leader):_squad join grpnull
?(tx_leader):_squad join tx_mygroup
enableradio true

~1
Player setcaptive false
~5
?(tx_debug):titletext[format["tx_mygroup = %1\n\n_mygroup = %2",tx_mygroup],"PLAIN"]
exit
« Last Edit: 27 Mar 2005, 22:58:32 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123