EVENT scripts: Difference between revisions
Renamed GAMEEVENT_ACTOR_ARMORDAMAGED to GAMEEVENT_ACTOR_DAMAGED_PREMOD.
(Added documentation for GAMEEVENT_JOINQUEUECHANGED.) Tag: Source edit |
(Renamed GAMEEVENT_ACTOR_ARMORDAMAGED to GAMEEVENT_ACTOR_DAMAGED_PREMOD.) Tag: Source edit |
||
Line 31: | Line 31: | ||
;GAMEEVENT_ACTOR_DAMAGED 11 | ;GAMEEVENT_ACTOR_DAMAGED 11 | ||
:When an actor is just about to take damage, after all damage modifications are applied. The activator is the actor taking damage, <tt>arg1</tt> is the amount of damage received, and <tt>arg2</tt> is a dynamic ACS string containing the damage type. | :When an actor is just about to take damage, after all damage modifications are applied. The activator is the actor taking damage, <tt>arg1</tt> is the amount of damage received, and <tt>arg2</tt> is a dynamic ACS string containing the damage type. | ||
; | ;GAMEEVENT_ACTOR_DAMAGED_PREMOD 12 | ||
:Behaves exactly like GAMEEVENT_ACTOR_DAMAGED but is triggered slightly earlier, just before an actor's | :Behaves exactly like GAMEEVENT_ACTOR_DAMAGED but is triggered slightly earlier, just before an actor's armour or inventory items can absorb any damage. This was previously known as GAMEEVENT_ACTOR_ARMORDAMAGED. | ||
;{{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]]. 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. | : 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. | ||
Line 47: | Line 47: | ||
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_DAMAGED''' and '''GAMEEVENT_ACTOR_DAMAGED_PREMOD''': 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. | *{{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. | ||
Line 61: | Line 61: | ||
==Additional information== | ==Additional information== | ||
Due to risks of performance drops, '''GAMEEVENT_ACTOR_SPAWNED''', '''GAMEEVENT_ACTOR_DAMAGED''', and ''' | Due to risks of performance drops, '''GAMEEVENT_ACTOR_SPAWNED''', '''GAMEEVENT_ACTOR_DAMAGED''', and '''GAMEEVENT_ACTOR_DAMAGED_PREMOD''' are disabled by default. There are two methods for enabling these event types: | ||
*'''Method A''': Add the properties <tt>ForceSpawnEventScripts</tt> or <tt>ForceDamageEventScripts</tt> in the [[zdoom:GameInfo_definition|GameInfo Definition]]. This helps if you want all actors to execute these events. Note that using this method in the case of '''GAMEEVENT_ACTOR_SPAWNED''', actors with the <tt>NOBLOCKMAP</tt> (actors with <tt>ISMISSILE</tt> will still execute the event) or <tt>NOSECTOR</tt> flags still won't execute the event. This way, only the non-trivial actors are accounted for. | *'''Method A''': Add the properties <tt>ForceSpawnEventScripts</tt> or <tt>ForceDamageEventScripts</tt> in the [[zdoom:GameInfo_definition|GameInfo Definition]]. This helps if you want all actors to execute these events. Note that using this method in the case of '''GAMEEVENT_ACTOR_SPAWNED''', actors with the <tt>NOBLOCKMAP</tt> (actors with <tt>ISMISSILE</tt> will still execute the event) or <tt>NOSECTOR</tt> flags still won't execute the event. This way, only the non-trivial actors are accounted for. | ||
*'''Method B''': Add the <tt>USESPAWNEVENTSCRIPT</tt> or <tt>USEDAMAGEEVENTSCRIPT</tt> flags to the actor that you wish have execute the events. These are useful if you only want certain actors to trigger the events and not all of them, which can optimize your mod better. | *'''Method B''': Add the <tt>USESPAWNEVENTSCRIPT</tt> or <tt>USEDAMAGEEVENTSCRIPT</tt> flags to the actor that you wish have execute the events. These are useful if you only want certain actors to trigger the events and not all of them, which can optimize your mod better. | ||
Line 68: | Line 68: | ||
In addition, '''GAMEEVENT_ACTOR_DAMAGED''' and ''' | In addition, '''GAMEEVENT_ACTOR_DAMAGED''' and '''GAMEEVENT_ACTOR_DAMAGED_PREMOD''' enable special actor pointers that give you access to the actors involved in the <tt>P_DamageMobj</tt> call: | ||
*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). |