Home   Help Search Login Register  

Author Topic: AddAction after player respawns, + keep same name  (Read 2630 times)

0 Members and 6 Guests are viewing this topic.

RedHouse

  • Guest
AddAction after player respawns, + keep same name
« on: 22 Jun 2005, 21:51:38 »
Ok I have a 2 problems:

a) When a player respawns how do I Add an action to him, from and killed event handler script.

b) does the respawned unit still have the same name, because I cannot get a scoring system to work because of it. Lets say i named a unit w1 in the editor, after tht unit respawns is he still called w1? And iff not is their anyway i can name the new unit w1?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:AddAction after player respawns, + keep same name
« Reply #1 on: 23 Jun 2005, 15:49:01 »
when you respawn using normal respawn eg player v player type (not group respawn) you actually spawn into a new unit

the only thing that remains the same is the class of unit and the unit name,

hint format"%1"_name W1]

so if you are going to do your own scoring system then you would have to
add it using that variable

adding or removing an action via an addeventhandler killed is easy

INIT.SQS
Quote
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
tx_myaction = Player addaction ["Do My action","myaction.sqs"]


playerkilled.sqs]
Quote
Player removeaction tx_myaction
player removeAllEventHandlers "Killed"
@alive player
player addEventHandler ["killed", {_this exec "tx_sys\Client\playerkilled.sqs"}]
tx_myaction = Player addaction ["Do My action","myaction.sqs"]

If you offered some more insight into what you wanted your scoring system to achieve then i may be able to come up with a different alternative
« Last Edit: 23 Jun 2005, 15:51:02 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

RedHouse

  • Guest
Re:AddAction after player respawns, + keep same name
« Reply #2 on: 23 Jun 2005, 18:24:00 »
well ive already tried that but player addAction  & addEventHandler seems to just add it to your dead body. And are you sure the new unit keeps the same name?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:AddAction after player respawns, + keep same name
« Reply #3 on: 24 Jun 2005, 15:06:18 »
And are you sure the new unit keeps the same name?
for ai units yes and the player unit obviously retains the players name

One more thing that remains the same is the group that the unit was in


try it

run the following code


Mission Editor
Create 2 units, one which you will play and another unit which is "Playable" and link it so its in your group
name this additional unit "W1"
and create a marker called respawn_west


Description.EXT
Quote
respawn=3
respawndelay=2
disabledAI = 0

Init .sqs
Quote
tx_Oldname = name W1
{_x addEventHandler ["killed", {_this exec "killed.sqs"}]}foreach  units group player

Killed .sqs
Quote
{_x removealleventhandlers "killed"}foreach  units group player
~5
{_x addEventHandler ["killed", {_this exec "killed.sqs"}]}foreach  units group player
_array =[]
{_array = _array + [name _x]} foreach  units group player
hint format ["Old = %1\nGroups= %2",tx_Oldname,_array]
exit

kill the unit in your group, wait for it to respawn
and kill it again

you will see the same name in the hint message which is the name of all units in your group
compare that name to the initially saved name of W1 and you will see they are indeed the same


to have your system work the way you want it too, will require some publicvariabling and manipulating arrays
« Last Edit: 24 Jun 2005, 15:55:44 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

RedHouse

  • Guest
Re:AddAction after player respawns, + keep same name
« Reply #4 on: 03 Jul 2005, 18:35:11 »
cheers yea, i fixed it but found out the problem wasnt anyhing to do with the name, had me frustrated for days, cause everything looked good, nothing looked wrong.