OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: laggy on 14 Feb 2009, 16:13:02

Title: Eventhandler "killed" questions... again
Post by: laggy on 14 Feb 2009, 16:13:02
Working on a Detect Bodies script, I came up with a couple of questions.

1. - In the eventhandler "killed":

_this select 0 is the unit that got killed
_this select 1 is the killer and that starts my question.

Who or what value/variable is returned when the unit is either killed by a traffic accident or drops off the roof of a building? In OFP it allways said "unit killed by friendlyFire" in those situations, in ArmA I don't know.

Is friendlyFire == CIVILIAN or what? Can you determine the "side" of the killer even if death by accident?

2. - Are eventhandlers "passive" in terms of demanding PC power until they are activated, or are they constantly checking if the conditions are true or false, just like a trigger. Wondering because of desire to not affect performance in missions.

EDIT: Googled eventhandler "killed" and found this on the Wiki:

Quote
    *  unit: Object - Object the event handler is assigned to
    * killer: Object - Object that killed the unit
      Contains the unit itself in case of collisions.

Guess that answers the first question.

Laggy
Title: Re: Eventhandler "killed" questions... again
Post by: Worldeater on 14 Feb 2009, 16:49:10
1. To quote the event handler description (http://community.bistudio.com/wiki/ArmA:_Event_Handlers#Killed) for "Killed":

Quote
Passed array: [unit, killer]
...
killer: ... Contains the unit itself in case of collisions.

Since ArmA ony checks the sides of unit and killer it claims you've been killed by "friendly fire" (which is technically correct, since you are always on your side)... :)


2. Yes, event handlers are "passive". That's the whole point of having them.
Title: Re: Eventhandler "killed" questions... again
Post by: laggy on 14 Feb 2009, 16:55:34
Quote
2. Yes, event handlers are "passive". That's the whole point of having them.

So that means that I could in theory put my eventhandler on every unit on the map in a massive mission, meaning hundreds of units and the performance wouldn't be affected until too many eventhandlers were activated?

Thanks,

Laggy
Title: Re: Eventhandler "killed" questions... again
Post by: Worldeater on 14 Feb 2009, 17:48:57
Theoretically: yes.
Practically: dunno (keep in mind that I don't know for sure what's going on inside the engine).

I'd say give it a try. Create some epic battle and see if it hits performance. :)
Title: Re: Eventhandler "killed" questions... again
Post by: Ext3rmin4tor on 14 Feb 2009, 20:14:40
I don't think event handler will affect your game performance since they're probabily casted by the game engine when the particular event happens.