EVENT VALIDATESTART

From EDukeWiki
Revision as of 14:25, 23 February 2020 by Doom64hunter (talk | contribs) (Added documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

EVENT_VALIDATESTART is a Misc Event.

This event is executed on loading a savegame in Ion Fury that is incompatible with the currently running version.

When running Ion Fury, eduke32 allows the player to load outdated savegames (e.g. running different CON scripts) on the condition that the corresponding map is available. If this is the case, it will indicate that a "sequence point" is available, and when selecting the outdated save, the game starts the player at the beginning of the map, resetting all progress for that level. Player inventory is however preserved. Usually, the player simply restarts on the map on which the outdated save was made, however, since certain maps allow seamless back-and-forth transitions, it becomes possible for the player to start inbetween. Not only does this lead to all monsters on both maps respawning, but it can also lead to softlocks if backtracking is required.

To prevent these situations, EVENT_VALIDATESTART allows the savegame volume and level number to be changed when an outdated save is loaded. 'userdef.return 0' stores the savegame volume, and 'userdef.return 1' stores the savegame level. You can set these values to the desired restart map for sequence point loads, see the example below.

Since the sequence point system is currently not used for the other GRPs, this event is thus mainly useful for custom Ion Fury maps that include seamless map transitions.

Example

This example is taken from Ion Fury's preview episode. Level 1 is reached from a seamless transition over a vent, hence the level is set back to 0 for invalidated save loads, to prevent the player from starting inbetween transitions.

// Code by Jonathan Strander, Fox Martins, Richard Gobeille, and Evan Ramos
// All code as written belongs to Voidpoint and the respective authors.
// (c) 2019 Voidpoint, LLC
appendevent EVENT_VALIDATESTART
   ife userdef .return 0 EP_PREVIEW
   {
       switch userdef .return 1
           case 1 // 2
               setu .return 1 0 // 1
               break
           case 3 // 4
           case 4 // 5
               setu .return 1 2 // 3
               break
       endswitch
   }
endevent