EVENT GAME: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
EVENT_GAME is an [[event]] that is triggered once per tic per sprite in the game.  The gamevar [[THISACTOR]] refers to the ID of the actor executing the code.  Thus, it takes the value of each actor in the game.
{{EventTable|1=EVENT_GAME|2=closest player to sprite|3=current sprite|4=0 values}}
EVENT_GAME is a [[EDuke32_event_list|Game Event]].


Very usefull, you can instead of modding original CON files, use <i>ifactor MYACTOR</i> to edit actors or <i>ifactor APLAYER</i> for add codes as if was added on APLAYER code without editing GAME.CON.
This [[event]] is triggered once per tic per sprite in the game, if and only if said sprite does not have [[spriteflags|SFLAG_NOEVENTS]] set. The gamevar [[THISACTOR]] is the current spriteNum, while the current player is the closest player to said sprite.


Most important, can edit hard-coded actor without breaking it using the <i>[[actor]] MYENEMY</i> code.
This event occurs after [[EVENT_PREGAME]], and after [[EVENT_WORLD]]. Furthermore, it occurs after all engine code pertaining to sprites and actors, such as <code>MoveActors()</code>, <code>MovePlayers()</code>,<code>MoveFallers()</code> etc. has executed. The event also occurs after all CON code defined using [[actor]] or [[useractor]], while [[EVENT_PREGAME]] is processed before.  
onevent EVENT_GAME
Therefore, EVENT_GAME can be used to override these effects.
  ifactor RECON
 
    ifai 0
Unlike [[actor]] or [[useractor]], EVENT_GAME and EVENT_PREGAME are triggered the same tic the sprite is loaded/spawned, but are processed after [[EVENT_LOADACTOR]] or [[EVENT_EGS]].
      strength 50
  ifactor RPG
    ifspawnedby BOSS2
      spawn SMALLSMOKE
endevent
This will change RECON strength and adding a trail to the RPG that Cycloid Emperor shoots.


[[Category:Events]]
[[Category:Events]]

Latest revision as of 00:08, 5 February 2022

Event ID player# THISACTOR RETURN
EVENT_GAME closest player to sprite current sprite 0 values

EVENT_GAME is a Game Event.

This event is triggered once per tic per sprite in the game, if and only if said sprite does not have SFLAG_NOEVENTS set. The gamevar THISACTOR is the current spriteNum, while the current player is the closest player to said sprite.

This event occurs after EVENT_PREGAME, and after EVENT_WORLD. Furthermore, it occurs after all engine code pertaining to sprites and actors, such as MoveActors(), MovePlayers(),MoveFallers() etc. has executed. The event also occurs after all CON code defined using actor or useractor, while EVENT_PREGAME is processed before. Therefore, EVENT_GAME can be used to override these effects.

Unlike actor or useractor, EVENT_GAME and EVENT_PREGAME are triggered the same tic the sprite is loaded/spawned, but are processed after EVENT_LOADACTOR or EVENT_EGS.