Home   Help Search Login Register  

Author Topic: eventHandler  (Read 467 times)

0 Members and 1 Guest are viewing this topic.

gundernak

  • Guest
eventHandler
« on: 13 Jan 2004, 21:51:12 »
 Hi all,

1:
I would like to know is there more else eventHandler than the ones in the official com ref?

or

2: could you offer me an eventhandler detecting that my unit have killed another unit.

(I guess 'killed' eventHandler detects that the unt is killed by, and by whom)

I need a check for the moment when my unit is the killer...


thanks in advance

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:eventHandler
« Reply #1 on: 13 Jan 2004, 23:03:07 »
Hey !


This :


Code: [Select]
anyunit AddEventHandler ["Killed",{if (_this select 1==player) then {myconsequence}}]

should do the trick : _this select 1 returns the unit that kills in the case of "Killed" EHs (see here).



Ig.

gundernak

  • Guest
Re:eventHandler
« Reply #2 on: 13 Jan 2004, 23:25:11 »
am I right that I have to put this eventHandler to the potential victims init field?

If it is true and I have 50 potential victims each one has to got one eventhandler.

Will not it slow down the game?

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:eventHandler
« Reply #3 on: 14 Jan 2004, 14:57:54 »
Hey !


You can use a trigger covering your mission area, in the activation field of which you'll type :


Code: [Select]
"_x AddEventHandler [""Killed"",{if (_this select 1==player) then {myconsequence}}]" foreach thislist

Test it, unless your consequences require heavy scripting or all your units die at the same time, this should not slow down the game.



Ig.

gundernak

  • Guest
Re:eventHandler
« Reply #4 on: 14 Jan 2004, 20:35:55 »
thanks man!

understood ;)