EVENT scripts: Difference between revisions

m
Don't forget to mention the activators of GAMEEVENT_DOMINATION_CONTROL and GAMEEVENT_DOMINATION_POINT.
(Added documentation for GAMEEVENT_DOMINATION_CONTROL and GAMEEVENT_DOMINATION_POINT.)
Tag: Source edit
m (Don't forget to mention the activators of GAMEEVENT_DOMINATION_CONTROL and GAMEEVENT_DOMINATION_POINT.)
Tag: Source edit
Line 34: Line 34:
: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.
;{{Devfeature|3.2|alpha}} GAMEEVENT_DOMINATION_CONTROL 13
;{{Devfeature|3.2|alpha}} GAMEEVENT_DOMINATION_CONTROL 13
: When a player takes control of a point sector in [[Game Modes#Domination|Domination]]. <tt>arg1</tt> is the team index that previously owned the sector (this is always 255 if no team occupied it before), and <tt>arg2</tt> is a dynamic ACS string containing the name of the sector that was captured.
: When a player takes control of a point sector in [[Game Modes#Domination|Domination]]. The activator is the player who took control of the point sector, <tt>arg1</tt> is the team index that previously owned the sector (this is always 255 if no team occupied it before), and <tt>arg2</tt> is a dynamic ACS string containing the name of the sector that was captured.
;{{Devfeature|3.2|alpha}} GAMEEVENT_DOMINATION_POINT 14
;{{Devfeature|3.2|alpha}} GAMEEVENT_DOMINATION_POINT 14
:When a team gets a point for controlling point sector in [[Game Modes#Domination|Domination]]. <tt>arg1</tt> is the team index that occupies the sector, and <tt>arg2</tt> is a dynamic ACS string containing the name of the sector.
:When a team gets a point for controlling point sector in [[Game Modes#Domination|Domination]]. The activator is always the world, <tt>arg1</tt> is the team index that occupies the sector, and <tt>arg2</tt> is a dynamic ACS string containing the name of the sector.


==Event handling==
== Event handling==
You are allowed to modify the results of some events by changing the result value of the EVENT script itself via {{zdoomwiki|SetResultValue}}. The event types that current support this are:  
You are allowed to modify the results of some events by changing the result value of the EVENT script itself via {{zdoomwiki|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_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.
Line 48: Line 48:


*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.
*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.
* 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).
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).
Line 72: Line 72:
[[Category:Level Development]]
[[Category:Level Development]]


==Examples==
==Examples ==


Let's say we want to use '''GAMEEVENT_ACTOR_SPAWNED''' and '''GAMEEVENT_ACTOR_DAMAGED''' for our mod. For the sake of simplicity, we want the events to be triggered by all actors, so we'll create a <tt>MAPINFO</tt> lump in our WAD file and add the following:
Let's say we want to use '''GAMEEVENT_ACTOR_SPAWNED''' and '''GAMEEVENT_ACTOR_DAMAGED''' for our mod. For the sake of simplicity, we want the events to be triggered by all actors, so we'll create a <tt>MAPINFO</tt> lump in our WAD file and add the following: