OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gundernak on 13 Jan 2004, 21:51:12

Title: eventHandler
Post by: gundernak 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
Title: Re:eventHandler
Post by: Igor Drukov 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 (http://www.ofpec.com/editors/resource_view.php?id=543)).



Ig.
Title: Re:eventHandler
Post by: gundernak 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?
Title: Re:eventHandler
Post by: Igor Drukov 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.
Title: Re:eventHandler
Post by: gundernak on 14 Jan 2004, 20:35:55
thanks man!

understood ;)