Jump to content

EVENT scripts: Difference between revisions

Added documentation for GAMEEVENT_DOMINATION_CONTROL and GAMEEVENT_DOMINATION_POINT.
m (GAMEEVENT_MEDALS now has event handling in 3.2.)
Tag: Source edit
(Added documentation for GAMEEVENT_DOMINATION_CONTROL and GAMEEVENT_DOMINATION_POINT.)
Tag: Source edit
Line 33: Line 33:
;GAMEEVENT_ACTOR_ARMORDAMAGED 12
;GAMEEVENT_ACTOR_ARMORDAMAGED 12
: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
: 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.
;{{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.


== 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.
* '''GAMEEVENT_ACTOR_DAMAGED''' and '''GAMEEVENT_ACTOR_ARMORDAMAGED''': changing the result value affects how much damage the actor actually takes.
*'''GAMEEVENT_ACTOR_DAMAGED''' and '''GAMEEVENT_ACTOR_ARMORDAMAGED''': changing the result value affects how much damage the actor actually takes.
*{{Devfeature|3.2|alpha}} '''GAMEEVENT_MEDALS''': setting the result value to zero prevents the player from receiving the medal that was earned.
*{{Devfeature|3.2|alpha}} '''GAMEEVENT_MEDALS''': setting the result value to zero prevents the player from receiving the medal that was earned.
*{{Devfeature|3.2|alpha}} '''GAMEEVENT_DOMINATION_POINT''': the result value determines how many points a team gets from the point sector. Anything above and including zero is acceptable.


A few things to note are:  
A few things to note are:  
Line 60: Line 65:
*AAPTR_DAMAGE_SOURCE: Accesses the "shooter" responsible for making the attack.
*AAPTR_DAMAGE_SOURCE: Accesses the "shooter" responsible for making the attack.
*AAPTR_DAMAGE_INFLICTOR: Accesses the actor directly responsible for causing damage (e.g. a barrel or projectile).
*AAPTR_DAMAGE_INFLICTOR: Accesses the actor directly responsible for causing damage (e.g. a barrel or projectile).
* AAPTR_DAMAGE_TARGET: Accesses the "victim" taking the damage. By default, this actor is already the activator of the script.
*AAPTR_DAMAGE_TARGET: Accesses the "victim" taking the damage. By default, this actor is already the activator of the script.
You may use these in ACS functions that deal with actor pointers, such as [[zdoom:IsPointerEqual|IsPointerEqual]], [[zdoom:SetActivator|SetActivator]], [[zdoom:SetPointer|SetPointer]], or [[zdoom:Warp|Warp]].
You may use these in ACS functions that deal with actor pointers, such as [[zdoom:IsPointerEqual|IsPointerEqual]], [[zdoom:SetActivator|SetActivator]], [[zdoom:SetPointer|SetPointer]], or [[zdoom:Warp|Warp]].


Line 67: 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: