x2_inc_restsys

Library file for the wandering monster rest system.

Constants

NameValueBrief Description
X2_WM_2DA_NAMEdes_restsystemDefault 2DA Name to look data up.

Can be overwritten with a global variable named X2_WM_2DA_NAME on the module to point to a different 2da.
X2_WM_FLOOD_PROTECTION_PERIOD10.0Minimum time between spawns in seconds.
X2_WM_SPAWNSPOT_EVENTID2011This event is sent to the spawnspot placeable to allow it to play a certain animation when monsters spawn in.
X2_WM_SPAWNSPOT_TAGx2_restsys_spawnIf an object with this tag is found, monsters will spawn from there.

If they cannot find a door or the door system is disabled.
X2_WMT_DEFAULT_FEEDBACK_FAIL83306Default StrRef when failing listen check.
X2_WMT_DEFAULT_FEEDBACK_SUCCESS83307Default StrRef when succeeding listen check.
X2_WMT_INVALID_TABLE0Row number of NO_TABLE_SETTable.

Structures

NameVariablesBrief Description
wm_structstring sTable
string sMonsterNight1
string sMonsterNight2
string sMonsterNight3
string sMonsterDay1
string sMonsterDay2
string sMonsterDay3
int nProbNight1
int nProbNight2
int nProbDay1
int nProbDay2
int nListenCheckDC
int nFeedBackStrRefSuccess
int nFeedBackStrRefFail
int nProbabilityDay
int nProbabilityNight
int nRowNumber

Functions

NameBrief Description
Get2DAStringOrDefaultInternal function. Get a 2da String or the supplied default if string is empty.
GetFirstWMTableEntryInternal function.
GetNextWMTableEntryInternal function. Returns a wm_struct of the row number currently set in LocalInt X2_WM_ROWSCANPTR on the module.
GetWMStructByNameInternal function. Returns a wm_struct of the data in the row with TableName sName in the 2da file.
GetWMTableEntryByIndexInternal function. Returns a FULL Data wm_struct of row nNo from the wandering monster 2da file.
WMBuild2DACacheReads all encounter tables from 2da specified in X2_WM_2DA_NAME and caches them to LocalVariables to speed up access to them.
WMCheckForWanderingMonsterCheck for wandering monster.
WMDebugInternal function. Contains a single, commented out, call to WriteTimestampedLogEntry.
WMDoListenCheckDo a listen check against the designer defined DC for waking up in that area. Returns TRUE if check was successful.
WMGet2DAToUseInternal function. Retrieve the 2da to use for the system.
WMGetAmbushSpotInternal function. Calculates the best ambush spot for the monster's using the area preset values.
WMGetAreaHasTableReturns TRUE if oArea has a wandering monster table set.
WMGetAreaListenCheckReturns the DC to beat in a listen check to wake up.
WMGetAreaMonsterTableInternal function. Returns a wm_struct containing the full wandering monster table for the selected area.
WMGetUseAppearAnimationReturns TRUE if a X2_L_WM_USE_APPEAR_ANIMATIONS has been set to TRUE on the area making all creatures appearing within use their appear animations.
WMGetWanderingMonsterFrom2DAInternal function. Returns a string containing one or more wandering monsters from the encounter table currently active for oPC's area.
WMGetWanderingMonstersDisabledReturns TRUE if oArea has the Wandering Monster System disabled.
WMFinishPlayerRestRemoves the cutscene blackness, etc.
WMMakePartyRestInternal function. Will make the party of the character rest as long as everyone is in the same area.
WMRunAmbushThis command runs the actual wandering monster ambush on the PC, using the data stored by WMSetupAmbush.
WMSetAreaProbabilityChange the probability of encountering a wandering monster for an area.
WMSetAreaTableCall this to define the encounter table to use with the wandering monster system.
WMSetupAmbushSetup the necessary variables for the x2_restsys_ambus script.
WMSetWanderingMonstersDisabledSets if oArea has the Wandering Monster System disabled.
WMSpawnAmbushMonstersInternal function.
WMStartPlayerRestHandles sleep and multiplayer code.


  author: Mistress, contributor: Graewerld