EVENT EGS

From EDukeWiki
Revision as of 18:52, 26 May 2012 by Overkill666 (talk | contribs)
Jump to navigation Jump to search

EVENT_EGS (aka Enter Game Spawn) 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 occurs 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.

This event does not run for sprites present in the map file. For those, try EVENT_SPAWN or EVENT_LOADACTOR.