Home   Help Search Login Register  

Author Topic: How to detect units which have respawned?  (Read 1625 times)

0 Members and 1 Guest are viewing this topic.

Demoniac

  • Guest
How to detect units which have respawned?
« on: 02 Sep 2002, 18:38:48 »
Can anybody tell me how to detect units which have respawned, so I can remove the stupid M16 with only 30 shots and give them some real weapons? I've found a way for it in a simple deathmatch (giving them a negative rating changes their side to ENEMY so only units that have just respawned will activate the trigger, and then the trigger will run a script so all the units in its list are given a negative rating) but I don't know how to detect only the units that have just respawned in a team battle. When you just put a unit into a variable, they will no longer be linked when the unit has respawned :(

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:How to detect units which have respawned?
« Reply #1 on: 03 Sep 2002, 15:23:22 »
If you use a trigger with the condition:

alive unit

it will activate every time unit respawns.
You could have a trigger for every unit, or you could have just one trigger with the condition line:

alive player

which will activate on each clients computer when they respawn. You could use this trigger to rearm the players soldier. I recently used it in conjunction with a script to rearm the player to have the exact loadout they had at the start of the mission (this based on the name of the players unit).

Anyway, there's a couple of ideas. I'm sure you can work out which works best for your particular situation ;)

Rodd

  • Guest
Re:How to detect units which have respawned?
« Reply #2 on: 19 Sep 2002, 00:22:57 »
Sui, can you figure this one out for me then:

I have a mission with a civilian man and a west soldier. Respawn is enabled and the civilian guy respawns nicely as he is supposed to. I have put this exec "RSTest.sqs" in the initialization field. Where RSTest.sqs contains this:
Quote
@(!alive _this)
hint "The civilian died"
@(alive _this)
hint "The civilian respawned"

When the civilian dies and then respawns the poor guy is no longer quite himself, so the @(alive _this) waits for ever.

Can the respawned unit be detected by the script or do I have to make the references to him by name (instead of variable this)?

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:How to detect units which have respawned?
« Reply #3 on: 19 Sep 2002, 01:28:42 »
Hmmm...

From what I've seen the 'designation' of a unit changes when it is killed...

You could try using it's name. I think that would work ;)