EVENT VALIDATESTART

From EDukeWiki
Jump to navigation Jump to search
Event ID player# THISACTOR RETURN
EVENT_VALIDATESTART myconnectindex player->i 2 values

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.

Return Values

userdef.return 0 (RETURN)
Stores the episode number of the savegame.
userdef.return 1
Stores the level number of the savegame.

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