Added (2) Castle Interior overrides

Added (2) Castle Interior overrides, continued making static NPCs & stores dynamic. added more DMFI language tokens, started working on mod onEnter scripting, got NPCs to fire emotes while walking around.
This commit is contained in:
Jaysyn904
2021-09-06 22:02:47 -04:00
parent 4b6d20bbc2
commit 52d65cb598
1933 changed files with 2269912 additions and 88289 deletions

View File

@@ -0,0 +1,285 @@
//::////////////////////////////////////////////////////////////////////////////
//:: Store Open Script
//:: ar_st_general
//:: For slightly faster store restocking
//:: -DM Heatstroke
//::////////////////////////////////////////////////////////////////////////////
/*
This script will allow stores to partially reset
themselves to their original state after some
time has passed.
Intended for persistent worlds.
*/
//::////////////////////////////////////////////////////////////////////////////
//:: Created By: The Krit
//:: Created On: 3/2/07
//:: Replaces the "do-nothing" BioWare script.
//::////////////////////////////////////////////////////////////////////////////
//::////////////////////////////////////////////////////////////////////////////
//
// This script will cause a store's finite inventory
// and limited gold to be (partially) replenished
// after a certain amount of time passes. It will also
// clean out new items and excess gold. I call this
// restocking.
//
// The timer starts when the store is first opened
// after server rest or the last restock. The time
// is random, but will be at least RESTOCK_TIME_FIXED
// real-time hours. The random component of the time
// is added to this minimum, and will range from 0
// to RESTOCK_TIME_VARIABLE minutes.
//
// Items are only replaced if all of that type have
// been sold (and not bought back). The chance for an
// item to be replaced is RESTOCK_CHANCE.
//
// Items not in the store's original inventory have a
// chance to be removed (sold to unspecified NPC's, if
// you will) when the store restocks. This chance is
// UNSTOCK_CHANCE.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no more than GOLD_MAX_FRACTION times
// its starting value.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no less than GOLD_MIN_FRACTION times
// its starting value.
//
// If you try to mess with things and make GOLD_MAX_FRACTION
// less than GOLD_MIN_FRACTION, you deserve whatever happens.
// You may also smack yourself for making trouble. :)
//
//::////////////////////////////////////////////////////////////////////////////
//
// The variables mentioned above are set globally below.
// In addition, you can change the value for a particular
// store by setting a local variable of the same name
// (and type) on the store.
// NOTE: These variables must be set on the *store*, not
// the merchant.
//
//::////////////////////////////////////////////////////////////////////////////
//
// This script will (likely) break if you switch a
// store from unlimited gold to limited gold through
// scripting. Don't do that. There would be no
// original gold level to refer to when restocking.
//
//::////////////////////////////////////////////////////////////////////////////
// The following is the minimum number of real-time (not
// game-time) hours that elapse before a store gets
// restocked.
const int RESTOCK_TIME_FIXED = 2;
// The following is the maximum number of minutes (not
// hours) that a restock might be delayed beyond the
// above minimum number of hours.
const int RESTOCK_TIME_VARIABLE = 30;
// The following is the chance (percentage) that a depleted
// item will be replaced when the restocking occurs. Each
// item rolls this percentage individually.
const int RESTOCK_CHANCE = 75;
// The following is the chance (percentage) that an item
// not in the store's original inventory will be removed
// when a restocking occurs.
const int UNSTOCK_CHANCE = 5;
// The following is the fraction (floating point) of the
// stores original gold that is the most a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MAX_FRACTION = 2.20;
// The following is the fraction (floating point) of the
// stores original gold that is the least a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MIN_FRACTION = 0.80;
// The following are names of local variables used by
// this script.
const string STORE_GOLD = "TK_STORE_STARTING_GOLD";
const string ORIG_INVENTORY = "TK_STORE_STARTING_INVENTORY_";
const string CUR_INVENTORY = "TK_STORE_CURRENT_INVENTORY_";
const string INVENTORY_STACK = "TK_STORE_INVENTORY_STACK_LIST_";
const string INVENTORY_LIST = "TK_STORE_INVENTORY_LIST_";
const string INVENTORY_SIZE = "TK_STORE_INVENTORY_SIZE";
const string INVENTORIED = "TK_STORE_DID_INVENTORY";
const string RESTOCK_ORDERED = "TK_STORE_DID_DELAY";
// Records the store's current (starting) inventory.
void DoInventory();
// Restocks the store.
void Restock();
//////////////////////////////////////////////////
// main()
//
// Intended for a store's OnOpenStore event, replacing the BioWare default.
//
void main()
{
// See if the store's original inventory has been recorded.
if ( !GetLocalInt(OBJECT_SELF, INVENTORIED) )
{
// Record the current inventory.
DoInventory();
SetLocalInt(OBJECT_SELF, INVENTORIED, TRUE);
}
// See if a restock is currently on delay.
if ( !GetLocalInt(OBJECT_SELF, RESTOCK_ORDERED) )
{
// Determine the restock times (possibly stored locally).
int nRestockHours = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_FIXED");
if ( nRestockHours == 0 )
nRestockHours = RESTOCK_TIME_FIXED;
int nRestockMinutes = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_VARIABLE");
if ( nRestockMinutes == 0 )
nRestockMinutes = RESTOCK_TIME_VARIABLE;
// Order (delay) a restock.
DelayCommand( TurnsToSeconds(60*nRestockHours + Random(nRestockMinutes+1)),
Restock());
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, TRUE);
}
}
//////////////////////////////////////////////////
// DoInventory()
//
// Records the store's current (starting) inventory.
//
void DoInventory()
{
// Record the store's current gold.
SetLocalInt(OBJECT_SELF, STORE_GOLD, GetStoreGold(OBJECT_SELF));
// Record the store's current inventory.
int nCount = 0;
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// Set a boolean flag based on the blueprint name.
SetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef, TRUE);
// Add sResRef to the list of blueprints.
SetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount), sResRef);
// Record the stack size.
SetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount), GetItemStackSize(oItem));
// Update the count.
nCount++;
}
// Next item.
oItem = GetNextItemInInventory();
}
// Record the length of the list of blueprints.
SetLocalInt(OBJECT_SELF, INVENTORY_SIZE, nCount);
}
//////////////////////////////////////////////////
// Restock()
//
// Restocks the store.
//
void Restock()
{
// Check the store's gold.
int nCurGold = GetStoreGold(OBJECT_SELF);
// We are only concerned if the store has limited gold.
if ( nCurGold > -1 )
{
// Determine the min and max gold fractions (possibly stored locally).
float fGoldMin = GetLocalFloat(OBJECT_SELF, "GOLD_MIN_FRACTION");
if ( fGoldMin == 0.0 )
fGoldMin = GOLD_MIN_FRACTION;
float fGoldMax = GetLocalFloat(OBJECT_SELF, "GOLD_MAX_FRACTION");
if ( fGoldMax == 0.0 )
fGoldMax = GOLD_MAX_FRACTION;
// Calculate the minimum and maximum gold levels.
int nOrigGold = GetLocalInt(OBJECT_SELF, STORE_GOLD);
int nMinGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMin);
int nMaxGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMax);
// Check for too little gold.
if ( nCurGold < nMinGold )
SetStoreGold(OBJECT_SELF, nMinGold);
// Check for too much gold.
else if ( nCurGold > nMaxGold )
SetStoreGold(OBJECT_SELF, nMaxGold);
}
// Determine the unstock chance (possibly stored locally).
int nUnstockChance = GetLocalInt(OBJECT_SELF, "UNSTOCK_CHANCE");
if ( nUnstockChance == 0 )
nUnstockChance = UNSTOCK_CHANCE;
// Scan the store's current inventory.
// Record which original items are still around.
// Possibly remove non-original items.
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// See if this item is an original item.
if ( GetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef) )
{
// Set a boolean flag (temporarily) based on the blueprint name.
SetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef, TRUE);
DelayCommand(0.0, DeleteLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef));
}
// See if this (not original) item should be removed.
else if ( d100() <= nUnstockChance )
// Delete this item.
DestroyObject(oItem);
}
// Next item.
oItem = GetNextItemInInventory();
}
// Determine the restock chance (possibly stored locally).
int nRestockChance = GetLocalInt(OBJECT_SELF, "RESTOCK_CHANCE");
if ( nRestockChance == 0 )
nRestockChance = RESTOCK_CHANCE;
// Loop through the list of items that might be restored.
int nCount = GetLocalInt(OBJECT_SELF, INVENTORY_SIZE);
while ( nCount-- > 0 )
{
string sResRef = GetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount));
// Make sure no items of this type are in the store's inventory (before this loop).
if ( !GetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef) )
// See if this item should be restocked.
if ( d100() <= nRestockChance )
// Add this item to the store.
CreateItemOnObject(sResRef, OBJECT_SELF,
GetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount)));
}
// Restocking is no longer in progress.
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, FALSE);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: FileName cv_is_female
//:://////////////////////////////////////////////
//::
//:: Returns if speaker is female.
//::
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
int StartingConditional()
{
// Add the gender restrictions
if(GetGender(GetPCSpeaker()) != GENDER_FEMALE)
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: FileName cv_is_male
//:://////////////////////////////////////////////
//::
//:: Returns if speaker is male.
//::
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
int StartingConditional()
{
// Add the gender restrictions
if(GetGender(GetPCSpeaker()) != GENDER_MALE)
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: FileName cv_is_neuter
//:://////////////////////////////////////////////
//::
//:: Returns if speaker is generderless
//::
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
int StartingConditional()
{
// Add the gender restrictions
if(GetGender(GetPCSpeaker()) != GENDER_NONE)
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,20 @@
//:://////////////////////////////////////////////
//:: FileName cv_is_sexless
//:://////////////////////////////////////////////
//::
//:: Returns if speaker is "other" in regards to
//:: gender.
//::
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
int StartingConditional()
{
// Add the gender restrictions
if(GetGender(GetPCSpeaker()) != GENDER_OTHER)
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,12 @@
// prc_onenter,ra_mod_onenter
/////////////////////////////////////////////////////////////////////
//
//
//
/////////////////////////////////////////////////////////////////////
void main()
{
ExecuteScript("prc_onenter", OBJECT_SELF);
ExecuteScript("ra_mod_onenter", OBJECT_SELF);
}

View File

@@ -13839,7 +13839,7 @@ int AI_AttemptHostileSkills()
GlobalIntelligence >= 3) ||
GetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_PICKPOCKETING, AI_OTHER_COMBAT_MASTER))
{
//SpeakString("Setting for NO: " + IntToString(GetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_PICKPOCKETING, AI_OTHER_COMBAT_MASTER)) + " YES: " + IntToString(GetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_PICKPOCKETING, AI_OTHER_COMBAT_MASTER)));
SpeakString("Seting for NO: " + IntToString(GetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_PICKPOCKETING, AI_OTHER_COMBAT_MASTER)) + " YES: " + IntToString(GetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_PICKPOCKETING, AI_OTHER_COMBAT_MASTER)));
// Need appropriate level of skill, checked On Spawn, or overriden...
AI_ActionUseSkillOnMeleeTarget(SKILL_PICK_POCKET);
return TRUE;

View File

@@ -32,39 +32,6 @@
void main()
{
// * if petrified, jump out
if (GetHasEffect(EFFECT_TYPE_PETRIFY, OBJECT_SELF) == TRUE)
{
return;
}
// * If dead, exit directly.
if (GetIsDead(OBJECT_SELF) == TRUE)
{
return;
}
// See if what we just 'heard' matches any of our
// predefined patterns
int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
string sSpoken = GetMatchedSubstring(0);
// 2008.05.25 tsunami282 - removed for NWN 1.69 (no longer needed)
//DMFI CODE ADDITIONS BEGIN HERE
// if (GetIsPC(oShouter) || GetIsDM(oShouter) || GetIsDMPossessed(oShouter))
// {
// ExecuteScript("dmfi_voice_exe", OBJECT_SELF);
// }
if (nMatch == -1 && GetIsPC(oShouter) &&(GetLocalInt(GetModule(), "dmfi_AllMute") || GetLocalInt(OBJECT_SELF, "dmfi_Mute")))
{
SendMessageToAllDMs(GetName(oShouter) + " is trying to speak to a muted NPC, " + GetName(OBJECT_SELF) + ", in area " + GetName(GetArea(OBJECT_SELF)));
SendMessageToPC(oShouter, "This NPC is muted. A DM will be here shortly.");
return;
}
//DMFI CODE ADDITIONS END HERE
// Pre-conversation-event. Returns TRUE if we interrupt this script call.
if(FirePreUserEvent(AI_FLAG_UDE_ON_DIALOGUE_PRE_EVENT, EVENT_ON_DIALOGUE_PRE_EVENT)) return;
@@ -72,6 +39,10 @@ void main()
if(GetAIOff()) return;
// Declarations
int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
string sSpoken = GetMatchedSubstring(0);
// We can ignore everything under special cases - EG no valid shouter,
// we are fleeing, its us, or we are not in the same area.
// - We break out of the script if this happens.
@@ -86,14 +57,11 @@ void main()
return;
}
// Conversation if not a shout.
if(nMatch == -1)
{
// * Don't speak when dead. 1.4 change (an obvious one to make)
if(CanSpeak())
{
// Make sure it is a PC and we are not fighting.
if(!GetIsFighting() && (GetIsPC(oShouter) || GetIsDMPossessed(oShouter)))
@@ -128,8 +96,6 @@ void main()
(!GetHasEffect(EFFECT_TYPE_DEAF) || GetObjectSeen(oShouter)))
{
if(GetIsFriend(oShouter) || GetFactionEqual(oShouter))
{
// If they are a friend, not a PC, and a valid number, react.
// In the actual RespondToShout call, we do check to see if we bother.
@@ -180,7 +146,6 @@ void main()
// Short non-respond
SetLocalTimer(AI_TIMER_SHOUT_IGNORE_ANYTHING_SAID, 6.0);
// Attack the enemy!
ClearAllActions();
DetermineCombatRound(oShouter);
@@ -193,4 +158,3 @@ void main()
// Fire End of Dialogue event
FireUserEvent(AI_FLAG_UDE_ON_DIALOGUE_EVENT, EVENT_ON_DIALOGUE_EVENT);
}

View File

@@ -16,28 +16,6 @@
#include "J_INC_OTHER_AI"
//DMFI CODE ADDITIONS*****************************
void SafeFaction(object oCurrent, object oAttacker)
{
AssignCommand(oAttacker, ClearAllActions());
AssignCommand(oCurrent, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oAttacker) <= 10)
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oAttacker);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oAttacker) <= 10)
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oAttacker);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oAttacker) <= 10)
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oAttacker);
}
}
//END DMFI CODE ADDITIONS*************************
void main()
{
// Pre-attacked-event. Returns TRUE if we interrupt this script call.

View File

@@ -27,31 +27,6 @@ void DeathCheck(int nDeaths);
void main()
{
object oNPC = OBJECT_SELF;
// Chance of guard type creatures dropping gear onDeath.
if ((GetResRef(oNPC) == "npc_baleasgrd001") ||
(GetResRef(oNPC) == "npc_goldeye001") ||
(GetResRef(oNPC) == "npc_wau_pal001") ||
(GetResRef(oNPC) == "npc_baleasgrd004") ||
(GetResRef(oNPC) == "npc_baleasgrd005"))
{
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oNPC);
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oNPC);
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oNPC);
// Give a 1% chance to drop armor &/or equipped weapon
int bDroppableA = d100() > 99;
int bDroppableW = d100() > 99;
int bDroppableS = d100() > 99;
SetDroppableFlag(oArmor, bDroppableA);
SetDroppableFlag(oWeapon, bDroppableW);
SetDroppableFlag(oShield, bDroppableS);
}
// If we are set to, don't fire this script at all
if(GetAIInteger(I_AM_TOTALLY_DEAD)) return;

View File

@@ -0,0 +1,163 @@
void GivePCWands(object oPC)
{
// items to be give to new players
string sWndPCFollow = "dmfi_pc_follow";//PC Autofollow Widget
string sWndPCDice = "dmfi_pc_dicebag";//PC Dicebag
string sWndPCEmote = "dmfi_pc_emote";//PC Emote Wand
CreateItemOnObject(sWndPCFollow, oPC);
CreateItemOnObject(sWndPCDice, oPC);
CreateItemOnObject(sWndPCEmote, oPC);
}
void GiveLangTokens(object oPC)
{
// Give class based language items
if( GetLevelByClass(CLASS_TYPE_DRUID, oPC) >= 2 )
{
if ( GetItemPossessedBy(oPC, "hlslang_108") == OBJECT_INVALID ) // Druidic
{
DelayCommand(1.0, FloatingTextStringOnCreature("Druidic language token acquired.", oPC));
CreateItemOnObject("hlslang_108", oPC);
}
}
if( GetLevelByClass(CLASS_TYPE_ROGUE, oPC) >= 2 )
{
if ( GetItemPossessedBy(oPC, "hlslang_9") == OBJECT_INVALID ) // Thieve's Cant
{
DelayCommand(1.0, FloatingTextStringOnCreature("Thieve's Cant token acquired.", oPC));
CreateItemOnObject("hlslang_9", oPC);
}
}
// Give race based language tokens
// TODO: Expand for PRC races.
if( GetRacialType(oPC) == RACIAL_TYPE_ELF )
{
// DelayCommand(0.5, AdjustReputation(oPC, GetObjectByTag("FACTION_ATHAS_SILVERHAND"), 90)); // Adjust faction reputation
if ( GetItemPossessedBy(oPC, "hlslang_1") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Elven language token acquired.", oPC));
CreateItemOnObject("hlslang_1", oPC);
}
}
if( GetRacialType(oPC) == RACIAL_TYPE_HALFELF )
{
if ( GetItemPossessedBy(oPC, "hlslang_1") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Elven language token acquired.", oPC));
CreateItemOnObject("hlslang_1", oPC);
}
}
if( GetRacialType(oPC) == RACIAL_TYPE_DWARF )
{
// DelayCommand(0.5, AdjustReputation(oPC, GetObjectByTag("ATHAS_FACTION_KLED"), 90)); // Adjust faction reputation
if ( GetItemPossessedBy(oPC, "hlslang_4") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Dwarven language token acquired.", oPC));
CreateItemOnObject("hlslang_4", oPC);
}
}
if( GetRacialType(oPC) == RACIAL_TYPE_HALFLING )
{
if ( GetItemPossessedBy(oPC, "hlslang_3") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Halfling language token acquired.", oPC));
CreateItemOnObject("hlslang_3", oPC);
}
}
if( GetRacialType(oPC) == 199 ) // Air Genasi
{
SetColor ( oPC, COLOR_CHANNEL_SKIN, 020);
if ( GetItemPossessedBy(oPC, "hlslang_101") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Auran language token acquired.", oPC));
CreateItemOnObject("hlslang_101", oPC);
}
}
if( GetRacialType(oPC) == 200 ) // Earth Genasi
{
SetColor ( oPC, COLOR_CHANNEL_SKIN, 118);
if ( GetItemPossessedBy(oPC, "hlslang_102") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Terran language token acquired.", oPC));
CreateItemOnObject("hlslang_102", oPC);
}
}
if( GetRacialType(oPC) == 202 ) // Fire Genasi
{
SetColor ( oPC, COLOR_CHANNEL_SKIN, 103);
if ( GetItemPossessedBy(oPC, "hlslang_104") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Ignan language token acquired.", oPC));
CreateItemOnObject("hlslang_104", oPC);
}
}
if( GetRacialType(oPC) == 205 ) // Water Genasi
{
SetColor ( oPC, COLOR_CHANNEL_SKIN, 141);
if ( GetItemPossessedBy(oPC, "hlslang_103") == OBJECT_INVALID )
{
DelayCommand(1.0, FloatingTextStringOnCreature("Aquan language token acquired.", oPC));
CreateItemOnObject("hlslang_103", oPC);
}
}
}
#include "dmfi_init_inc"
void main()
{
object oPC = GetEnteringObject();
// Make sure PC isn't set to Plot, for reasons
SetPlotFlag(oPC, FALSE);
// Reset PC size
SetObjectVisualTransform(oPC, OBJECT_VISUAL_TRANSFORM_SCALE, 1.0f);
// Initialize DMFI
dmfiInitialize(oPC);
// Give PC DMFI gear
if (GetXP(oPC) == 0)
{
GivePCWands(oPC);
}
// Begin BESIE Spawn System
int bBESIEWidget;
if(GetIsDM(oPC))
{
SetLocalInt(GetModule(), "re_" + GetPCPlayerName(oPC), TRUE);
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
if(GetTag(oItem) == "BESIEWidget") bBESIEWidget = TRUE;
oItem = GetNextItemInInventory(oPC);
}
if(!bBESIEWidget) CreateItemOnObject("besiewidget", oPC);
}
else DeleteLocalInt(GetModule(), "re_" + GetName(oPC));
// End BESIE Spawn System
}

View File

@@ -0,0 +1,285 @@
//::////////////////////////////////////////////////////////////////////////////
//:: Store Open Script
//:: ra_st_special
//:: For slightly faster store restocking
//:: -DM Heatstroke
//::////////////////////////////////////////////////////////////////////////////
/*
This script will allow stores to partially reset
themselves to their original state after some
time has passed.
Intended for persistent worlds.
*/
//::////////////////////////////////////////////////////////////////////////////
//:: Created By: The Krit
//:: Created On: 3/2/07
//:: Replaces the "do-nothing" BioWare script.
//::////////////////////////////////////////////////////////////////////////////
//::////////////////////////////////////////////////////////////////////////////
//
// This script will cause a store's finite inventory
// and limited gold to be (partially) replenished
// after a certain amount of time passes. It will also
// clean out new items and excess gold. I call this
// restocking.
//
// The timer starts when the store is first opened
// after server rest or the last restock. The time
// is random, but will be at least RESTOCK_TIME_FIXED
// real-time hours. The random component of the time
// is added to this minimum, and will range from 0
// to RESTOCK_TIME_VARIABLE minutes.
//
// Items are only replaced if all of that type have
// been sold (and not bought back). The chance for an
// item to be replaced is RESTOCK_CHANCE.
//
// Items not in the store's original inventory have a
// chance to be removed (sold to unspecified NPC's, if
// you will) when the store restocks. This chance is
// UNSTOCK_CHANCE.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no more than GOLD_MAX_FRACTION times
// its starting value.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no less than GOLD_MIN_FRACTION times
// its starting value.
//
// If you try to mess with things and make GOLD_MAX_FRACTION
// less than GOLD_MIN_FRACTION, you deserve whatever happens.
// You may also smack yourself for making trouble. :)
//
//::////////////////////////////////////////////////////////////////////////////
//
// The variables mentioned above are set globally below.
// In addition, you can change the value for a particular
// store by setting a local variable of the same name
// (and type) on the store.
// NOTE: These variables must be set on the *store*, not
// the merchant.
//
//::////////////////////////////////////////////////////////////////////////////
//
// This script will (likely) break if you switch a
// store from unlimited gold to limited gold through
// scripting. Don't do that. There would be no
// original gold level to refer to when restocking.
//
//::////////////////////////////////////////////////////////////////////////////
// The following is the minimum number of real-time (not
// game-time) hours that elapse before a store gets
// restocked.
const int RESTOCK_TIME_FIXED = 2;
// The following is the maximum number of minutes (not
// hours) that a restock might be delayed beyond the
// above minimum number of hours.
const int RESTOCK_TIME_VARIABLE = 30;
// The following is the chance (percentage) that a depleted
// item will be replaced when the restocking occurs. Each
// item rolls this percentage individually.
const int RESTOCK_CHANCE = 75;
// The following is the chance (percentage) that an item
// not in the store's original inventory will be removed
// when a restocking occurs.
const int UNSTOCK_CHANCE = 5;
// The following is the fraction (floating point) of the
// stores original gold that is the most a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MAX_FRACTION = 2.20;
// The following is the fraction (floating point) of the
// stores original gold that is the least a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MIN_FRACTION = 0.80;
// The following are names of local variables used by
// this script.
const string STORE_GOLD = "TK_STORE_STARTING_GOLD";
const string ORIG_INVENTORY = "TK_STORE_STARTING_INVENTORY_";
const string CUR_INVENTORY = "TK_STORE_CURRENT_INVENTORY_";
const string INVENTORY_STACK = "TK_STORE_INVENTORY_STACK_LIST_";
const string INVENTORY_LIST = "TK_STORE_INVENTORY_LIST_";
const string INVENTORY_SIZE = "TK_STORE_INVENTORY_SIZE";
const string INVENTORIED = "TK_STORE_DID_INVENTORY";
const string RESTOCK_ORDERED = "TK_STORE_DID_DELAY";
// Records the store's current (starting) inventory.
void DoInventory();
// Restocks the store.
void Restock();
//////////////////////////////////////////////////
// main()
//
// Intended for a store's OnOpenStore event, replacing the BioWare default.
//
void main()
{
// See if the store's original inventory has been recorded.
if ( !GetLocalInt(OBJECT_SELF, INVENTORIED) )
{
// Record the current inventory.
DoInventory();
SetLocalInt(OBJECT_SELF, INVENTORIED, TRUE);
}
// See if a restock is currently on delay.
if ( !GetLocalInt(OBJECT_SELF, RESTOCK_ORDERED) )
{
// Determine the restock times (possibly stored locally).
int nRestockHours = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_FIXED");
if ( nRestockHours == 0 )
nRestockHours = RESTOCK_TIME_FIXED;
int nRestockMinutes = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_VARIABLE");
if ( nRestockMinutes == 0 )
nRestockMinutes = RESTOCK_TIME_VARIABLE;
// Order (delay) a restock.
DelayCommand( TurnsToSeconds(60*nRestockHours + Random(nRestockMinutes+1)),
Restock());
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, TRUE);
}
}
//////////////////////////////////////////////////
// DoInventory()
//
// Records the store's current (starting) inventory.
//
void DoInventory()
{
// Record the store's current gold.
SetLocalInt(OBJECT_SELF, STORE_GOLD, GetStoreGold(OBJECT_SELF));
// Record the store's current inventory.
int nCount = 0;
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// Set a boolean flag based on the blueprint name.
SetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef, TRUE);
// Add sResRef to the list of blueprints.
SetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount), sResRef);
// Record the stack size.
SetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount), GetItemStackSize(oItem));
// Update the count.
nCount++;
}
// Next item.
oItem = GetNextItemInInventory();
}
// Record the length of the list of blueprints.
SetLocalInt(OBJECT_SELF, INVENTORY_SIZE, nCount);
}
//////////////////////////////////////////////////
// Restock()
//
// Restocks the store.
//
void Restock()
{
// Check the store's gold.
int nCurGold = GetStoreGold(OBJECT_SELF);
// We are only concerned if the store has limited gold.
if ( nCurGold > -1 )
{
// Determine the min and max gold fractions (possibly stored locally).
float fGoldMin = GetLocalFloat(OBJECT_SELF, "GOLD_MIN_FRACTION");
if ( fGoldMin == 0.0 )
fGoldMin = GOLD_MIN_FRACTION;
float fGoldMax = GetLocalFloat(OBJECT_SELF, "GOLD_MAX_FRACTION");
if ( fGoldMax == 0.0 )
fGoldMax = GOLD_MAX_FRACTION;
// Calculate the minimum and maximum gold levels.
int nOrigGold = GetLocalInt(OBJECT_SELF, STORE_GOLD);
int nMinGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMin);
int nMaxGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMax);
// Check for too little gold.
if ( nCurGold < nMinGold )
SetStoreGold(OBJECT_SELF, nMinGold);
// Check for too much gold.
else if ( nCurGold > nMaxGold )
SetStoreGold(OBJECT_SELF, nMaxGold);
}
// Determine the unstock chance (possibly stored locally).
int nUnstockChance = GetLocalInt(OBJECT_SELF, "UNSTOCK_CHANCE");
if ( nUnstockChance == 0 )
nUnstockChance = UNSTOCK_CHANCE;
// Scan the store's current inventory.
// Record which original items are still around.
// Possibly remove non-original items.
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// See if this item is an original item.
if ( GetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef) )
{
// Set a boolean flag (temporarily) based on the blueprint name.
SetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef, TRUE);
DelayCommand(0.0, DeleteLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef));
}
// See if this (not original) item should be removed.
else if ( d100() <= nUnstockChance )
// Delete this item.
DestroyObject(oItem);
}
// Next item.
oItem = GetNextItemInInventory();
}
// Determine the restock chance (possibly stored locally).
int nRestockChance = GetLocalInt(OBJECT_SELF, "RESTOCK_CHANCE");
if ( nRestockChance == 0 )
nRestockChance = RESTOCK_CHANCE;
// Loop through the list of items that might be restored.
int nCount = GetLocalInt(OBJECT_SELF, INVENTORY_SIZE);
while ( nCount-- > 0 )
{
string sResRef = GetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount));
// Make sure no items of this type are in the store's inventory (before this loop).
if ( !GetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef) )
// See if this item should be restocked.
if ( d100() <= nRestockChance )
// Add this item to the store.
CreateItemOnObject(sResRef, OBJECT_SELF,
GetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount)));
}
// Restocking is no longer in progress.
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, FALSE);
}

View File

@@ -0,0 +1,285 @@
//::////////////////////////////////////////////////////////////////////////////
//:: Store Open Script
//:: ra_st_temple
//:: For slightly faster store restocking
//:: -DM Heatstroke
//::////////////////////////////////////////////////////////////////////////////
/*
This script will allow stores to partially reset
themselves to their original state after some
time has passed.
Intended for persistent worlds.
*/
//::////////////////////////////////////////////////////////////////////////////
//:: Created By: The Krit
//:: Created On: 3/2/07
//:: Replaces the "do-nothing" BioWare script.
//::////////////////////////////////////////////////////////////////////////////
//::////////////////////////////////////////////////////////////////////////////
//
// This script will cause a store's finite inventory
// and limited gold to be (partially) replenished
// after a certain amount of time passes. It will also
// clean out new items and excess gold. I call this
// restocking.
//
// The timer starts when the store is first opened
// after server rest or the last restock. The time
// is random, but will be at least RESTOCK_TIME_FIXED
// real-time hours. The random component of the time
// is added to this minimum, and will range from 0
// to RESTOCK_TIME_VARIABLE minutes.
//
// Items are only replaced if all of that type have
// been sold (and not bought back). The chance for an
// item to be replaced is RESTOCK_CHANCE.
//
// Items not in the store's original inventory have a
// chance to be removed (sold to unspecified NPC's, if
// you will) when the store restocks. This chance is
// UNSTOCK_CHANCE.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no more than GOLD_MAX_FRACTION times
// its starting value.
//
// After the store restocks, the store's gold supply -- if
// limited -- will be no less than GOLD_MIN_FRACTION times
// its starting value.
//
// If you try to mess with things and make GOLD_MAX_FRACTION
// less than GOLD_MIN_FRACTION, you deserve whatever happens.
// You may also smack yourself for making trouble. :)
//
//::////////////////////////////////////////////////////////////////////////////
//
// The variables mentioned above are set globally below.
// In addition, you can change the value for a particular
// store by setting a local variable of the same name
// (and type) on the store.
// NOTE: These variables must be set on the *store*, not
// the merchant.
//
//::////////////////////////////////////////////////////////////////////////////
//
// This script will (likely) break if you switch a
// store from unlimited gold to limited gold through
// scripting. Don't do that. There would be no
// original gold level to refer to when restocking.
//
//::////////////////////////////////////////////////////////////////////////////
// The following is the minimum number of real-time (not
// game-time) hours that elapse before a store gets
// restocked.
const int RESTOCK_TIME_FIXED = 2;
// The following is the maximum number of minutes (not
// hours) that a restock might be delayed beyond the
// above minimum number of hours.
const int RESTOCK_TIME_VARIABLE = 30;
// The following is the chance (percentage) that a depleted
// item will be replaced when the restocking occurs. Each
// item rolls this percentage individually.
const int RESTOCK_CHANCE = 75;
// The following is the chance (percentage) that an item
// not in the store's original inventory will be removed
// when a restocking occurs.
const int UNSTOCK_CHANCE = 5;
// The following is the fraction (floating point) of the
// stores original gold that is the most a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MAX_FRACTION = 2.20;
// The following is the fraction (floating point) of the
// stores original gold that is the least a store can have
// after restocking.
// (No effect on stores with unlimited gold.)
const float GOLD_MIN_FRACTION = 0.80;
// The following are names of local variables used by
// this script.
const string STORE_GOLD = "TK_STORE_STARTING_GOLD";
const string ORIG_INVENTORY = "TK_STORE_STARTING_INVENTORY_";
const string CUR_INVENTORY = "TK_STORE_CURRENT_INVENTORY_";
const string INVENTORY_STACK = "TK_STORE_INVENTORY_STACK_LIST_";
const string INVENTORY_LIST = "TK_STORE_INVENTORY_LIST_";
const string INVENTORY_SIZE = "TK_STORE_INVENTORY_SIZE";
const string INVENTORIED = "TK_STORE_DID_INVENTORY";
const string RESTOCK_ORDERED = "TK_STORE_DID_DELAY";
// Records the store's current (starting) inventory.
void DoInventory();
// Restocks the store.
void Restock();
//////////////////////////////////////////////////
// main()
//
// Intended for a store's OnOpenStore event, replacing the BioWare default.
//
void main()
{
// See if the store's original inventory has been recorded.
if ( !GetLocalInt(OBJECT_SELF, INVENTORIED) )
{
// Record the current inventory.
DoInventory();
SetLocalInt(OBJECT_SELF, INVENTORIED, TRUE);
}
// See if a restock is currently on delay.
if ( !GetLocalInt(OBJECT_SELF, RESTOCK_ORDERED) )
{
// Determine the restock times (possibly stored locally).
int nRestockHours = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_FIXED");
if ( nRestockHours == 0 )
nRestockHours = RESTOCK_TIME_FIXED;
int nRestockMinutes = GetLocalInt(OBJECT_SELF, "RESTOCK_TIME_VARIABLE");
if ( nRestockMinutes == 0 )
nRestockMinutes = RESTOCK_TIME_VARIABLE;
// Order (delay) a restock.
DelayCommand( TurnsToSeconds(60*nRestockHours + Random(nRestockMinutes+1)),
Restock());
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, TRUE);
}
}
//////////////////////////////////////////////////
// DoInventory()
//
// Records the store's current (starting) inventory.
//
void DoInventory()
{
// Record the store's current gold.
SetLocalInt(OBJECT_SELF, STORE_GOLD, GetStoreGold(OBJECT_SELF));
// Record the store's current inventory.
int nCount = 0;
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// Set a boolean flag based on the blueprint name.
SetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef, TRUE);
// Add sResRef to the list of blueprints.
SetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount), sResRef);
// Record the stack size.
SetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount), GetItemStackSize(oItem));
// Update the count.
nCount++;
}
// Next item.
oItem = GetNextItemInInventory();
}
// Record the length of the list of blueprints.
SetLocalInt(OBJECT_SELF, INVENTORY_SIZE, nCount);
}
//////////////////////////////////////////////////
// Restock()
//
// Restocks the store.
//
void Restock()
{
// Check the store's gold.
int nCurGold = GetStoreGold(OBJECT_SELF);
// We are only concerned if the store has limited gold.
if ( nCurGold > -1 )
{
// Determine the min and max gold fractions (possibly stored locally).
float fGoldMin = GetLocalFloat(OBJECT_SELF, "GOLD_MIN_FRACTION");
if ( fGoldMin == 0.0 )
fGoldMin = GOLD_MIN_FRACTION;
float fGoldMax = GetLocalFloat(OBJECT_SELF, "GOLD_MAX_FRACTION");
if ( fGoldMax == 0.0 )
fGoldMax = GOLD_MAX_FRACTION;
// Calculate the minimum and maximum gold levels.
int nOrigGold = GetLocalInt(OBJECT_SELF, STORE_GOLD);
int nMinGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMin);
int nMaxGold = FloatToInt(IntToFloat(nOrigGold) * fGoldMax);
// Check for too little gold.
if ( nCurGold < nMinGold )
SetStoreGold(OBJECT_SELF, nMinGold);
// Check for too much gold.
else if ( nCurGold > nMaxGold )
SetStoreGold(OBJECT_SELF, nMaxGold);
}
// Determine the unstock chance (possibly stored locally).
int nUnstockChance = GetLocalInt(OBJECT_SELF, "UNSTOCK_CHANCE");
if ( nUnstockChance == 0 )
nUnstockChance = UNSTOCK_CHANCE;
// Scan the store's current inventory.
// Record which original items are still around.
// Possibly remove non-original items.
object oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
// We are only concerned with items in finite supply.
if ( !GetInfiniteFlag(oItem) )
{
string sResRef = GetResRef(oItem);
// See if this item is an original item.
if ( GetLocalInt(OBJECT_SELF, ORIG_INVENTORY + sResRef) )
{
// Set a boolean flag (temporarily) based on the blueprint name.
SetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef, TRUE);
DelayCommand(0.0, DeleteLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef));
}
// See if this (not original) item should be removed.
else if ( d100() <= nUnstockChance )
// Delete this item.
DestroyObject(oItem);
}
// Next item.
oItem = GetNextItemInInventory();
}
// Determine the restock chance (possibly stored locally).
int nRestockChance = GetLocalInt(OBJECT_SELF, "RESTOCK_CHANCE");
if ( nRestockChance == 0 )
nRestockChance = RESTOCK_CHANCE;
// Loop through the list of items that might be restored.
int nCount = GetLocalInt(OBJECT_SELF, INVENTORY_SIZE);
while ( nCount-- > 0 )
{
string sResRef = GetLocalString(OBJECT_SELF, INVENTORY_LIST + IntToString(nCount));
// Make sure no items of this type are in the store's inventory (before this loop).
if ( !GetLocalInt(OBJECT_SELF, CUR_INVENTORY + sResRef) )
// See if this item should be restocked.
if ( d100() <= nRestockChance )
// Add this item to the store.
CreateItemOnObject(sResRef, OBJECT_SELF,
GetLocalInt(OBJECT_SELF, INVENTORY_STACK + IntToString(nCount)));
}
// Restocking is no longer in progress.
SetLocalInt(OBJECT_SELF, RESTOCK_ORDERED, FALSE);
}

View File

@@ -0,0 +1,644 @@
/*/////////////////////// [On Spawn] ///////////////////////////////////////////
Filename: J_AI_OnSpawn or nw_c2_default9
///////////////////////// [On Spawn] ///////////////////////////////////////////
This file contains options that will determine some AI behaviour, and a lot
of toggles for turning things on/off. A big read, but might be worthwhile.
The documentation is actually fully in the readme files, under the name
"On Spawn.html", under "AI File Explanations".
The order of the options:
- Important Spawn Settings N/A
- Targeting & Fleeing (AI_TARGETING_FLEE_MASTER)
- Fighting & Spells (AI_COMBAT_MASTER)
- Other Combat - Healing, Skills & Bosses (AI_OTHER_COMBAT_MASTER)
- Other - Death corpses, minor things (AI_OTHER_MASTER)
- User Defined (AI_UDE_MASTER)
- Shouts N/A
- Default Bioware settings (WP's, Anims) (NW_GENERIC_MASTER)
The OnSpawn file is a settings file. These things are set onto a creature, to
define cirtain actions. If more than one creature has this script, they all
use the settings, unless If/Else statements are used somehow. There is also
the process of setting any spells/feats availible, and hiding and walk waypoints
are started.
Other stuff:
- Targeting is imporant :-D
- If you delete this script, there is a template for the On Spawn file
in the zip it came in, for use in the "scripttemplate" directory.
///////////////////////// [History] ////////////////////////////////////////////
Note: I have removed:
- Default "Teleporting" and exit/return (this seemed bugged anyway, or useless)
- Spawn in animation. This can be, of course, re-added.
- Day/night posting. This is uneeded, with a changed walk waypoints that does it automatically.
1.0-1.2 - Used short amount of spawn options.
1.3 - All constants names are changed, I am afraid.
- Added Set/Delete/GetAIInteger/Constant/Object. This makes sure that the AI
doesn't ever interfere with other things - it pre-fixes all stored things
with AI_INTEGER_ (and so on)
1.4 - TO DO: Clear up some old non-working ones
- Added in User Defined part of the script, an auto-turn-off-spells for
Ranger and Paladin classes. Need to test - perhaps 1.64 fixed it?
Spawn options changed:
- Removed AI level settings (can still be done manually)
- Added optional (and off by default) fear-visual for fleeing
///////////////////////// [Workings] ///////////////////////////////////////////
Note: You can do without all the comments (it may be that you don't want
the extra KB it adds or something, although it does not at all slow down a module)
so as long as you have these at the end:
AI_SetUpEndOfSpawn();
DelayCommand(2.0, SpawnWalkWayPoints());
Oh, and the include file (Below, "j_inc_spawnin") must be at the top like
here. Also recommended is the AI_INTELLIGENCE and AI_MORALE being set (if
not using custom AI).
///////////////////////// [Arguments] //////////////////////////////////////////
Arguments: GetIsEncounterCreature
///////////////////////// [On Spawn] /////////////////////////////////////////*/
// Treasure Includes - See end of spawn for uncomment options.
//#include "nw_o2_coninclude"
// Uncomment this if you want default NwN Treasure - Uses line "GenerateNPCTreasure()" at the end of spawn.
// - This generates random things from the default pallet based on the creatures level + race
//#include "x0_i0_treasure"
// Uncomment this if you want the SoU Treasure - Uses line "CTG_GenerateNPCTreasure()" at the end of spawn.
// - This will spawn treasure based on chests placed in the module. See "x0_i0_treasure" for more information.
// This is required for all spawn in options!
#include "J_INC_SPAWNIN"
void main()
{
/************************ [Important Spawn Settings] **************************/
SetAIInteger(AI_INTELLIGENCE, 10);
// Intelligence value of the creauture. Can be 1-10, read readme's for help.
SetAIInteger(AI_MORALE, 10);
// Will save (See readme). Remember: -1 or below means they always flee.
//SetCustomAIFileName("CUSTOM_AI_FILE");
// Sets our custom AI file. Really, only animation settings will apply when this is set.
// - Can sort actions against a imputted target (EG: On Percieved enemy) by
// "GetLocalObject(OBJECT_SELF, "AI_TEMP_SET_TARGET");"
/************************ [Important Spawn Settings] **************************/
/************************ [Targeting] ******************************************
All targeting settings.
************************* [Targeting] *****************************************/
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_LOWER_HP, AI_TARGETING_FLEE_MASTER);
// We only attack the lowest current HP.
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_LOWER_AC, AI_TARGETING_FLEE_MASTER);
// We only attack the lowest AC (as in 1.2).
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_LOWER_HD, AI_TARGETING_FLEE_MASTER);
// Target the lowest hit dice
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_MAGE_CLASSES, AI_TARGETING_FLEE_MASTER);
// We go straight for mages/sorcerors. Nearest one.
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_ARCHERS, AI_TARGETING_FLEE_MASTER);
// We go for the nearest enemy with a ranged weapon equipped.
//SetSpawnInCondition(AI_FLAG_TARGETING_LIKE_PCS, AI_TARGETING_FLEE_MASTER);
// We go for the nearest seen PC enemy.
//SetAIConstant(AI_FAVOURED_ENEMY_RACE, RACIAL_TYPE_HUMAN);
// The AI attacks the nearest enemy, seen, of this race. Use the RACIAL_* constants.
//SetAIConstant(AI_FAVOURED_ENEMY_CLASS, CLASS_TYPE_BARD);
// The AI attacks the nearest enemy, seen, of this class. Use the CLASS_* constants.
// Target changing - see readme for info.
//SetAIInteger(AI_MAX_TURNS_TO_ATTACK_ONE_TARGET, 6);
// Maximum rounds to attack the current target, before re-checking.
// % Chance to re-set each target type each round (Could result in current target still)
//SetAIInteger(AI_MELEE_LAST_TO_NEW_TARGET_CHANCE, 20);
//SetAIInteger(AI_RANGED_LAST_TO_NEW_TARGET_CHANCE, 20);
//SetAIInteger(AI_SPELL_LAST_TO_NEW_TARGET_CHANCE, 20);
// We only target PC's if there are any in range if this is set
//SetSpawnInCondition(AI_FLAG_TARGETING_FILTER_FOR_PC_TARGETS, AI_TARGETING_FLEE_MASTER);
// Main explanation of AI_SetAITargetingValues, see the AI readme (spawn file)
// - Remember, uncommenting one will just ignore it (so will never check target's
// AC without TARGETING_AC on)
AI_SetAITargetingValues(TARGETING_MANTALS, TARGET_LOWER, 1, 12);
// Spell mantals are checked only for the spell target. Either Absense of or got any.
AI_SetAITargetingValues(TARGETING_RANGE, TARGET_HIGHER, 2, 9);
// Range - very imporant! Basis for all ranged/spell attacks.
AI_SetAITargetingValues(TARGETING_AC, TARGET_LOWER, 2, 6);
// AC is used for all phisical attacks. Lower targets lower (By default).
AI_SetAITargetingValues(TARGETING_SAVES, TARGET_LOWER, 2, 4);
// Used for spell attacks. Saves are sorta a AC versus spells.
// Phisical protections. Used by spells, ranged and melee.
// Jasperre - simple check if we are a fighter (hit lower phisicals) or a
// mage (attack higher!)
if(GetBaseAttackBonus(OBJECT_SELF) > ((GetHitDice(OBJECT_SELF)/2) + 1))
{
// Fighter/Clerics (It is over a mages BAB + 1 (IE 0.5 BAB/Level) target lower
AI_SetAITargetingValues(TARGETING_PHISICALS, TARGET_LOWER, 2, 6);
}
else
{
// Mages target higher (so dispel/elemental attack those who fighters
// cannot hit as much). (the lowest BAB, under half our hit dice in BAB)
AI_SetAITargetingValues(TARGETING_PHISICALS, TARGET_HIGHER, 1, 5);
}
// Base attack bonus. Used for spells and phisical attacks. Checked with GetBaseAttackBonus.
AI_SetAITargetingValues(TARGETING_BAB, TARGET_LOWER, 1, 4);
// Hit dice - how powerful in levels the enemy is. Used for all checks.
AI_SetAITargetingValues(TARGETING_HITDICE, TARGET_LOWER, 1, 3);
//AI_SetAITargetingValues(TARGETING_HP_PERCENT, TARGET_LOWER, 1, 3);
//AI_SetAITargetingValues(TARGETING_HP_CURRENT, TARGET_LOWER, 1, 3);
//AI_SetAITargetingValues(TARGETING_HP_MAXIMUM, TARGET_LOWER, 1, 3);
// The HP's are the last thing to choose a target with.
/************************ [Targeting] *****************************************/
/************************ [Fleeing] ********************************************
Fleeing - these are toggled on/off by FEARLESS flag.
3 or under intelligence will just run away. 4 or more will know where allies
are, and if there are none, will not run.
************************* [Fleeing] *******************************************/
SetSpawnInCondition(AI_FLAG_FLEEING_FEARLESS, AI_TARGETING_FLEE_MASTER);
// Forces them to not flee. This may be set with AI_SetMaybeFearless at the end.
//SetSpawnInCondition(AI_FLAG_FLEEING_NEVER_FIGHT_IMPOSSIBLE_ODDS, AI_TARGETING_FLEE_MASTER);
// This will make the creature never fight against impossible odds (8HD+ different)
//SetSpawnInCondition(AI_FLAG_FLEEING_TURN_OFF_GROUP_MORALE, AI_TARGETING_FLEE_MASTER);
// This turns OFF any sort of group morale bonuses.
//SetAIInteger(AMOUNT_OF_HD_DIFFERENCE_TO_CHECK, -2);
// If enemy is within this amount of HD, we do not check morale.
//SetAIInteger(BASE_MORALE_SAVE, 20);
// Base DC of the will save. It is set to 20 + HD difference - Morale - Group morale mod.
//SetAIInteger(HP_PERCENT_TO_CHECK_AT, 80);
// %HP needed to be at to check morale. This doesn't affect "Never fight impossible odds"
//SetSpawnInCondition(AI_FLAG_FLEEING_NO_OVERRIDING_HP_AMOUNT, AI_TARGETING_FLEE_MASTER);
// This will turn off overriding HP checks. AI may decide to run even
// not at the %HP above, this turns the checks off.
//SetAIInteger(AI_DAMAGE_AT_ONCE_FOR_MORALE_PENALTY, GetMaxHitPoints()/6);
// Damage needed to be done at once to get a massive morale penalty (Below)
//SetAIInteger(AI_DAMAGE_AT_ONCE_PENALTY, 6);
// Penalty for the above, set for some time to negativly affect morale. Added to save DC for fleeing.
//SetSpawnInCondition(AI_FLAG_FLEEING_FLEE_TO_NEAREST_NONE_SEEN, AI_TARGETING_FLEE_MASTER);
// If set, just runs to nearest non-seen ally, and removes the loop for a good group of allies to run to.
//SetSpawnInCondition(AI_FLAG_FLEEING_FLEE_TO_OBJECT, AI_TARGETING_FLEE_MASTER);
// They will flee to the nearest object of the tag below, if set.
//SetLocalString(OBJECT_SELF, AI_FLEE_OBJECT, "BOSS_TAG_OR_WHATEVER");
// This needs setting if the above is to work.
//SetSpawnInCondition(AI_FLAG_FLEEING_USE_VISUAL_EFFECT, AI_TARGETING_FLEE_MASTER);
// If this is on, we play a visual effect while we flee.
/************************ [Fleeing] *******************************************/
/************************ [Combat - Fighters] **********************************
Fighter (Phiscal attacks, really) specific stuff - disarmed weapons, better
at hand to hand, and archer behaviour.
************************* [Combat - Fighters] *********************************/
SetSpawnInCondition(AI_FLAG_COMBAT_PICK_UP_DISARMED_WEAPONS, AI_COMBAT_MASTER);
// This sets to pick up weapons which are disarmed.
//SetAIInteger(AI_RANGED_WEAPON_RANGE, 3);
// This is the range at which they go into melee (from using a ranged weapon). Default is 3 or 5.
//SetSpawnInCondition(AI_FLAG_COMBAT_BETTER_AT_HAND_TO_HAND, AI_COMBAT_MASTER);
// Set if you want them to move forwards into HTH sooner. Will always
// if the enemy is a mage/archer, else % based on range.
//SetSpawnInCondition(AI_FLAG_COMBAT_ARCHER_ATTACKING, AI_COMBAT_MASTER);
// For archers. If they have ally support, they'd rather move back & shoot then go into HTH.
//SetSpawnInCondition(AI_FLAG_COMBAT_ARCHER_ALWAYS_MOVE_BACK, AI_COMBAT_MASTER);
// This forces the move back from attackers, and shoot bows. Very small chance to go melee.
//SetSpawnInCondition(AI_FLAG_COMBAT_ARCHER_ALWAYS_USE_BOW, AI_COMBAT_MASTER);
// This will make the creature ALWAYs use any bows it has. ALWAYS.
//SetSpawnInCondition(AI_FLAG_COMBAT_NO_GO_FOR_THE_KILL, AI_COMBAT_MASTER);
// Turns off any attempts to kill dying PCs, or attack low hit point people.
// This is only ever attempted at 9 or 10 intelligence anyway.
/************************ [Combat - Fighters] *********************************/
/************************ [Combat - Spell Casters] *****************************
Spellcaster AI has been improved significantly. As well as adding all new spells,
now spellcasters more randomly choose spells from the same level (EG: they
may choose not to cast magic missile, and cast negative energy ray instead).
There are also options here for counterspelling, fast buffing, Cheat cast spells,
dispelling, spell triggers, long ranged spells first, immunity toggles, and AOE settings.
************************* [Combat - Spell Casters] ****************************/
//SetSpawnInCondition(AI_FLAG_COMBAT_LONGER_RANGED_SPELLS_FIRST, AI_COMBAT_MASTER);
// Casts spells only if the caster would not move into range to cast them.
// IE long range spells, then medium, then short (unless the enemy comes to us!)
//SetSpawnInCondition(AI_FLAG_COMBAT_FLAG_FAST_BUFF_ENEMY, AI_COMBAT_MASTER);
// When an enemy comes in 40M, we fast-cast many defensive spells, as if prepared.
//SetSpawnInCondition(AI_FLAG_COMBAT_SUMMON_FAMILIAR, AI_COMBAT_MASTER);
// The caster summons thier familiar/animal companion. Either a nameless Bat or Badger respectivly.
// Counterspelling/Dispelling...
// It checks for these classes within the 20M counterspell range.
//SetSpawnInCondition(AI_FLAG_COMBAT_COUNTER_SPELL_ARCANE, AI_COMBAT_MASTER);
// If got dispels, it counterspells Arcane (Mage/Sorceror) spellcasters.
//SetSpawnInCondition(AI_FLAG_COMBAT_COUNTER_SPELL_DIVINE, AI_COMBAT_MASTER);
// If got dispels, it counterspells Divine (Cleric/Druid) spellcasters.
//SetSpawnInCondition(AI_FLAG_COMBAT_COUNTER_SPELL_ONLY_IN_GROUP, AI_COMBAT_MASTER);
// Recommended. Only counterspells with 5+ allies in group.
//SetSpawnInCondition(AI_FLAG_COMBAT_DISPEL_MAGES_MORE, AI_COMBAT_MASTER);
// Targets seen mages to dispel, else uses normal spell target.
SetSpawnInCondition(AI_FLAG_COMBAT_DISPEL_IN_ORDER, AI_COMBAT_MASTER);
// This will make the mage not dispel just anything all the time, but important (spell-stopping)
// things first, others later, after some spells. If off, anything is dispelled.
// AOE's
//SetSpawnInCondition(AI_FLAG_COMBAT_NEVER_HIT_ALLIES, AI_COMBAT_MASTER);
// Override toggle. Forces to never cast AOE's if it will hit an ally + harm them.
//SetSpawnInCondition(AI_FLAG_COMBAT_AOE_DONT_MIND_IF_THEY_SURVIVE, AI_COMBAT_MASTER);
// Allies who will survive the blast are ignored for calculating best target.
//SetAIInteger(AI_AOE_ALLIES_LOWEST_IN_AOE, 3);
// Defualt: 3. If amount of allies in blast radius are equal or more then
// this, then that location is ignored.
//SetAIInteger(AI_AOE_HD_DIFFERENCE, -8);
// Very weak allies (who are not comparable to us) are ignored if we would hit them.
// For these 2, if neither are set, the AI will choose AOE more if there are
// lots of enemies, or singles if there are not many.
//SetSpawnInCondition(AI_FLAG_COMBAT_SINGLE_TARGETING, AI_COMBAT_MASTER);
// For Same-level spells, single target spells are used first.
//SetSpawnInCondition(AI_FLAG_COMBAT_MANY_TARGETING, AI_COMBAT_MASTER);
// For Same-level spells, AOE spells are used first.
SetSpawnInCondition(AI_FLAG_COMBAT_IMPROVED_INSTANT_DEATH_SPELLS, AI_COMBAT_MASTER);
// A few Death spells may be cast top-prioritory if the enemy will always fail saves.
SetSpawnInCondition(AI_FLAG_COMBAT_IMPROVED_SUMMON_TARGETING, AI_COMBAT_MASTER);
// Will use a better target to summon a creature at (EG: Ranged attacker)
SetSpawnInCondition(AI_FLAG_COMBAT_IMPROVED_IMMUNITY_CHECKING, AI_COMBAT_MASTER);
// Turns On "GetIsImmune" checks. Auto on for 7+ Intel.
SetSpawnInCondition(AI_FLAG_COMBAT_IMPROVED_SPECIFIC_SPELL_IMMUNITY, AI_COMBAT_MASTER);
// Turns On checks for Globes & levels of spells. Auto on for 9+ Intel.
//SetSpawnInCondition(AI_FLAG_COMBAT_MORE_ALLY_BUFFING_SPELLS, AI_COMBAT_MASTER);
// This will make the caster buff more allies - or, in fact, use spells
// to buff allies which they might have not used before.
//SetSpawnInCondition(AI_FLAG_COMBAT_USE_ALL_POTIONS, AI_COMBAT_MASTER);
// Uses all buffing spells before melee.
//SetAICheatCastSpells(SPELL_MAGIC_MISSILE, SPELL_ICE_DAGGER, SPELL_HORIZIKAULS_BOOM, SPELL_MELFS_ACID_ARROW, SPELL_NEGATIVE_ENERGY_RAY, SPELL_FLAME_ARROW);
// Special: Mages cast for ever with this set.
// Spell triggers
//SetSpellTrigger(SPELLTRIGGER_NOT_GOT_FIRST_SPELL, FALSE, 1, SPELL_PREMONITION);
// This is just an example. See readme for more info.
/************************ [Combat - Spell Casters] ****************************/
/************************ [Combat - Dragons] ***********************************
I have a fondness for dragons - in NWN they are deprived of many abilities. Here
are some new ones for your enjoyment! Switches and flying for ANYTHING! :-)
************************* [Combat - Dragons] **********************************/
//SetSpawnInCondition(AI_FLAG_COMBAT_NO_WING_BUFFET, AI_COMBAT_MASTER);
//This sets so there is no Dragon wing buffet. Readme has details of it.
//SetAIInteger(AI_DRAGON_FREQUENCY_OF_BUFFET, 3);
// Min. Amount of Rounds between each buffet. See readme for counter defaults. Def: 3
//SetAIInteger(AI_DRAGON_FREQUENCY_OF_BREATH, 3);
// Min. Amount of Rounds between each breath use. See readme for counter defaults. Def: 3
// Default checks for dragon flying automatic turning on of flying.
if(GetLevelByClass(CLASS_TYPE_DRAGON) || GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DRAGON)
{
SetSpawnInCondition(AI_FLAG_COMBAT_FLYING, AI_COMBAT_MASTER);
// This turns ON combat flying. I think anything winged looks A-OK. See readme for info.
}
/************************ [Combat - Dragons] **********************************/
/************************ [Combat Other - Healers/Healing] *********************
Healing behaviour - not specifically clerics. See readme.
************************* [Combat Other - Healers/Healing] ********************/
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_HEAL_AT_PERCENT_NOT_AMOUNT, AI_OTHER_COMBAT_MASTER);
// if this is set, we ignore the amount we need to be damaged, as long
// as we are under AI_HEALING_US_PERCENT.
//SetAIInteger(AI_HEALING_US_PERCENT, 50);
// % of HP we need to be at until we heal us at all. Default: 50
//SetAIInteger(AI_HEALING_ALLIES_PERCENT, 60);
// % of HP allies would need to be at to heal them Readme = info. Default: 60
SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_WILL_RAISE_ALLIES_IN_BATTLE, AI_OTHER_COMBAT_MASTER);
// Turns on rasing dead with Resurrection/Raise dead.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_CURING, AI_OTHER_COMBAT_MASTER);
// This turns off all healing.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_ONLY_CURE_SELF, AI_OTHER_COMBAT_MASTER);
// This turns off ally healing.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_ONLY_RESTORE_SELF, AI_OTHER_COMBAT_MASTER);
// This turns off ally restoring (Remove/Restoration).
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_USE_BAD_HEALING_SPELLS, AI_OTHER_COMBAT_MASTER);
// This forces all cure spells to be used, check readme.
//SetAIInteger(SECONDS_BETWEEN_STATUS_CHECKS, 30);
// Seconds between when we loop everyone for bad effects like Fear/stun ETC. If not set, done each round.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_GIVE_POTIONS_TO_HELP, AI_OTHER_COMBAT_MASTER);
// ActionGiveItem standard healing potion's to allies who need them, if they possess them.
/************************ [Combat Other - Healers/Healing] ********************/
/************************ [Combat Other - Skills] ******************************
Skills are a part of fighting - EG Taunt. These are mainly on/off switches.
A creature will *may* use it if they are not set to "NO_" for the skill.
************************* [Combat Other - Skills] *****************************/
// "NO" - This is for forcing the skill NEVER to be used by the combat AI.
// "FORCE" - This forces it on (and to be used), except if they have no got the skill.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_PICKPOCKETING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_PICKPOCKETING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_TAUNTING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_TAUNTING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_EMPATHY, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_EMPATHY, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_HIDING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_HIDING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_OPENING_LOCKED_DOORS, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_OPENING_LOCKED_DOORS, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_USING_HEALING_KITS, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_PARRYING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_PARRYING, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_SEARCH, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_SEARCH, AI_OTHER_COMBAT_MASTER);
// - Concentration - special notes in the readme
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_NO_CONCENTRATION, AI_OTHER_COMBAT_MASTER);
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_FORCE_CONCENTRATION, AI_OTHER_COMBAT_MASTER);
/************************ [Combat Other - Skills] *****************************/
/************************ [Combat Other - Leaders] *****************************
Leaders/Bosses can be set to issue some orders and inspire more morale - and bring
a lot of allies to a battle at once!
************************* [Combat Other - Leaders] ****************************/
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_GROUP_LEADER, AI_OTHER_COMBAT_MASTER);
// Special leader. Can issuse some orders. See readme for details.
//SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_BOSS_MONSTER_SHOUT, AI_OTHER_COMBAT_MASTER);
// Boss shout. 1 time use - calls all creatures in X meters (below) for battle!
//SetAIInteger(AI_BOSS_MONSTER_SHOUT_RANGE, 60);
// Defaults to a 60 M range. This can change it. Note: 1 toolset square = 10M.
/************************ [Combat Other - Leaders] ****************************/
/************************ [Other - Behaviour/Generic] **************************
This is generic behaviours - alright, really it is all things that cannot
really be categorised.
************************* [Other - Behaviour/Generic] *************************/
//SetSpawnInCondition(AI_FLAG_OTHER_NO_CLEAR_ACTIONS_BEFORE_CONVERSATION, AI_OTHER_MASTER);
// No ClearAllActions() before BeginConversation. May keep a creature sitting.
//SetSpawnInCondition(AI_FLAG_OTHER_NO_POLYMORPHING, AI_OTHER_MASTER);
// This will stop all polymorphing spells feats from being used.
//SetSpawnInCondition(AI_FLAG_OTHER_CHEAT_MORE_POTIONS, AI_OTHER_MASTER);
// If at low HP, and no potion, create one and use it.
//SetAIConstant(AI_POLYMORPH_INTO, POLYMORPH_TYPE_WEREWOLF);
// Polymorph to this creature when damaged (once, natural effect).
//AI_CreateRandomStats(-3, 3, 6);
// Create (Effect-applied) random statistics.
//AI_CreateRandomOther(-2, 2, -2, 2, -2, 2, -2, 2);
// Create (Effect-applied) random HP, saves, AC.
//SetSpawnInCondition(AI_FLAG_OTHER_RETURN_TO_SPAWN_LOCATION, AI_OTHER_MASTER);
// This will store our spawn location, and then move back there after combat.
SetSpawnInCondition(AI_FLAG_OTHER_DONT_RESPOND_TO_EMOTES, AI_OTHER_MASTER);
// This will ignore ALL chat by PC's (Enemies) who speak actions in Stars - *Bow*
//SetSpawnInCondition(AI_FLAG_OTHER_DONT_SHOUT, AI_OTHER_MASTER);
// Turns off all silent talking NPC's do to other NPC's.
//SetSpawnInCondition(AI_FLAG_OTHER_SEARCH_IF_ENEMIES_NEAR, AI_OTHER_MASTER);
// Move randomly closer to enemies in range set below.
//SetAIInteger(AI_SEARCH_IF_ENEMIES_NEAR_RANGE, 25);
// This is the range creatures use, in metres.
//SetSpawnInCondition(AI_FLAG_OTHER_ONLY_ATTACK_IF_ATTACKED, AI_OTHER_MASTER);
// One shot. We won't instantly attack a creature we see. See readme.
//SetAIInteger(AI_DOOR_INTELLIGENCE, 1);
// 3 Special "What to do with Doors" settings. See readme. Good for animals.
//SetSpawnInCondition(AI_FLAG_OTHER_REST_AFTER_COMBAT, AI_OTHER_MASTER);
// When combat is over, creature rests. Useful for replenising health.
//SetSpawnInCondition(AI_FLAG_OTHER_NO_PLAYING_VOICE_CHAT, AI_OTHER_MASTER);
// Stops any use of "PlayVoiceChat". Use with Custom speakstrings.
/*** Death settings - still under AI_OTHER_MASTER ***/
//AI_SetDeathResRef("Resref Here");
// Creates a creature from the string set. Instantly destroys this creatures body on death.
//SetAIConstant(AI_DEATH_VISUAL_EFFECT, VFX_FNF_IMPLOSION);
// Fires this visual effect number instantly on death. Use FNF and IMP ones.
//SetAIInteger(AI_CORPSE_DESTROY_TIME, 30);
// Seconds before body finally gets destroyed. Used for Clerical Raise Dead on NPC's.
//SetSpawnInCondition(AI_FLAG_OTHER_TURN_OFF_CORPSES, AI_OTHER_MASTER);
// This turns off the SetDestroyable() usually performed, and the above timer.
//SetSpawnInCondition(AI_FLAG_OTHER_USE_BIOWARE_LOOTING, AI_OTHER_MASTER);
// Makes the death file use Bioware's cool SetLootable() feature when corpses would disappear.
/*** Lag and a few performance settings - still under AI_OTHER_MASTER ***/
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_NO_ITEMS, AI_OTHER_MASTER);
// The creature doesn't check for, or use any items that cast spells.
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_NO_SPELLS, AI_OTHER_MASTER);
//The creature doesn't ever cast spells (and never checks them)
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_NO_LISTENING, AI_OTHER_MASTER);
// The creature doesn't have SetListening() set. Turns of the basic listening for shouts.
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_EQUIP_MOST_DAMAGING, AI_OTHER_MASTER);
// Uses EquipMostDamaging(), like Bioware code. No shield/second weapon equipped.
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_NO_CURING_ALLIES, AI_OTHER_MASTER);
// This will stop checks for and curing of allies ailments.
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_IGNORE_HEARTBEAT, AI_OTHER_MASTER);
// Stops the heartbeat running (Except Pre-Heartbeat-event).
//SetSpawnInCondition(AI_FLAG_OTHER_LAG_TARGET_NEAREST_ENEMY, AI_OTHER_MASTER);
// Ignores targeting settings. VERY good for lag/bad AI. Attacks nearest seen enemy.
/************************ [Other - Behaviour/Generic] *************************/
/************************ [User Defined and Shouts] ****************************
The user defined events, set up to fire here.
- New "Start combat attack" and "End Combat Attack" events
- New "Pre" events. Use these to optionally stop a script from firing
under cirtain circumstances as well! (Read nw_c2_defaultd or j_ai_onuserdef)
(User Defined Event = UDE)
************************* [User Defined and Shouts] ***************************/
// This is REQUIRED if we use any Pre-events. If not there, it will default
// to the default User Defined Event script for the default AI.
SetCustomUDEFileName("k_ai_onuserdef");
//SetSpawnInCondition(AI_FLAG_UDE_HEARTBEAT_EVENT, AI_UDE_MASTER); // UDE 1001
//SetSpawnInCondition(AI_FLAG_UDE_HEARTBEAT_PRE_EVENT, AI_UDE_MASTER); // UDE 1021
//SetSpawnInCondition(AI_FLAG_UDE_PERCIEVE_EVENT, AI_UDE_MASTER); // UDE 1002
//SetSpawnInCondition(AI_FLAG_UDE_PERCIEVE_PRE_EVENT, AI_UDE_MASTER); // UDE 1022
//SetSpawnInCondition(AI_FLAG_UDE_END_COMBAT_ROUND_EVENT, AI_UDE_MASTER); // UDE 1003
//SetSpawnInCondition(AI_FLAG_UDE_END_COMBAT_ROUND_PRE_EVENT, AI_UDE_MASTER); // UDE 1023
//SetSpawnInCondition(AI_FLAG_UDE_ON_DIALOGUE_EVENT, AI_UDE_MASTER); // UDE 1004
//SetSpawnInCondition(AI_FLAG_UDE_ON_DIALOGUE_PRE_EVENT, AI_UDE_MASTER); // UDE 1024
//SetSpawnInCondition(AI_FLAG_UDE_ATTACK_EVENT, AI_UDE_MASTER); // UDE 1005
//SetSpawnInCondition(AI_FLAG_UDE_ATTACK_PRE_EVENT, AI_UDE_MASTER); // UDE 1025
//SetSpawnInCondition(AI_FLAG_UDE_DAMAGED_EVENT, AI_UDE_MASTER); // UDE 1006
//SetSpawnInCondition(AI_FLAG_UDE_DAMAGED_PRE_EVENT, AI_UDE_MASTER); // UDE 1026
//SetSpawnInCondition(AI_FLAG_UDE_DEATH_EVENT, AI_UDE_MASTER); // UDE 1007
//SetSpawnInCondition(AI_FLAG_UDE_DEATH_PRE_EVENT, AI_UDE_MASTER); // UDE 1027
//SetSpawnInCondition(AI_FLAG_UDE_DISTURBED_EVENT, AI_UDE_MASTER); // UDE 1008
//SetSpawnInCondition(AI_FLAG_UDE_DISTURBED_PRE_EVENT, AI_UDE_MASTER); // UDE 1028
//SetSpawnInCondition(AI_FLAG_UDE_RESTED_EVENT, AI_UDE_MASTER); // UDE 1009
//SetSpawnInCondition(AI_FLAG_UDE_RESTED_PRE_EVENT, AI_UDE_MASTER); // UDE 1029
//SetSpawnInCondition(AI_FLAG_UDE_SPELL_CAST_AT_EVENT, AI_UDE_MASTER); // UDE 1011
//SetSpawnInCondition(AI_FLAG_UDE_SPELL_CAST_AT_PRE_EVENT, AI_UDE_MASTER); // UDE 1031
//SetSpawnInCondition(AI_FLAG_UDE_ON_BLOCKED_EVENT, AI_UDE_MASTER); // UDE 1015
//SetSpawnInCondition(AI_FLAG_UDE_ON_BLOCKED_PRE_EVENT, AI_UDE_MASTER); // UDE 1035
//SetSpawnInCondition(AI_FLAG_UDE_COMBAT_ACTION_EVENT, AI_UDE_MASTER); // UDE 1012
// Fires when we have finnished all combat actions.
//SetSpawnInCondition(AI_FLAG_UDE_COMBAT_ACTION_PRE_EVENT, AI_UDE_MASTER); // UDE 1032
// This fires at the start of DetermineCombatRound() *IF they can do an action*.
//SetSpawnInCondition(AI_FLAG_UDE_DAMAGED_AT_1_HP, AI_UDE_MASTER); // UDE 1014
// Fires when we are damaged, and are at 1 HP. Use for immortal-flagged creatures.
/*** Speakstrings - as it were, said under cirtain conditions % chance each time ***/
//AI_SetSpawnInSpeakArray(AI_TALK_ON_CONVERSATION, 100, 4, "Hello there", "I hope you enjoy your stay", "Do you work here too?", "*Hic*");
// On Conversation - see readme. Replaces BeginConversation().
// Morale
//AI_SetSpawnInSpeakArray(AI_TALK_ON_MORALE_BREAK, 100, 3, "No more!", "I'm outta here!", "Catch me if you can!");
// Spoken at running point, if they run to a group of allies.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_CANNOT_RUN, 100, 3, "Never give up! Never surrender!", "I've no where to run, so make my day!", "RRRAAAAA!!!");
// Spoken at running point, if they can find no ally to run to, and 4+ Intelligence. See readme
//AI_SetSpawnInSpeakValue(AI_TALK_ON_STUPID_RUN, "Ahhhhgggg! NO MORE! Run!!");
// As above, when morale breaks + no ally, but they panic and run from enemy at 3 or less intelligence.
// Combat
//AI_SetSpawnInSpeakArray(AI_TALK_ON_COMBAT_ROUND_EQUAL, 5, 4, "Come on!", "You won't win!", "We are not equals! I am better!", "Nothing will stop me!");
//AI_SetSpawnInSpeakArray(AI_TALK_ON_COMBAT_ROUND_THEM_OVER_US, 5, 4, "I'll try! try! and try again!", "Tough man, are we?", "Trying out your 'skills'? Pathetic excuse!", "Nothing good will come from killing me!");
//AI_SetSpawnInSpeakArray(AI_TALK_ON_COMBAT_ROUND_US_OVER_THEM, 5, 4, "My strength is mighty then yours!", "You will definatly die!", "NO chance for you!", "No mercy! Not for YOU!");
// Spoken each DetermineCombatRound. % is /1000. See readme for Equal/Over/Under values.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_TAUNT, 100, 3, "You're going down!", "No need to think, let my blade do it for you!", "Time to meet your death!");
// If the creature uses thier skill, taunt, on an enemy this will be said.
// Event-driven.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_PERCIEVE_ENEMY, 70, 6, "Stand and fight, lawbreaker!", "Don't run from the law!", "I have my orders!", "I am ready for violence!", "CHARGE!", "Time you died!");
// This is said when they see/hear a new enemy, and start attacking them.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_DAMAGED, 20, 2, "Ouch, damn you!", "Haha! Nothing will stop me!");
// A random value is set to speak when damaged, and may fire same time as below ones.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_PHISICALLY_ATTACKED, 20, 2, "Hah! Mear weapons won't defeat me!", "Pah! You cannot defeat me with such rubbish!");
// This is said when an enemy attacks the creature with a melee/ranged weapon.
//AI_SetSpawnInSpeakArray(AI_TALK_ON_HOSTILE_SPELL_CAST_AT, 20, 2, "No one spell will stop me!", "Is that all you have!?!");
// This is said when an enemy attacks the creature with a hostile spell.
//AI_SetSpawnInSpeakValue(AI_TALK_ON_DEATH, "Agggggg!");
// This will ALWAYS be said, whenever the creature dies.
// Specific potion ones.
//AI_SetSpawnInSpeakValue(AI_TALK_WE_PASS_POTION, "Here! Catch!");
// This will be spoken when the creature passes a potion to an ally. See readme.
//AI_SetSpawnInSpeakValue(AI_TALK_WE_GOT_POTION, "Got it!");
// This will be spoken by the creature we pass the potion too, using AssignCommand().
// Leader ones
//AI_SetSpawnInSpeakValue(AI_TALK_ON_LEADER_SEND_RUNNER, "Quickly! We need help!");
// This will be said when the leader, if this creature, sends a runner.
//AI_SetSpawnInSpeakValue(AI_TALK_ON_LEADER_ATTACK_TARGET, "Help attack this target!");
// When the leader thinks target X should be attacked, it will say this.
//AI_SetSpawnInSpeakValue(AI_TALK_ON_LEADER_BOSS_SHOUT, "Come my minions! To battle!");
// This will be said when the leader, if this creature, sees an enemy and uses his "Boss Monster Shout", if turned on.
/************************ [User Defined and Shouts] ***************************/
/************************ [Bioware: Animations/Waypoints/Treasure] *************
All Bioware Stuff. I'd check out "x0_c2_spwn_def" for the SoU/Hordes revisions.
************************* [Bioware: Animations/Waypoints/Treasure] ************/
// SetSpawnInCondition(NW_FLAG_STEALTH, NW_GENERIC_MASTER);
// SetSpawnInCondition(NW_FLAG_SEARCH, NW_GENERIC_MASTER);
// Uses said skill while WalkWaypoints()
SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING, NW_GENERIC_MASTER);
// Separate the NPC's waypoints into day & night. See comment in "nw_i0_generic" for use.
// SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS, NW_GENERIC_MASTER);
// This will cause an NPC to use common animations it possesses,
// and use social ones to any other nearby friendly NPCs.
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, NW_GENERIC_MASTER);
// Same as above, except NPC will wander randomly around the area.
SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
// Interacts with placeables + More civilized actions. See Readme.
SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
// Will use random voicechats during animations, if Civilized
// SetAnimationCondition(NW_ANIM_FLAG_IS_MOBILE_CLOSE_RANGE);
// Will move around the area a bit more, if using Immobile Animations. See readme.
// Treasure generating.
//CTG_GenerateNPCTreasure();
// SoU. Requires "x0_i0_treasure" to be uncommented. See readme.
//GenerateNPCTreasure();
// Default NwN. Requires "nw_o2_coninclude" to be uncommented. See readme.
/************************ [Bioware: Animations/Waypoints/Treasure] ************/
// AI Behaviour. DO NOT CHANGE! DO NOT CHANGE!!!
AI_SetUpEndOfSpawn();
// This MUST be called. It fires these events:
// SetUpSpells, SetUpSkillToUse, SetListeningPatterns, SetWeapons, AdvancedAuras.
// These MUST be called! the AI might fail to work correctly if they don't fire!
/************************ [User] ***********************************************
This is the ONLY place you should add user things, on spawn, such as
visual effects or anything, as it is after SetUpEndOfSpawn. By default, this
does have encounter animations on. This is here, so is easily changed :-D
Be careful otherwise.
Notes:
- SetListening is already set to TRUE, unless AI_FLAG_OTHER_LAG_NO_LISTENING is on.
- SetListenPattern's are set from 0 to 7.
- You can use the wrappers AI_SpawnInInstantVisual and AI_SpawnInPermamentVisual
for visual effects (Instant/Permament as appropriate).
************************* [User] **********************************************/
// Example (and default) of user addition:
// - If we are from an encounter, set mobile (move around) animations.
if(GetIsEncounterCreature())
{
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, NW_GENERIC_MASTER);
}
// Leave this in if you use the variable for creature attacks, as for golems. Bioware's code.
int nNumber = GetLocalInt(OBJECT_SELF, "CREATURE_VAR_NUMBER_OF_ATTACKS");
if(nNumber > 0)
{
SetBaseAttackBonus(nNumber);
}
// If we are a ranger or paladin class, do not cast spells. This can be
// manually removed if wished. To get the spells they have working correctly,
// remove this, and use Monster Abilties instead of thier normal class spells.
// if(GetLevelByClass(CLASS_TYPE_RANGER) >= 1 || GetLevelByClass(CLASS_TYPE_PALADIN) >= 1)
// {
// SetSpawnInCondition(AI_FLAG_OTHER_LAG_NO_SPELLS, AI_OTHER_MASTER);
// }
/************************ [User] **********************************************/
// Note: You shouldn't really remove this, even if they have no waypoints.
DelayCommand(2.0, SpawnWalkWayPoints());
// Delayed walk waypoints, as to not upset instant combat spawning.
// This will also check if to change to day/night posts during the walking, no heartbeats.
}

View File

@@ -0,0 +1,198 @@
/*
Pstemarie: 12-23-2019
Generic Creature OnUserDefined Event Script
To use:
1. Set the creature to use the X2 Monster AI (scripts with the prefix
x2_def_****).
2. Set this script as the creature's OnUserDefined event handler.
3. Set an INT variable named "X2_USERDEFINED_ONSPAWN_EVENTS" with a
value of "2" on the creature.
4. Uncomment any desired special behavior under the PRE and POST-SPAWN
conditionals
Leeched from nw_c2_default9, nw_c2_herbivore, and x2_def_userdef - all (c) 2002-2004 Bioware
*/
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
#include "x0_i0_anims"
void main()
{
int nEvent = GetUserDefinedEventNumber();
if (nEvent == EVENT_USER_DEFINED_PRESPAWN)
{
}
else if (nEvent == EVENT_USER_DEFINED_POSTSPAWN)
{
//----------------------------------------------------------------------
// OPTIONAL BEHAVIORS (Comment In or Out to Activate )
//SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);
//SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);
//* This causes the creature to say a special greeting in their conversation file
//* upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired
//* greeting in order to designate it. As the creature is actually saying this to
//* himself, don't attach any player responses to the greeting.
//SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
//* This will set the listening pattern on the NPC to attack when allies call
//SetSpawnInCondition(NW_FLAG_STEALTH);
//* If the NPC has stealth and they are a rogue go into stealth mode
//SetSpawnInCondition(NW_FLAG_SEARCH);
//* If the NPC has Search go into Search Mode
//SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
//* This will set the NPC to give a warning to non-enemies before attacking
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//* If this is set, the NPC will appear using the "EffectAppear" animation instead of fading in.
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//* This will play Ambient Animations until the NPC sees an enemy or is cleared.
//* NOTE: These animations will play automatically for Encounter Creatures.
//SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//* This will play Ambient Animations until the NPC sees an enemy or is cleared.
//* NOTE: NPCs using this form of ambient animations will not move to other NPCs.
//----------------------------------------------------------------------
// ANIMATION SETTINGS
/*
These are extra conditions you can put on creatures using ambient animations - either
NW_FLAG_AMBIENT_ANIMATIONS or NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS.
*/
SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
//* Civilized creatures interact with placeables in their area that have the tag "NW_INTERACTIVE"
//* and "talk" to each other.
//*
//* Humanoid races are civilized by default, so only set this flag for monster races that you want to
//* behave the same way.
//SetAnimationCondition(NW_ANIM_FLAG_CONSTANT);
//* If this flag is set, this creature will constantly be acting. Otherwise, creatures will only start
//* performing their ambient animations when they first perceive a player, and they will stop when the
//* player moves away.
SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
//* Civilized creatures with this flag set will randomly use a few voicechats. It's a good idea to avoid
//* putting this on multiple creatures using the same voiceset.
//SetAnimationCondition(NW_ANIM_FLAG_IS_MOBILE_CLOSE_RANGE);
//* Creatures with _immobile_ ambient animations can have this flag set to make them mobile in close
//* range. They will never leave their immediate area, but will move around in it, frequently returning
//* to their starting point.
//*
//* NOTE: Creatures spawned inside interior areas that contain a waypoint with one of the tags "NW_HOME",
//* "NW_TAVERN", and "NW_SHOP" will automatically have this condition set.
//----------------------------------------------------------------------
// SPECIAL BEHAVIOR SECTION
/*
The following section outlines the various special behaviors that can be placed on a creature.
To activate one of the special behaviors:
1. Comment in SetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL);
2. Comment in ONE other special behavior setting (ONLY ONE).
*/
//SetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL);
//* OPTIONAL SPECIAL BEHAVIORS - ONLY ONE OF THESE SHOULD BE SET AT A TIME
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN);
//* Flee to a waypoint and return a short time later.
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE);
//* Flee to a waypoint and do not return.
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE);
//* Teleport to a waypoint and do not return.
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN);
//* Teleport to a waypoint and return a short time later.
//SetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE);
//* Will only attack those that close within 5m and are not friends, Rangers or Druids.
//SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
//* Will flee those that close within 7m if they are not friends, Rangers or Druids.
//SetCombatCondition(X0_COMBAT_FLAG_RANGED);
//* Ranged Attacker: Will attempt to stay at ranged distance from their target.
//SetCombatCondition(X0_COMBAT_FLAG_DEFENSIVE);
//* Defensive Attacker: Will use defensive combat feats and parry
//SetCombatCondition(X0_COMBAT_FLAG_AMBUSHER);
//* Ambusher: Will go stealthy/invisible and attack, then run away and try to go stealthy
//* again before attacking anew.
SetCombatCondition(X0_COMBAT_FLAG_COWARDLY);
// * Cowardly: Will attempt to flee attackers.
//----------------------------------------------------------------------
// CUSTOM USER DEFINED EVENTS
/*
The following settings will allow the user to fire one of the blank user defined events in
the NW_D2_DefaultD. Like the On Spawn In script this script is meant to be customized by
the end user to allow for unique behaviors. The user defined events are 1001 - 1007, and
1510 and 1511.
*/
//SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001
//SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002
//SetSpawnInCondition(NW_FLAG_ATTACK_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005
//SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006
//SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008
//SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003
//SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004
//SetSpawnInCondition(NW_FLAG_DEATH_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007
}
else if(nEvent == EVENT_HEARTBEAT ) //HEARTBEAT
{
}
else if(nEvent == EVENT_PERCEIVE) // PERCEIVE
{
}
else if(nEvent == EVENT_END_COMBAT_ROUND) // END OF COMBAT
{
}
else if(nEvent == EVENT_DIALOGUE) // ON DIALOGUE
{
}
else if(nEvent == EVENT_ATTACKED) // ATTACKED
{
}
else if(nEvent == EVENT_DAMAGED) // DAMAGED
{
}
else if(nEvent == 1007) // DEATH - do not use for critical code, does not fire reliably all the time
{
}
else if(nEvent == EVENT_DISTURBED) // DISTURBED
{
}
}

View File

@@ -35,6 +35,12 @@ void main()
int bNameChance = d100() > 33;
SetLocalInt(OBJECT_SELF, "NAME_TYPE", bNameChance);
int nOneName = GetLocalInt(OBJECT_SELF,"SINGLE_NAME");
if (nOneName != 1)
{
SetLocalInt(OBJECT_SELF, "NAME_TYPE", 0);
}
//Calls the Random Name Generator
ms_Nomenclature(OBJECT_SELF);
@@ -60,10 +66,17 @@ void main()
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//This will play Ambient Animations until the NPC sees an enemy or is cleared.
//NOTE that these animations will play automatically for Encounter Creatures.
SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
// Interacts with placeables + More civilized actions. See Readme.
SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
// Will use random voicechats during animations, if Civilized
// NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)

View File

@@ -0,0 +1,122 @@
//::///////////////////////////////////////////////
//:: Dying Script
//:: ar_mod_ondying
//::
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player is dying.
*/
//:://////////////////////////////////////////////
void StripPlayer(object oPlayer)
{
object oPlayer = GetLastPlayerDying();
object oLootChest = GetObjectByTag("PLC_ALK_PC_LOOT");
object oArms = GetItemInSlot(INVENTORY_SLOT_ARMS , oPlayer);
object oArrows = GetItemInSlot(INVENTORY_SLOT_ARROWS , oPlayer);
object oBelt = GetItemInSlot(INVENTORY_SLOT_BELT , oPlayer);
object oBolts = GetItemInSlot(INVENTORY_SLOT_BOLTS , oPlayer);
object oBoots = GetItemInSlot(INVENTORY_SLOT_BOOTS , oPlayer);
object oBullets = GetItemInSlot(INVENTORY_SLOT_BULLETS , oPlayer);
object oChest = GetItemInSlot(INVENTORY_SLOT_CHEST , oPlayer);
object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK , oPlayer);
object oHead = GetItemInSlot(INVENTORY_SLOT_HEAD , oPlayer);
object oLeftHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND , oPlayer);
object oLeftRing = GetItemInSlot(INVENTORY_SLOT_LEFTRING , oPlayer);
object oNeck = GetItemInSlot(INVENTORY_SLOT_NECK , oPlayer);
object oRightHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND , oPlayer);
object oRightRing = GetItemInSlot(INVENTORY_SLOT_RIGHTRING , oPlayer);
// Removing PC's equipment
AssignCommand(oLootChest, ActionTakeItem(oArms, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oArrows, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oBelt, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oBolts, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oBoots, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oBullets, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oChest, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oCloak, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oHead, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oLeftHand, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oLeftRing, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oNeck, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oRightHand, oPlayer));
AssignCommand(oLootChest, ActionTakeItem(oRightRing, oPlayer));
// Removing PC's inventory
object oStuff = GetFirstItemInInventory(oPlayer);
while(GetIsObjectValid(oStuff))
{
AssignCommand(oLootChest, ActionTakeItem(oStuff, oPlayer));
oStuff = GetNextItemInInventory(oPlayer);
}
// Removing PC's money
AssignCommand(oLootChest, DelayCommand(0.0f, TakeGoldFromCreature(GetGold(oPlayer), oPlayer, FALSE)));
}
void main()
{
//Initialize objects, variables and effects.
object oPlayer = GetLastPlayerDying();
object oAttacker = GetLastAttacker(oPlayer);
object oTarget = GetWaypointByTag("WP_CAPTURED"); //or whatever the tag is for your destination waypoint
int iHPs = GetCurrentHitPoints(oPlayer);
effect eTeleport= EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eHeal = EffectHeal(20);
effect eGive1HP = EffectHeal(abs(iHPs)+1);
effect eDeath = EffectDeath(FALSE, FALSE);
string sMessage;
switch (d10())
{
case 1: sMessage = "I am gravely wounded."; break;
case 2: sMessage = "Need assistance."; break;
case 3: sMessage = "Water..."; break;
case 4: sMessage = "Ugh...Ahhh...Gah..."; break;
case 5: sMessage = "Help."; break;
case 6: sMessage = "Medic."; break;
case 7: sMessage = "Wow I suck!"; break;
case 8: sMessage = "Mmm... this sand is delicious."; break;
case 9: sMessage = "I always wanted to spend more time on my back."; break;
case 10: sMessage = "Wait... I lagged!"; break;
}
AssignCommand(oPlayer, ClearAllActions());
AssignCommand(oPlayer, SpeakString(sMessage));
if (GetTag(GetArea(oPlayer)) == "CARAVAN001")
{
//Main condition, If the Player is between 0 and -20 HPs they are "captured" and placed in a jail cell.
//...otherwise make them die.
if (iHPs >= -20)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer);
AssignCommand(oPlayer, JumpToObject(oTarget));
// Remove & store all of PCs gear & money
StripPlayer(oPlayer);
//Stop the NPC from attacking the player
SetPCLike(oPlayer, oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPlayer);
}
else
{
//Make the Player die if at -20 or below.
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPlayer);
}
}
if (GetTag(GetArea(oPlayer)) != "TyrSSArena")
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHitPointChangeWhenDying(-1.0), oPlayer, 0.0f);
else
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(FALSE, FALSE), oPlayer);
}

View File

@@ -445,13 +445,30 @@ void main()
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
// Check for randomizations.
ms_Nomenclature(OBJECT_SELF);
int nKeepskin = GetLocalInt(OBJECT_SELF,"RA_KEEPSKIN");
if (nKeepskin != 1)
{
rnd_skin(OBJECT_SELF);
}
rnd_skin(OBJECT_SELF);
rnd_head(OBJECT_SELF);
int nKeephead = GetLocalInt(OBJECT_SELF,"RA_KEEPHEAD");
if (nKeephead != 1)
{
rnd_head(OBJECT_SELF);
}
int nKeeptats = GetLocalInt(OBJECT_SELF,"RA_KEEPTATS");
if (nKeeptats != 1)
{
rnd_tattoo(OBJECT_SELF);
}
rnd_tattoo(OBJECT_SELF);
// Execute default OnSpawn script.
ExecuteScript("nw_c2_default9", OBJECT_SELF);