EVENT EGS: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
One (talk | contribs)
No edit summary
No edit summary
Line 1: Line 1:
EVENT_EGS is a [[EDuke32_event_list|Game Event]].
EVENT_EGS is a [[EDuke32_event_list|Game Event]].


This [[event]] is triggered when any sprite is spawned on the map. [[onevent]] code for this event is executed by the new sprite during the tick in which it is spawned.  The gamevar [[THISACTOR]] refers to the ID of the sprite that is executing the code.
This [[event]] is triggered when any sprite is spawned on the map. Like [[EVENT_GAME]], this event run for all actors, thus the gamevar [[THISACTOR]] refers to the ID of the sprite that is executing the code.
 
This event occur the moment a sprite is spawned.
useractor notenemy ACTOR
  espawn PIGCOP
  ifvarg RETURN -1
    setactor[RETURN].pal 1
enda
onevent EVENT_EGS
  ifactor PIGCOP
    spritepal 2
endevent
In this case, the PIGCOP palette will be 1, because the EVENT_EGS code is triggered before the lines below the [[spawn]] command.


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

Revision as of 19:35, 19 January 2011

EVENT_EGS is a Game Event.

This event is triggered when any sprite is spawned on the map. Like EVENT_GAME, this event run for all actors, thus the gamevar THISACTOR refers to the ID of the sprite that is executing the code.

This event occur the moment a sprite is spawned.

useractor notenemy ACTOR
  espawn PIGCOP
  ifvarg RETURN -1
    setactor[RETURN].pal 1
enda

onevent EVENT_EGS
  ifactor PIGCOP
    spritepal 2
endevent

In this case, the PIGCOP palette will be 1, because the EVENT_EGS code is triggered before the lines below the spawn command.