219 lines
8.8 KiB
Plaintext
219 lines
8.8 KiB
Plaintext
//-----------------------------------------------------------------------------
|
|
// Constants
|
|
//-----------------------------------------------------------------------------
|
|
|
|
const int EVENT_INVALID = 0;
|
|
const int EVENT_SAVE_CHAR = 1;
|
|
const int EVENT_PICKPOCKET = 2;
|
|
const int EVENT_ATTACK = 3;
|
|
const int EVENT_EXAMINE = 6;
|
|
const int EVENT_TOGGLE_MODE = 9;
|
|
const int EVENT_STEALTH_MODE= 10;
|
|
const int EVENT_DEVASTATING = 11;
|
|
const int EVENT_UNPOLYMORPH = 12;
|
|
const int EVENT_TRAPTRIGGER = 13;
|
|
const int EVENT_ENDDIALOG = 14;
|
|
const int EVENT_ENDSANCTUARY= 15;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Dummy
|
|
//-----------------------------------------------------------------------------
|
|
|
|
string ModeToString( int nMode ){
|
|
|
|
switch( nMode ){
|
|
|
|
case ACTION_MODE_COUNTERSPELL:return "counterspell";
|
|
case ACTION_MODE_DEFENSIVE_CAST:return "defensive casting";
|
|
case ACTION_MODE_DETECT:return "detect";
|
|
case ACTION_MODE_DIRTY_FIGHTING:return "dirty fighting";
|
|
case ACTION_MODE_EXPERTISE:return "expertise";
|
|
case ACTION_MODE_FLURRY_OF_BLOWS:return "flurry of blows";
|
|
case ACTION_MODE_IMPROVED_EXPERTISE:return "improved expertise";
|
|
case ACTION_MODE_IMPROVED_POWER_ATTACK:return "improved power attack";
|
|
case ACTION_MODE_PARRY:return "parry";
|
|
case ACTION_MODE_POWER_ATTACK:return "power attack";
|
|
case ACTION_MODE_RAPID_SHOT:return "rapid shot";
|
|
case ACTION_MODE_STEALTH:return "stealth";
|
|
default:break;
|
|
|
|
}
|
|
return IntToString( nMode );
|
|
}
|
|
|
|
int GetItemDevastatingCriticalFeat( object oItem ){
|
|
|
|
//Hook fails and returns the item you're hitting
|
|
//instead if you got no gloves, offand or mainhand equipped
|
|
if( GetObjectType( oItem ) == OBJECT_TYPE_CREATURE )
|
|
return FEAT_EPIC_DEVASTATING_CRITICAL_UNARMED;
|
|
|
|
switch( GetBaseItemType( oItem ) ){
|
|
|
|
case BASE_ITEM_BASTARDSWORD: return FEAT_EPIC_DEVASTATING_CRITICAL_BASTARDSWORD;
|
|
case BASE_ITEM_BATTLEAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_BATTLEAXE;
|
|
case BASE_ITEM_BRACER: return FEAT_EPIC_DEVASTATING_CRITICAL_UNARMED;
|
|
case BASE_ITEM_CBLUDGWEAPON: return FEAT_EPIC_DEVASTATING_CRITICAL_CREATURE;
|
|
case BASE_ITEM_CLUB: return FEAT_EPIC_DEVASTATING_CRITICAL_CLUB;
|
|
case BASE_ITEM_CPIERCWEAPON: return FEAT_EPIC_DEVASTATING_CRITICAL_CREATURE;
|
|
case BASE_ITEM_CREATUREITEM: return FEAT_EPIC_DEVASTATING_CRITICAL_CREATURE;
|
|
case BASE_ITEM_CSLASHWEAPON: return FEAT_EPIC_DEVASTATING_CRITICAL_CREATURE;
|
|
case BASE_ITEM_CSLSHPRCWEAP: return FEAT_EPIC_DEVASTATING_CRITICAL_CREATURE;
|
|
case BASE_ITEM_DAGGER: return FEAT_EPIC_DEVASTATING_CRITICAL_DAGGER;
|
|
case BASE_ITEM_DART: return FEAT_EPIC_DEVASTATING_CRITICAL_DART;
|
|
case BASE_ITEM_DIREMACE: return FEAT_EPIC_DEVASTATING_CRITICAL_DIREMACE;
|
|
case BASE_ITEM_DOUBLEAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_DOUBLEAXE;
|
|
case BASE_ITEM_DWARVENWARAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_DWAXE;
|
|
case BASE_ITEM_GLOVES: return FEAT_EPIC_DEVASTATING_CRITICAL_UNARMED;
|
|
case BASE_ITEM_GREATAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_GREATAXE;
|
|
case BASE_ITEM_GREATSWORD: return FEAT_EPIC_DEVASTATING_CRITICAL_GREATSWORD;
|
|
case BASE_ITEM_HALBERD: return FEAT_EPIC_DEVASTATING_CRITICAL_HALBERD;
|
|
case BASE_ITEM_HANDAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_HANDAXE;
|
|
case BASE_ITEM_HEAVYCROSSBOW: return FEAT_EPIC_DEVASTATING_CRITICAL_HEAVYCROSSBOW;
|
|
case BASE_ITEM_HEAVYFLAIL: return FEAT_EPIC_DEVASTATING_CRITICAL_HEAVYFLAIL;
|
|
case BASE_ITEM_KAMA: return FEAT_EPIC_DEVASTATING_CRITICAL_KAMA;
|
|
case BASE_ITEM_KATANA: return FEAT_EPIC_DEVASTATING_CRITICAL_KATANA;
|
|
case BASE_ITEM_KUKRI: return FEAT_EPIC_DEVASTATING_CRITICAL_KUKRI;
|
|
case BASE_ITEM_LIGHTCROSSBOW: return FEAT_EPIC_DEVASTATING_CRITICAL_LIGHTCROSSBOW;
|
|
case BASE_ITEM_LIGHTFLAIL: return FEAT_EPIC_DEVASTATING_CRITICAL_LIGHTFLAIL;
|
|
case BASE_ITEM_LIGHTHAMMER: return FEAT_EPIC_DEVASTATING_CRITICAL_LIGHTHAMMER;
|
|
case BASE_ITEM_LIGHTMACE: return FEAT_EPIC_DEVASTATING_CRITICAL_LIGHTMACE;
|
|
case BASE_ITEM_LONGBOW: return FEAT_EPIC_DEVASTATING_CRITICAL_LONGBOW;
|
|
case BASE_ITEM_LONGSWORD: return FEAT_EPIC_DEVASTATING_CRITICAL_LONGSWORD;
|
|
case BASE_ITEM_MORNINGSTAR: return FEAT_EPIC_DEVASTATING_CRITICAL_MORNINGSTAR;
|
|
case BASE_ITEM_QUARTERSTAFF: return FEAT_EPIC_DEVASTATING_CRITICAL_QUARTERSTAFF;
|
|
case BASE_ITEM_RAPIER: return FEAT_EPIC_DEVASTATING_CRITICAL_RAPIER;
|
|
case BASE_ITEM_SCIMITAR: return FEAT_EPIC_DEVASTATING_CRITICAL_SCIMITAR;
|
|
case BASE_ITEM_SCYTHE: return FEAT_EPIC_DEVASTATING_CRITICAL_SCYTHE;
|
|
case BASE_ITEM_SHORTBOW: return FEAT_EPIC_DEVASTATING_CRITICAL_SHORTBOW;
|
|
case BASE_ITEM_SHORTSPEAR: return FEAT_EPIC_DEVASTATING_CRITICAL_SHORTSPEAR;
|
|
case BASE_ITEM_SHORTSWORD: return FEAT_EPIC_DEVASTATING_CRITICAL_SHORTSWORD;
|
|
case BASE_ITEM_SHURIKEN: return FEAT_EPIC_DEVASTATING_CRITICAL_SHURIKEN;
|
|
case BASE_ITEM_SICKLE: return FEAT_EPIC_DEVASTATING_CRITICAL_SICKLE;
|
|
case BASE_ITEM_SLING: return FEAT_EPIC_DEVASTATING_CRITICAL_SLING;
|
|
case BASE_ITEM_THROWINGAXE: return FEAT_EPIC_DEVASTATING_CRITICAL_THROWINGAXE;
|
|
case BASE_ITEM_TRIDENT: return FEAT_EPIC_DEVASTATING_CRITICAL_TRIDENT;
|
|
case BASE_ITEM_TWOBLADEDSWORD: return FEAT_EPIC_DEVASTATING_CRITICAL_TWOBLADEDSWORD;
|
|
case BASE_ITEM_WARHAMMER: return FEAT_EPIC_DEVASTATING_CRITICAL_WARHAMMER;
|
|
case BASE_ITEM_WHIP: return FEAT_EPIC_DEVASTATING_CRITICAL_WHIP;
|
|
default:break;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Prototypes
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//::This function should be moved elsewhere since if nwnx_events is not alive this script won't trigger
|
|
|
|
//Returns TRUE is nwnx_events.dll is responding
|
|
int GetNWNXEventsAlive( );
|
|
|
|
//Returns the type of event that triggered the nwnx event script
|
|
int GetNWNXEventType( );
|
|
|
|
//Returns the target that caused OBJECT_SELF to trigger the nwnx event
|
|
object GetNWNXEventTarget( );
|
|
|
|
//Returns data for certain nwnx events
|
|
//Currently:
|
|
//Mode activated on toggle
|
|
//State on stealthmode
|
|
int GetNWNXGetData( );
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Definitions
|
|
//-----------------------------------------------------------------------------
|
|
|
|
int GetNWNXGetData( ){
|
|
|
|
SetLocalString( OBJECT_SELF, "NWNX!EVENTS!GETEVENTDATA", " " );
|
|
|
|
int nMode = StringToInt( GetLocalString(OBJECT_SELF, "NWNX!EVENTS!GETEVENTDATA" ) );
|
|
DeleteLocalInt( OBJECT_SELF, "NWNX!EVENTS!GETEVENTDATA" );
|
|
|
|
return nMode;
|
|
}
|
|
|
|
int GetNWNXEventsAlive( ){
|
|
|
|
SetLocalString( OBJECT_SELF, "NWNX!EVENTS!GETISALIVE", " " );
|
|
|
|
string sEvent = GetLocalString(OBJECT_SELF, "NWNX!EVENTS!GETISALIVE" );
|
|
DeleteLocalInt( OBJECT_SELF, "NWNX!EVENTS!GETISALIVE" );
|
|
|
|
return sEvent == ObjectToString( OBJECT_INVALID );
|
|
}
|
|
|
|
int GetNWNXEventType( ){
|
|
|
|
SetLocalString( OBJECT_SELF, "NWNX!EVENTS!GETEVENTID", " " );
|
|
|
|
int nEvent = StringToInt( GetLocalString(OBJECT_SELF, "NWNX!EVENTS!GETEVENTID" ) );
|
|
DeleteLocalInt( OBJECT_SELF, "NWNX!EVENTS!GETEVENTID" );
|
|
|
|
return nEvent;
|
|
}
|
|
|
|
object GetNWNXEventTarget( ){
|
|
|
|
//We have it in the object hook?
|
|
object oTarget = GetLocalObject( OBJECT_SELF, "NWNX!EVENTS!TARGET" );
|
|
|
|
if( GetIsObjectValid( oTarget ) ){
|
|
return oTarget;
|
|
}
|
|
|
|
//if not, walkaround fix time
|
|
SetLocalString( OBJECT_SELF, "NWNX!EVENTS!GETTARGETID", " " );
|
|
|
|
string sID = GetLocalString( OBJECT_SELF, "NWNX!EVENTS!GETTARGETID" );
|
|
DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!GETTARGETID" );
|
|
|
|
if( sID == "7f000000" || sID == "0" )
|
|
return OBJECT_INVALID;
|
|
|
|
oTarget = GetLocalObject( GetModule( ), "id_"+sID );
|
|
|
|
int nSlot = 0;
|
|
for( nSlot = 0; nSlot < NUM_INVENTORY_SLOTS; nSlot++ ){
|
|
|
|
oTarget = GetItemInSlot( nSlot );
|
|
|
|
if( ObjectToString( oTarget ) == sID ){
|
|
SetLocalObject( GetModule( ), "id_"+sID, oTarget );
|
|
return oTarget;
|
|
}
|
|
}
|
|
|
|
object oArea = GetArea( OBJECT_SELF );
|
|
oTarget = GetFirstObjectInArea( oArea );
|
|
|
|
while( GetIsObjectValid( oTarget ) ){
|
|
|
|
if( ObjectToString( oTarget ) == sID ){
|
|
SetLocalObject( GetModule( ), "id_"+sID, oTarget );
|
|
return oTarget;
|
|
}
|
|
oTarget = GetNextObjectInArea( oArea );
|
|
}
|
|
|
|
oTarget = GetFirstItemInInventory( );
|
|
while( GetIsObjectValid( oTarget ) ){
|
|
|
|
if( ObjectToString( oTarget ) == sID ){
|
|
SetLocalObject( GetModule( ), "id_"+sID, oTarget );
|
|
return oTarget;
|
|
}
|
|
oTarget = GetNextItemInInventory( );
|
|
}
|
|
|
|
return OBJECT_INVALID;
|
|
}
|
|
|
|
|
|
|
|
// Error checking
|
|
//void main(){}
|