Event Handlers – Arma 3 Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<code>" to "<code style="display: block">")
 
(10 intermediate revisions by 2 users not shown)
Line 4: Line 4:
Repro:
Repro:
* Add to player init
* Add to player init
<code>player addEventHandler ["Dammaged", {
<code style="display: block">player addEventHandler ["Dammaged", {
hint format ["Damage: %1", _this select 2];
hint format ["Damage: %1", _this select 2];
}];</code>
}];</code>
Line 23: Line 23:


-- Yes, Dammaged EH is less sensitive than HandleDamage, not sure if there is a defined threshold.
-- Yes, Dammaged EH is less sensitive than HandleDamage, not sure if there is a defined threshold.
::So we should add a note to the documentation? I'm pretty sure a threshold of 0.5 exists, but that obviously needs testing of verification from bistudio to justify an absolute statement. I'd consider any verifiable fact that affects returns to be important to note, even if the fact is imprecise. A note to the effect that "Dammage will not necessarily trigger for < 0.5 damage", would at least save some folk the trouble I had trying to figure out WTF was going on. [[User:Fred Gandt|Fred Gandt]] ([[User talk:Fred Gandt|talk]]) 04:30, 4 March 2014 (CET)
-- I wouldn't put any definite numbers if I were you. It needs to be tested not only with units and as far as I remember for vehicles you can get EH triggered for damages < 0.5. I personally think copy paste from "Hit" EH where it explains sensitivity  would be sufficient.
::I'm not seeing ''Dammage EH'' triggering for less than 0.5 on Pawnees, Hunters and others, but sure, without confirmation (it'll be in the code somewhere), figures are tough to justify. I agree; a copy-paste of the note in ''Hit EH'' would be a start (I noticed that after my last comment here). At least it gives a clue to expect less than obvious behaviour. [[User:Fred Gandt|Fred Gandt]] ([[User talk:Fred Gandt|talk]]) 13:42, 4 March 2014 (CET)
== Curator handler locality ==
''"Curator Event Handlers are also added with addEventHandler command and are supposed to be added to curator object (not player object) and where curator object is local and will be executed only where curator is local (i.e., on computer of player who's in control of it)."''
Assuming there can be more than one possible curator (user not object and perhaps not simultaneously), and a handler is added during the curation by ''Player 1'', will the EH be local to ''Player 2'' if they take over the curator role?
;Also, I suggest this grammatical structure and wording
:''"Curator Event Handlers are also added with the addEventHandler command, are supposed to be added to the curator object (not the player object), where the curator object is local, and will be executed only where the curator is local (''i.e.'' on the computer of the player who's in control of it)."''
Although I'm not sure yet if ''curator'' should be ''"a curator"'' or ''"the curator"''. I assume there can be only one (object), even if there are multiple possible users of it?&nbsp;--&nbsp;[[User:Fred Gandt|Fred Gandt]]&nbsp;<span style="font-size:80%;vertical-align:3px;line-height:0px;">([[User talk:Fred Gandt|talk]]/[[Special:Contributions/Fred Gandt|contribs]])</span> 13:23, 22 April 2014 (CEST)

Latest revision as of 11:53, 11 January 2023

Dammaged

Appears to only trigger if the damage is greater than 0.5

Repro:

  • Add to player init

player addEventHandler ["Dammaged", { hint format ["Damage: %1", _this select 2]; }];

  • Set elevation to 5 metres.
  • Preview.
  • Exit.
  • Set elevation to 4.5 meters.
  • Preview.

You may need to fiddle with those figures a bit, but it's a quick and dirty method to test.

Observe: Only damage above 0.5 is hinted.

Am I wrong, or should this be noted in the documentation?

Fred Gandt (talk) 06:54, 3 March 2014 (CET)

-- Yes, Dammaged EH is less sensitive than HandleDamage, not sure if there is a defined threshold.

So we should add a note to the documentation? I'm pretty sure a threshold of 0.5 exists, but that obviously needs testing of verification from bistudio to justify an absolute statement. I'd consider any verifiable fact that affects returns to be important to note, even if the fact is imprecise. A note to the effect that "Dammage will not necessarily trigger for < 0.5 damage", would at least save some folk the trouble I had trying to figure out WTF was going on. Fred Gandt (talk) 04:30, 4 March 2014 (CET)

-- I wouldn't put any definite numbers if I were you. It needs to be tested not only with units and as far as I remember for vehicles you can get EH triggered for damages < 0.5. I personally think copy paste from "Hit" EH where it explains sensitivity would be sufficient.

I'm not seeing Dammage EH triggering for less than 0.5 on Pawnees, Hunters and others, but sure, without confirmation (it'll be in the code somewhere), figures are tough to justify. I agree; a copy-paste of the note in Hit EH would be a start (I noticed that after my last comment here). At least it gives a clue to expect less than obvious behaviour. Fred Gandt (talk) 13:42, 4 March 2014 (CET)

Curator handler locality

"Curator Event Handlers are also added with addEventHandler command and are supposed to be added to curator object (not player object) and where curator object is local and will be executed only where curator is local (i.e., on computer of player who's in control of it)."

Assuming there can be more than one possible curator (user not object and perhaps not simultaneously), and a handler is added during the curation by Player 1, will the EH be local to Player 2 if they take over the curator role?

Also, I suggest this grammatical structure and wording
"Curator Event Handlers are also added with the addEventHandler command, are supposed to be added to the curator object (not the player object), where the curator object is local, and will be executed only where the curator is local (i.e. on the computer of the player who's in control of it)."

Although I'm not sure yet if curator should be "a curator" or "the curator". I assume there can be only one (object), even if there are multiple possible users of it? -- Fred Gandt (talk/contribs) 13:23, 22 April 2014 (CEST)