HorseReloadFromDatabase

From NWN Lexicon
Jump to: navigation, search

HorseReloadFromDatabase(object, string)

Reload horse system from database.

Parameters

oPC

The PC whose horses are to be reloaded.

sDatabase

The data base name.


Description

This function is provided for use with an OnClientEnter script when you are using a persistent world type environment and need the PC's mounted state reloaded.

It will also make sure that henchmen for the PC are also restored as they were.



Requirements

#include " x3_inc_horse "

Version

1.69

Example

// A simple OnClientEnter script.
// Refer to x3_mod_def_enter for the standard code.
// The delay required on the data base load may vary by PW.
#include "x3_inc_horse"
 
 
void main()
{
    object oPC = GetEnteringObject();
 
    if((GetIsPC(oPC) || GetIsDM(oPC)) && !GetHasFeat(FEAT_HORSE_MENU, oPC))
    { 
        // add horse menu 
        HorseAddHorseMenu(oPC);
        if(GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB"))
        { 
           // restore PC horse status from database
           DelayCommand(5.0, HorseReloadFromDatabase(oPC, X3_HORSE_DATABASE));
        } 
    } 
}

See Also

functions: 

HorseSaveToDatabase



author: Proleric, editor: Mistress