Home   Help Search Login Register  

Author Topic: Eventhandler "killed" questions... again  (Read 1096 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Eventhandler "killed" questions... again
« 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
« Last Edit: 14 Feb 2009, 16:29:13 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Eventhandler "killed" questions... again
« Reply #1 on: 14 Feb 2009, 16:49:10 »
1. To quote the event handler description 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.
try { return true; } finally { return false; }

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Eventhandler "killed" questions... again
« Reply #2 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
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Eventhandler "killed" questions... again
« Reply #3 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. :)
try { return true; } finally { return false; }

Offline Ext3rmin4tor

  • Members
  • *
Re: Eventhandler "killed" questions... again
« Reply #4 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.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!