Jump to content

EVENT scripts: Difference between revisions

1,146 bytes added ,  1 December 2021
Added information about handling certain event types.
m (GAMEEVENT_ACTOR_ARMORDAMAGED is a new event type in 3.1.)
(Added information about handling certain event types.)
Line 32: Line 32:
;GAMEEVENT_ACTOR_ARMORDAMAGED 12 {{Devfeature|3.1|alpha}}
;GAMEEVENT_ACTOR_ARMORDAMAGED 12 {{Devfeature|3.1|alpha}}
:Behaves exactly like GAMEEVENT_ACTOR_DAMAGED but is triggered slightly earlier, just before an actor's armor can absorb any damage.
:Behaves exactly like GAMEEVENT_ACTOR_DAMAGED but is triggered slightly earlier, just before an actor's armor can absorb any damage.
== Event handling ==
You are allowed to modify the results of some events by changing the result value of the EVENT script itself via [https://zdoom.org/wiki/SetResultValue SetResultValue]. The event types that current support this are:
* '''GAMEEVENT_CHAT''': setting the result value to zero prevents the chat message from being printed onto the screen. If the result value is non-zero, the chat message will be printed like normal.
* '''GAMEEVENT_ACTOR_DAMAGED''' and '''GAMEEVENT_ACTOR_ARMORDAMAGED''': changing the result value affects how much damage the actor actually takes.
A few things to note are:
* If there are multiple EVENT scripts, the result of the event will be transferred from one script to the next. If more than one script tries to change the result of the event, then whichever script is fired last decides the outcome of the event.
* Event handling does not work at all in <tt>CLIENTSIDE</tt> scripts.
It's recommended that you change the result value in only one script per event type, unless you know the order in which the scripts are fired (e.g. creating an addon of a mod that overrides the result of the event).


== Additional information ==
== Additional information ==