Osrs inc
From NWNWiki
osrs_inc is an include script used by OSRS.
/////////////////////////////////////////////////////////////////////////////
//
// script:
// osrs_inc
//
// purpose:
// This script is an Include script for the Open Source Rule Set.
// This script is for use by OSRS only. End user developers edits to this
// file will be overwritten in future versions of OSRS.
// This script contains one function call for each of valid object events.
// http://nwn2wiki.org/osrs/ has more info and charts.
// You can rely on this script changing every upgrade, as
// All OSRS scripting redirects all event calls into function calls,
// These function calls are distributed between 2 files, osrs_inc and
// osrs_inc_user.
// All of OSRSS functions live in these two files.
// This file contains content that is "owned" by OSRS and should not be
// modified by the end-using module designer; instead, the User should
// place hiss cripting in the osrs_inc_user file, which is "owned" by
// the end-using developers only .
//
/////////////////////////////////////////////////////////////////////////////
// The feature flags store datatype-specific variable names based upon the
// recognized OSRS static strings. Toggle them TRUE or FALSE to turn that
// particular feature ON or OFF.
/////////////////////////////////////////////////////////////////////////////
// Total Event Control, mandatory.
// This module feature hooks into every incoming event into an OSRS script.
// It translates all end-user module scripting interaction in events,
// into function calls prototyped in one script, osrs_inc_user.
// osrs_inc gets the same respect from the modular side.
// and Capturing all script execution
// in the module guarantees total control over all the scripting activity in
// the module, except for conversation scripts (which is not mandatory).
//const string S_OSRS_USE_TOTAL_EVENT_CONTROL = "S_OSRS_USE_TOTAL_EVENT_CONTROL";
/////////////////////////////////////////////////////////////////////////////
// Feature Management, mandatory.
// This module feature will manage optional features through the
// use of toggle flags. This OSRS release feature is mandatory.
// All OSRS variables are specific to the module, and are stored on the module
// through GetLocalXXX() and SetLocalXXX().
//const string S_OSRS_USE_FEATURE_MANAGEMENT = "S_OSRS_USE_FEATURE_MANAGEMENT";
/////////////////////////////////////////////////////////////////////////////
// Event Partitioning splits every event handled into three separate phases of
// an event, allowing the User to determine whether you want your code to fire
// before the main event or after it, or during it. This OSRS release feature
// is mandatory.
//const string S_OSRS_USE_EVENT_PARTITIONING = "S_OSRS_USE_EVENT_PARTITIONING";
/////////////////////////////////////////////////////////////////////////////
// Use creature scripts toggles original nw_* scripts on/off.
const string S_OSRS_USE_X0_CREATURE_SCRIPTS = "S_OSRS_USE_X0_CREATURE_SCRIPTS";
/////////////////////////////////////////////////////////////////////////////
//
const string S_OSRS_USE_NWN_X0_CREATURE_SCRIPTS =
"S_OSRS_USE_NWN_X0_CREATURE_SCRIPTS"
;
// X0 means basic game, no expansions
/////////////////////////////////////////////////////////////////////////////
// Use the creature script set that came with Hordes of the Underdark
const string S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS =
"S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS"
;
/////////////////////////////////////////////////////////////////////////////
// Use the Door Death scripts particular to Hordes of the Underdark
const string S_OSRS_USE_X2_DOOR_DEATH = "S_OSRS_USE_X2_DOOR_DEATH";
/////////////////////////////////////////////////////////////////////////////
// Realistic Torches toggles advanced lighting system on/off.
const string S_OSRS_USE_REALISTIC_TORCHES = "S_OSRS_USE_REALISTIC_TORCHES";
/////////////////////////////////////////////////////////////////////////////
// Used in GetLocalInt() and SetLocalInt() calls so that identification of an
// object only occurs during the first call to osrs_GetCallerEventClass()
const string S_CALLER_EVENT_CLASS = "S_CALLER_EVENT_CLASS";
/////////////////////////////////////////////////////////////////////////////
// the variable name for the OSRS feature to implement X2 On Open Store event
// script calling functionality.
const string S_OSRS_FEATURE_X2EXP = "B_OSRS_FEATURE_X2EXP";
/////////////////////////////////////////////////////////////////////////////
// Feature upgrade: stilltodo
// Make all OSRS variables be persistent using a persistence layer like
// VRM does: Bioware database.
/////////////////////////////////////////////////////////////////////////////
// the include file for user events
// ALL USER SUPPLIED FUNCTIONS COME FROM #INCLUDE LINKS THE USER SPECIFIES
// Feature Variable Flags (toggles) are defined here but set by the User
#include "osrs_inc_user"
// the signatures of the creators
#include "osrs_signatures"
/////////////////////////////////////////////////////////////////////////////
// This set of variables represent the static values determining
// oCaller's object class. I_OSRS_EVENT_CLASS_DEFAULT is used ONLY
// to represent the default value that comes back from a GetLocalInt()
// call upon an object that has not yet been initialized.
const int I_OSRS_EVENT_CLASS_UNKNOWN = -2;
const int I_OSRS_EVENT_CLASS_ERROR = -1;
const int I_OSRS_EVENT_CLASS_DEFAULT = 0;
const int I_OSRS_EVENT_CLASS_AREA = 1;
const int I_OSRS_EVENT_CLASS_CREATURE = 2;
const int I_OSRS_EVENT_CLASS_DOOR = 3;
const int I_OSRS_EVENT_CLASS_ENCOUNTER = 4;
const int I_OSRS_EVENT_CLASS_MERCHANT = 5;
const int I_OSRS_EVENT_CLASS_MODULE = 6;
const int I_OSRS_EVENT_CLASS_PLACEABLE = 7;
const int I_OSRS_EVENT_CLASS_TRAP = 8;
const int I_OSRS_EVENT_CLASS_TRIGGER = 9;
///////////////////////////////////////////////////////////////////////////////
// This function returns a number indicating a Event Object class of the oCaller
int osrs_GetCallerEventClass(object oCaller);
int osrs_GetCallerEventClass(object oCaller)
{
/*
Cut-N-Paste area code block: USE THIS CODE BLOCK WHERE YOU NEED TO
DETERMINE HOW THE CALLER SHOULD INTERPRET THE VALUES.
// determine what type of object is calling this script
int iCallingClass = osrs_GetCallerEventClass(OBJECT_SELF);
switch(iCallingClass)
{
case I_OSRS_EVENT_CLASS_UNKNOWN:
case I_OSRS_EVENT_CLASS_ERROR:
case I_OSRS_EVENT_CLASS_DEFAULT:
return;
case I_OSRS_EVENT_CLASS_AREA:
case I_OSRS_EVENT_CLASS_CREATURE:
case I_OSRS_EVENT_CLASS_ENCOUNTER:
case I_OSRS_EVENT_CLASS_MERCHANT:
case I_OSRS_EVENT_CLASS_MODULE:
case I_OSRS_EVENT_CLASS_TRAP:
case I_OSRS_EVENT_CLASS_TRIGGER:
case I_OSRS_EVENT_CLASS_DOOR:
case I_OSRS_EVENT_CLASS_PLACEABLE:
default:
return;
}
*/
// Intended Use:
// Call this function with OBJECT_SELF as the argument to determine what
// type of object is the oCaller is. With this information you can
// determine which appropriate object script to run.
// If the caller calls this function with an object that cannot
// "own" such an event, then it returns an error.
// For example, if the scripter passes as an argument an item object.
// This function discriminates which scripts will be called.
// Instead of having 76 different scripts (one for every event-X-class valid
// combination) to code and maintain,
// By discriminating by the object type, we can limit it to just 42.
// Each event type determines the object class that is running the script.
// This also allows us to use a common concept of OnHeartbeat, because you
// might have had many such scripts before, but with OSRS you get only one
// event, and it determines the appropriate object event involved.
// OSRS optimized speed concerns by standardizing it's use by using the
// Bioware Local Variable system , this function to use Bioware's local
// variable system.
// If the object has already been identified in some previous call (which
// would be normal for an OnHeartbeat event), then the local variable provides
// a quick and stable (time delay) solution, so
// that after the object calling this script has been identified once,
// subsequent calls for identification will instead reference and utilize the
// local variable that has been set upon it's object.
// validate parameter first before referencing it's attributes
if (!GetIsObjectValid(oCaller))
return I_OSRS_EVENT_CLASS_ERROR;
// check to see if this Object has been identified earlier.
int iPreExistingIdentification = GetLocalInt(oCaller, S_CALLER_EVENT_CLASS);
if (iPreExistingIdentification != I_OSRS_EVENT_CLASS_DEFAULT)
return iPreExistingIdentification;
// otherwise, the specific class for this object has not yet been determined.
// CLASSES LEFT TO CHECK:
// AREA, CREATURE, ENCOUNTER, MERCHANT, MODULE, TRAP, TRIGGER, DOOR, PLACEABLE,
// UNKNOWN
// what type of object is this?
int iCallerObjectType = GetObjectType(oCaller);
switch(iCallerObjectType)
{
// creature (PC, animal, monster etc).
case OBJECT_TYPE_CREATURE: // Specifies the object is a
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_CREATURE);
return I_OSRS_EVENT_CLASS_CREATURE;
case OBJECT_TYPE_ENCOUNTER: // Should specify an object which is an encounter
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_ENCOUNTER);
return I_OSRS_EVENT_CLASS_ENCOUNTER;
case OBJECT_TYPE_TRIGGER: // Specifies the object is a trigger.
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_TRIGGER);
return I_OSRS_EVENT_CLASS_TRIGGER;
case OBJECT_TYPE_PLACEABLE: // Specifies the object is a placeable.
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_PLACEABLE);
return I_OSRS_EVENT_CLASS_PLACEABLE;
case OBJECT_TYPE_DOOR: // Specifies the object is a door.
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_DOOR);
return I_OSRS_EVENT_CLASS_DOOR;
case OBJECT_TYPE_STORE: // Specifies the object is a store.
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_MERCHANT);
return I_OSRS_EVENT_CLASS_MERCHANT;
// OBJECT_TYPE_INVALID and OBJECT_TYPE_ALL equal the same value.
// case OBJECT_TYPE_ALL: // Specifies all objects. Used for
// unrestricted searches. Strangely, OBJECT_TYPE_ALL and
// OBJECT_TYPE_INVALID equal the same value.
case OBJECT_TYPE_INVALID: // Specifies the object is invalid.
//OBJECT_TYPE_INVALID has an integer value of 32,767.
case OBJECT_TYPE_AREA_OF_EFFECT:
case OBJECT_TYPE_ITEM:
case OBJECT_TYPE_WAYPOINT:
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_ERROR);
return I_OSRS_EVENT_CLASS_ERROR;
default:
break;
}
// CLASSES LEFT TO CHECK:
// MODULE, AREA, TRAP, UNKNOWN
// Is it the module?
if (oCaller == GetModule())
{
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_MODULE);
return I_OSRS_EVENT_CLASS_MODULE;
}
// CLASSES LEFT TO CHECK:
// AREA, TRAP, UNKNOWN
// is it an area?
if (GetIsAreaAboveGround(oCaller) != AREA_INVALID)
{
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_AREA);
return I_OSRS_EVENT_CLASS_AREA;
}
// CLASSES LEFT TO CHECK:
// TRAP, UNKNOWN
// traps have a base type
int iTrapBaseType = GetTrapBaseType(oCaller);
switch (iTrapBaseType)
{
case TRAP_BASE_TYPE_AVERAGE_ACID:
case TRAP_BASE_TYPE_AVERAGE_ACID_SPLASH:
case TRAP_BASE_TYPE_AVERAGE_ELECTRICAL:
case TRAP_BASE_TYPE_AVERAGE_FIRE:
case TRAP_BASE_TYPE_AVERAGE_FROST:
case TRAP_BASE_TYPE_AVERAGE_GAS:
case TRAP_BASE_TYPE_AVERAGE_HOLY:
case TRAP_BASE_TYPE_AVERAGE_NEGATIVE:
case TRAP_BASE_TYPE_AVERAGE_SONIC:
case TRAP_BASE_TYPE_AVERAGE_SPIKE:
case TRAP_BASE_TYPE_AVERAGE_TANGLE:
case TRAP_BASE_TYPE_DEADLY_ACID:
case TRAP_BASE_TYPE_DEADLY_ACID_SPLASH:
case TRAP_BASE_TYPE_DEADLY_ELECTRICAL:
case TRAP_BASE_TYPE_DEADLY_FIRE:
case TRAP_BASE_TYPE_DEADLY_FROST:
case TRAP_BASE_TYPE_DEADLY_GAS:
case TRAP_BASE_TYPE_DEADLY_HOLY:
case TRAP_BASE_TYPE_DEADLY_NEGATIVE:
case TRAP_BASE_TYPE_DEADLY_SONIC:
case TRAP_BASE_TYPE_DEADLY_SPIKE:
case TRAP_BASE_TYPE_DEADLY_TANGLE:
case TRAP_BASE_TYPE_EPIC_ELECTRICAL:
case TRAP_BASE_TYPE_EPIC_FIRE:
case TRAP_BASE_TYPE_EPIC_FROST:
case TRAP_BASE_TYPE_EPIC_SONIC:
case TRAP_BASE_TYPE_MINOR_ACID:
case TRAP_BASE_TYPE_MINOR_ACID_SPLASH:
case TRAP_BASE_TYPE_MINOR_ELECTRICAL:
case TRAP_BASE_TYPE_MINOR_FIRE:
case TRAP_BASE_TYPE_MINOR_FROST:
case TRAP_BASE_TYPE_MINOR_GAS:
case TRAP_BASE_TYPE_MINOR_HOLY:
case TRAP_BASE_TYPE_MINOR_NEGATIVE:
case TRAP_BASE_TYPE_MINOR_SONIC:
case TRAP_BASE_TYPE_MINOR_SPIKE:
case TRAP_BASE_TYPE_MINOR_TANGLE:
case TRAP_BASE_TYPE_STRONG_ACID:
case TRAP_BASE_TYPE_STRONG_ACID_SPLASH:
case TRAP_BASE_TYPE_STRONG_ELECTRICAL:
case TRAP_BASE_TYPE_STRONG_FIRE:
case TRAP_BASE_TYPE_STRONG_FROST:
case TRAP_BASE_TYPE_STRONG_GAS:
case TRAP_BASE_TYPE_STRONG_HOLY:
case TRAP_BASE_TYPE_STRONG_NEGATIVE:
case TRAP_BASE_TYPE_STRONG_SONIC:
case TRAP_BASE_TYPE_STRONG_SPIKE:
case TRAP_BASE_TYPE_STRONG_TANGLE:
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_TRAP);
return I_OSRS_EVENT_CLASS_TRAP;
// if it is not one of these base trap types then it is NOT a trap
default:
// this function does not _appear_ to return INVALID if it is called
// upon a non-trap object, therefore I do not know what the result
// will be when the argument is definitely not a trap! Here I log
// this to the Log File so we can revise the code with the
// appropriate value and complete this section.
WriteTimestampedLogEntry("OSRS_inc::OSRS_GetClass(): "+
"GetTrapBaseType() returned unknown value '"+
IntToString(iTrapBaseType)+"'."
);
break;
}
// CLASSES LEFT TO CHECK:
// UNKNOWN
// Therefore, anything else that calls this script, we are either unable
// to determine, or does not apply for the purposes of this function,
// which is to identify the type of object (a class) that can own and
// respond to events.
SetLocalInt(oCaller, S_CALLER_EVENT_CLASS, I_OSRS_EVENT_CLASS_ERROR);
return I_OSRS_EVENT_CLASS_ERROR;
}
/////////////////////////////////////////////////////////////////////////////
// This function writes to the running module, the values of the module default
// values that the User established in the file "osrs_inc_user" here.
// User! set the flags to TRUE or FALSE to enable or disable that feature.
// Each feature may have separate settings that are required to be set
// elsewhere.
// returns TRUE if succeeded, otherwise FALSE
int osrs_user_SetDefaults();
int osrs_user_SetDefaults()
{
// get handle to module
object oModule = GetModule();
if (!GetIsObjectValid(oModule))
{
WriteTimestampedLogEntry("osrs_inc_user: Error: GetModule returned Invalid Object!");
return FALSE;
}
// FEATURE: total event control
// You can't turn this feature off.
// FEATURE: Event Partitioning:
// You can't turn this feature off.
// FEATURE: feature management:
// You can't turn this feature off.
//const string S_OSRS_USE_X0_CREATURE_SCRIPTS = "S_OSRS_USE_X0_CREATURE_SCRIPTS";
//const string S_OSRS_USE_NWN_X0_CREATURE_SCRIPTS = "S_OSRS_USE_NWN_X0_CREATURE_SCRIPTS"; // X0 means basic game, no expansions
//const string S_OSRS_USE_X2_DOOR_DEATH = "S_OSRS_USE_X2_DOOR_DEATH";
//const string S_OSRS_USE_REALISTIC_TORCHES = "S_OSRS_USE_REALISTIC_TORCHES";
// FEATURE: NWN X2 creature scripts
SetLocalInt(oModule, S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS, I_OSRS_FEATURE_X2_CREATURE_SCRIPTS);
// FEATURE: NWN basic creature scripts.
// This value is ignored if NWN X2 creature scripts flag is TRUE.
SetLocalInt(oModule, S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS, I_OSRS_FEATURE_X0_CREATURE_SCRIPTS);
// FEATURE: NWN X2 DOOR SCRIPTS
SetLocalInt(oModule, S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS, I_OSRS_FEATURE_X2_DOOR_SCRIPTS);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Set the feature flags that the module designers desire.
// The User sets the flags in the script osrs_inc_user.
// The module reads them and sets them in the OnModuleLoad event
void osrs_SetFlags();
void osrs_SetFlags()
{
// Establish User features by setting his values
osrs_user_SetDefaults();
}
/////////////////////////////////////////////////////////////////////////////
// AREA
/////////////////////////////////////////////////////////////////////////////
// Area::OnUserDefined event
int osrs_a_oud();
int osrs_a_oud()
{
return 1;
}
// Area::OnHeartbeat event
int osrs_a_oh();
int osrs_a_oh()
{
return 1;
}
// Area::OnExit event
int osrs_a_oexi();
int osrs_a_oexi()
{
return 1;
}
// Area::OnEnter event
int osrs_a_oent();
int osrs_a_oent()
{
return 1;
}
/////////////////////////////////////////////////////////////////////////////
// CREATURE
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Creature::OnSpellCastAt event
int osrs_c_osca();
int osrs_c_osca()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_spellcast", OBJECT_SELF);
}
// USE basic NWN creature scripting?
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_defaultb", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnUserDefined event
int osrs_c_oud();
int osrs_c_oud()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_userdef", OBJECT_SELF);
}
// USE basic NWN creature scripting> x0 creature scripts?
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_defaultd", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnHeartbeat event
int osrs_c_oh();
int osrs_c_oh()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_heartbeat", OBJECT_SELF);
}
// USE basic NWN creature scripting?
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default1", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnDamaged event
int osrs_c_oda();
int osrs_c_oda()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_ondamage", OBJECT_SELF);
}
// USE basic NWN creature scripting: x0 creature scripts?
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default6", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnDeath event
int osrs_c_ode();
int osrs_c_ode()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_ondeath", OBJECT_SELF);
}
// USE basic NWN creature scripting: x0 creature scripts?
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default7", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnPhysicalAttacked event
int osrs_c_opa();
int osrs_c_opa()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_attacked", OBJECT_SELF);
}
// USE basic NWN creature scripting: x0 creature scripts?
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default5", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnDisturbed event
int osrs_c_odist();
int osrs_c_odist()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_ondisturb", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default8", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnPerception event
int osrs_c_op();
int osrs_c_op()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_percept", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default2", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnBlocked event
int osrs_c_ob();
int osrs_c_ob()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_onblocked", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_defaulte", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnConversation event
int osrs_c_ocon();
int osrs_c_ocon()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_onconv", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default4", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnCombatRoundEnd event
int osrs_c_ocre();
int osrs_c_ocre()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_endcombat", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default3", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnSpawn event
int osrs_c_os();
int osrs_c_os()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_spawn", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_default9", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Creature::OnRested event
int osrs_c_or();
int osrs_c_or()
{
// USE NWN X2 creature scripting?
if (GetLocalInt(GetModule(), S_OSRS_USE_NWN_X2_CREATURE_SCRIPTS))
{
ExecuteScript( "x2_def_rested", OBJECT_SELF);
}
// USE basic NWN creature scripting
// stilltodo: replace strings with local defn var consts
else if (GetLocalInt(GetModule(), S_OSRS_USE_X0_CREATURE_SCRIPTS))
{
ExecuteScript( "nw_c2_defaulta", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// DOOR
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Door::OnDeath event
int osrs_d_ode();
int osrs_d_ode()
{
// USE basic NWN creature scripting: x2 door death scripts?
if (GetLocalInt(GetModule(), S_OSRS_USE_X2_DOOR_DEATH))
{
ExecuteScript( "x2_door_death", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnOpen event
int osrs_d_oo();
int osrs_d_oo()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnLock event
int osrs_d_ol();
int osrs_d_ol()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnAreaTransitionsClickedevent
int osrs_d_oatc();
int osrs_d_oatc()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnFailToOpen event
int osrs_d_ofto();
int osrs_d_ofto()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnUnLock event
int osrs_d_oul();
int osrs_d_oul()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnClosed event
int osrs_d_oclo();
int osrs_d_oclo()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnPhysicalAttacked event
int osrs_d_opa();
int osrs_d_opa()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnDamaged event
int osrs_d_oda();
int osrs_d_oda()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnHeartbeat event
int osrs_d_oh();
int osrs_d_oh()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnUserDefined event
int osrs_d_oud();
int osrs_d_oud()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Door::OnSpellCastAt event
int osrs_d_osca();
int osrs_d_osca()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// ENCOUNTER
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Encounter::OnEnter event
int osrs_e_oexh();
int osrs_e_oexh()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Encounter::OnUserDefined event
int osrs_e_oud();
int osrs_e_oud()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Encounter::OnEnter event
int osrs_e_oent();
int osrs_e_oent()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Encounter::OnExit event
int osrs_e_oexi();
int osrs_e_oexi()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Encounter::OnHeartbeat event
int osrs_e_oh();
int osrs_e_oh()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// MERCHANT
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Merchant::OnOpenStore event
int osrs_me_oos();
int osrs_me_oos()
{
// User wants start store script? Did the User turn this flag ON in
// his osrs_inc_user module onload event script?
if (GetLocalInt(GetModule(), S_OSRS_FEATURE_X2EXP))
{
// This script was in the default merchant I dropped. It might be
// from X2 expansion only.
ExecuteScript("nw_d1_startstore", OBJECT_SELF);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Merchant::OnStoreClosed event
int osrs_me_osc();
int osrs_me_osc()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// MODULE
/////////////////////////////////////////////////////////////////////////////
// Module::OnModuleLoad event
int osrs_mo_oml();
int osrs_mo_oml()
{
// Read and set the module flags
osrs_SetFlags();
// Turn OFF the flag to use XP2 expansion pack.
SetLocalInt( GetModule(), "B_OSRS_FEATURE_X2EXP", FALSE);
return TRUE;
}
// Module::OnUserDefined event
int osrs_mo_oud();
int osrs_mo_oud()
{
return TRUE;
}
// Module::OnHeartbeat Pre-event
int osrs_mo_oh();
int osrs_mo_oh()
{
return TRUE;
}
// Module::OnUnAcquireItem event
int osrs_mo_ouai();
int osrs_mo_ouai()
{
return TRUE;
}
// Module::OnAcquireItem event
int osrs_mo_oacqi();
int osrs_mo_oacqi()
{
return TRUE;
}
// Module::OnActivateItem event
int osrs_mo_oacti();
int osrs_mo_oacti()
{
return TRUE;
}
// Module::OnCutSceneAbort event
int osrs_mo_ocsa();
int osrs_mo_ocsa()
{
return TRUE;
}
// Module::OnClientEnter event
int osrs_mo_oce();
int osrs_mo_oce()
{
return TRUE;
}
// Module::OnClientLeave event
int osrs_mo_ocl();
int osrs_mo_ocl()
{
return TRUE;
}
// Module::OnPlayerUnEquipItem event
int osrs_mo_opuei();
int osrs_mo_opuei()
{
return TRUE;
}
// Module::OnPlayerDeath event
int osrs_mo_opde();
int osrs_mo_opde()
{
return TRUE;
}
// Module::OnPlayerDying event
int osrs_mo_opdy();
int osrs_mo_opdy()
{
return TRUE;
}
// Module::OnPlayerEquipItem event
int osrs_mo_opei();
int osrs_mo_opei()
{
return TRUE;
}
// Module::OnPlayerLevelUp event
int osrs_mo_oplu();
int osrs_mo_oplu()
{
return TRUE;
}
// Module::OnPlayerRespawn event
int osrs_mo_opresp();
int osrs_mo_opresp()
{
return TRUE;
}
// Module::OnPlayerRest event
int osrs_mo_oprest();
int osrs_mo_oprest()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// PLACEABLE
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnClosed event
int osrs_p_oclo();
int osrs_p_oclo()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnDisturbed event
int osrs_p_odist();
int osrs_p_odist()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnUnLock event
int osrs_p_oul();
int osrs_p_oul()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnUsed event
int osrs_p_ou();
int osrs_p_ou()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnOpen event
int osrs_p_oo();
int osrs_p_oo()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnLock event
int osrs_p_ol();
int osrs_p_ol()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnSpellCastAt event
int osrs_p_osca();
int osrs_p_osca()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnDamaged event
int osrs_p_oda();
int osrs_p_oda()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable ::OnHeartbeat event
int osrs_p_oh();
int osrs_p_oh()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnUserDefined event
int osrs_p_oud();
int osrs_p_oud()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnDeath event
int osrs_p_ode();
int osrs_p_ode()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Placeable::OnPhysicalAttacked event
int osrs_p_opa();
int osrs_p_opa()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// TRAP
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// trap::OnHeartbeat event
int osrs_tra_oh();
int osrs_tra_oh()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Trap::OnDisarm event
int osrs_tra_odisa();
int osrs_tra_odisa()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Trap::OnUserDefined event
int osrs_tra_oud();
int osrs_tra_oud()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Trap::OnTrapTriggered event
int osrs_tra_ott();
int osrs_tra_ott()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// TRIGGER
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Trigger::OnUserDefined event
int osrs_tri_oud();
int osrs_tri_oud()
{
return TRUE;
}
// Trigger::OnEnter event
int osrs_tri_oent();
int osrs_tri_oent()
{
return TRUE;
}
// Trigger::OnClick event
int osrs_tri_ocli();
int osrs_tri_ocli()
{
return TRUE;
}
// Trigger::OnExit event
int osrs_tri_oexi();
int osrs_tri_oexi()
{
return TRUE;
}
// Trigger::OnHeartbeat event
int osrs_tri_oh();
int osrs_tri_oh()
{
return TRUE;
}
