Module update.

More NPCs & stores spawning instead of placed.  Door scripts added.  Change all random commoners & nobles over to X2 AI scripts.
This commit is contained in:
Jaysyn904
2021-09-06 01:12:39 -04:00
parent cdcc1c579c
commit 4b6d20bbc2
102 changed files with 35740 additions and 90134 deletions

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (GetItemPossessedBy(oPC, "teleportationsto") != OBJECT_INVALID) return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,11 @@
// Put this script OnOpen.
void main()
{
DelayCommand(10.0, ActionCloseDoor(OBJECT_SELF));
}

View File

@@ -0,0 +1,11 @@
// Put this script OnOpen.
void main()
{
DelayCommand(20.0, ActionCloseDoor(OBJECT_SELF));
}

View File

@@ -0,0 +1,8 @@
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (!GetIsDay()) return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,8 @@
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (GetIsDay()) return FALSE;
return TRUE;
}

View File

@@ -21,6 +21,7 @@
//:: Created On: January 23 2012
//:://////////////////////////////////////////////
#include "nw_i0_plot"
#include "x0_i0_position"
void main()
@@ -73,8 +74,8 @@ void main()
if (GetObjectType(oStore) == OBJECT_TYPE_STORE)
{
//:: Open store for PC in conversation.
DelayCommand(1.0, OpenStore(oStore, oBuyer));
//:: Open store for PC in conversation with an appraise check.
DelayCommand(1.0, gplotAppraiseOpenStore(oStore, oBuyer));
}
else

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////
/*
Generic door OnFailToOpen event
- if the tag of the door is "barred" when this
event fires, the door will speak the string
"The door is barred from the other side"
-If a LocalInt "GREETING" is assigned to the door
and is TRUE,
a). the event starts a conversation using the
door's tag as the resref for the dialog.
ie: If the door's tag is Door01, save the conversation file
as door01. To avoid any potential glitches, the door's
tag should probably be all lower case.
b). SetLocalObject(oPC,"oDoor",OBJECT_SELF); is used
so GetLocalObject can be used as a reference within
the conversation. The following shoule be included
in the door's dialog OnConversation End Event;
object oPC = GetPCSpeaker();
DeleteLocalObject(oPC,"oDoor");
*/
////////////////////////////////////////
void main()
{
string sTag = GetTag(OBJECT_SELF);
string sDialogResRef=sTag;
if(sTag == "barred")
{SpeakString("The door is barred from the other side");}
else
{
if(GetLocalInt(OBJECT_SELF,"GREETING") == FALSE)
{return;}
else
{
object oPC = GetClickingObject();
if(GetIsPC(oPC) == FALSE)
{return;}
else
{
SetLocalObject(oPC,"oDoor",OBJECT_SELF);
ActionStartConversation(oPC,sDialogResRef,TRUE,FALSE);
}
}
}
}

View File

@@ -13839,7 +13839,7 @@ int AI_AttemptHostileSkills()
GlobalIntelligence >= 3) ||
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)));
//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)));
// Need appropriate level of skill, checked On Spawn, or overriden...
AI_ActionUseSkillOnMeleeTarget(SKILL_PICK_POCKET);
return TRUE;

View File

@@ -0,0 +1,6 @@
//Closes door if it is open
void main()
{
DelayCommand(25.0f,ActionCloseDoor(OBJECT_SELF));
}

View File

@@ -0,0 +1,285 @@
//::////////////////////////////////////////////////////////////////////////////
//:: Store Open Script
//:: ar_st_armory
//:: 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_nature
//:: 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

@@ -1,10 +1,4 @@
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.1
For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
//Goes OnPerceived of a creature
void main()
{

View File

@@ -0,0 +1,466 @@
//::///////////////////////////////////////////////
//:: Name x2_def_spawn
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On Spawn script
2003-07-28: Georg Zoeller:
If you set a ninteger on the creature named
"X2_USERDEFINED_ONSPAWN_EVENTS"
The creature will fire a pre and a post-spawn
event on itself, depending on the value of that
variable
1 - Fire Userdefined Event 1510 (pre spawn)
2 - Fire Userdefined Event 1511 (post spawn)
3 - Fire both events
2007-12-31: Deva Winblood
Modified to look for X3_HORSE_OWNER_TAG and if
it is defined look for an NPC with that tag
nearby or in the module (checks near first).
It will make that NPC this horse's master.
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner, Georg Zoeller
//:: Created On: June 11/03
//:://////////////////////////////////////////////
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
#include "NW_I0_GENERIC"
#include "ms_name_inc"
#include "x2_inc_switches"
#include "rnd_commoner_inc"
void ShrinkEm(object oPC)
{
SetObjectVisualTransform(oPC, OBJECT_VISUAL_TRANSFORM_SCALE, 0.5f);
}
void GrowEm(object oPC)
{
SetObjectVisualTransform(oPC, OBJECT_VISUAL_TRANSFORM_SCALE, 1.5f);
}
void main()
{
string sTag;
object oNPC;
// User defined OnSpawn event requested?
int nSpecEvent = GetLocalInt(OBJECT_SELF,"X2_USERDEFINED_ONSPAWN_EVENTS");
// Pre Spawn Event requested
if (nSpecEvent == 1 || nSpecEvent == 3 )
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_PRESPAWN ));
}
sTag=GetLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG");
if (GetStringLength(sTag)>0)
{ // look for master
oNPC=GetNearestObjectByTag(sTag);
if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE)
{ // master found
AddHenchman(oNPC);
} // master found
else
{ // look in module
oNPC=GetObjectByTag(sTag);
if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE)
{ // master found
AddHenchman(oNPC);
} // master found
else
{ // master does not exist - remove X3_HORSE_OWNER_TAG
DeleteLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG");
} // master does not exist - remove X3_HORSE_OWNER_TAG
} // look in module
} // look for master
//:: Sets a random integer on the creature to use with other spell functions
string sImmune = GetName(OBJECT_SELF)+"_AURA_IMMUNE";
int nRandomSeed = Random(999);
SetLocalInt(OBJECT_SELF, sImmune, nRandomSeed);
//:: Creature will quickly & automatically buff itself up with any defensive
//:: spells it has memorized.
int nAutobuff = GetLocalInt(OBJECT_SELF,"AUTOBUFF");
if (nAutobuff > 0 )
{
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY);
}
//:: Creature will flee those that close within 7m if they are not friends,
//:: Rangers or Druids.
int nHerbivore = GetLocalInt(OBJECT_SELF,"CREATURE_VAR_HERBIVORE");
if (nHerbivore > 0 )
{
SetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL);
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
}
//:: Creature will only attack those that close within 5m and are not friends,
//:: Rangers or Druids.
int nOmnivore = GetLocalInt(OBJECT_SELF,"CREATURE_VAR_OMNIVORE");
if (nOmnivore > 0 )
{
SetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL);
SetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE);
}
int nOLM = GetLocalInt(OBJECT_SELF,"OLM");
if (nOLM > 0)
{
DelayCommand(0.0f, ShrinkEm(OBJECT_SELF));
effect eSlow = EffectMovementSpeedDecrease(50);
eSlow = SupernaturalEffect(eSlow);
eSlow = ExtraordinaryEffect(eSlow);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSlow,OBJECT_SELF));
}
int nHuge = GetLocalInt(OBJECT_SELF,"HUGE");
if (nHuge > 0)
{
DelayCommand(0.0f, GrowEm(OBJECT_SELF));
}
int nNoStun = GetLocalInt(OBJECT_SELF,"NOSTUN");
if (nNoStun > 0)
{
effect eNoStun = EffectImmunity(IMMUNITY_TYPE_STUN);
eNoStun = SupernaturalEffect(eNoStun);
eNoStun = ExtraordinaryEffect(eNoStun);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNoStun,OBJECT_SELF));
}
int nNatInvis = GetLocalInt(OBJECT_SELF,"NATURAL_INVIS");
if (nNatInvis > 0)
{
effect eNatInvis = EffectInvisibility(4);
eNatInvis = SupernaturalEffect(eNatInvis);
eNatInvis = ExtraordinaryEffect(eNatInvis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNatInvis,OBJECT_SELF));
}
int nNoSleep = GetLocalInt(OBJECT_SELF,"NOSLEEP");
if (nNoSleep > 0)
{
effect eNoSleep = EffectImmunity(IMMUNITY_TYPE_SLEEP);
eNoSleep = SupernaturalEffect(eNoSleep);
eNoSleep = ExtraordinaryEffect(eNoSleep);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNoSleep,OBJECT_SELF));
}
int nNoDaze = GetLocalInt(OBJECT_SELF,"NODAZE");
if (nNoDaze > 0)
{
effect eNoDaze = EffectImmunity(IMMUNITY_TYPE_DAZED);
eNoDaze = SupernaturalEffect(eNoDaze);
eNoDaze = ExtraordinaryEffect(eNoDaze);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNoDaze,OBJECT_SELF));
}
int nNoBlind = GetLocalInt(OBJECT_SELF,"NOBLIND");
if (nNoBlind > 0)
{
effect eNoBlind = EffectImmunity(IMMUNITY_TYPE_BLINDNESS);
eNoBlind = SupernaturalEffect(eNoBlind);
eNoBlind = ExtraordinaryEffect(eNoBlind);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNoBlind,OBJECT_SELF));
}
int nNoDeaf = GetLocalInt(OBJECT_SELF,"NODEAF");
if (nNoDeaf > 0)
{
effect eNoDeaf = EffectImmunity(IMMUNITY_TYPE_DEAFNESS);
eNoDeaf = SupernaturalEffect(eNoDeaf);
eNoDeaf = ExtraordinaryEffect(eNoDeaf);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNoDeaf,OBJECT_SELF));
}
int nDeaf = GetLocalInt(OBJECT_SELF,"IS_DEAF");
if (nDeaf > 0)
{
effect eDeaf = EffectDeaf();
eDeaf = SupernaturalEffect(eDeaf);
eDeaf = ExtraordinaryEffect(eDeaf);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eDeaf,OBJECT_SELF));
}
/* Fix for the new golems to reduce their number of attacks */
int nNumber = GetLocalInt(OBJECT_SELF,CREATURE_VAR_NUMBER_OF_ATTACKS);
if (nNumber >0 )
{
SetBaseAttackBonus(nNumber);
}
int nVFX = GetLocalInt(OBJECT_SELF,"SpawnVFX");
if(nVFX)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(nVFX)),OBJECT_SELF);
}
int nRegen = GetLocalInt(OBJECT_SELF,"FAST_HEALING");
if(nRegen)
{
effect eRegen = EffectRegenerate(nRegen, 6.0f);
eRegen = SupernaturalEffect(eRegen);
eRegen = ExtraordinaryEffect(eRegen);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRegen, OBJECT_SELF));
}
int nShadowy = GetLocalInt(OBJECT_SELF,"SHADOWY");
if (nShadowy)
{
effect eVis = EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nStony = GetLocalInt(OBJECT_SELF,"STONY");
if (nStony)
{
effect eVis = EffectVisualEffect(VFX_DUR_PROT_STONESKIN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nFirey = GetLocalInt(OBJECT_SELF,"FIREY");
if (nFirey)
{
effect eVis = EffectVisualEffect(VFX_DUR_INFERNO_NO_SOUND);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nWoody = GetLocalInt(OBJECT_SELF,"WOODY");
if (nWoody)
{
effect eVis = EffectVisualEffect(VFX_DUR_PROT_BARKSKIN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nConcealed20 = GetLocalInt(OBJECT_SELF,"CONCEALED20");
if (nConcealed20)
{
effect eVis = EffectVisualEffect(VFX_DUR_BLUR );
effect eConceal = EffectConcealment(20, 0);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nConcealed50 = GetLocalInt(OBJECT_SELF,"CONCEALED50");
if (nConcealed50)
{
effect eVis = EffectVisualEffect(VFX_DUR_BLUR );
effect eConceal = EffectConcealment(50, 0);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nIcy = GetLocalInt(OBJECT_SELF,"ICY");
if (nIcy)
{
effect eVis = EffectVisualEffect(VFX_DUR_ICESKIN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
int nSR = GetLocalInt(OBJECT_SELF,"SPELL_RESISTANCE");
if ( nSR )
{
effect eSR = EffectSpellResistanceIncrease(nSR);
eSR = SupernaturalEffect(eSR);
eSR = ExtraordinaryEffect(eSR);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSR,OBJECT_SELF);
}
int nAttackBonus = GetLocalInt(OBJECT_SELF,"ATTACK_BONUS");
if ( nAttackBonus )
{
effect eAttack = EffectAttackIncrease(nAttackBonus);
eAttack = SupernaturalEffect(eAttack);
eAttack = ExtraordinaryEffect(eAttack);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eAttack,OBJECT_SELF);
}
int nAcidShield = GetLocalInt(OBJECT_SELF,"ACID_SHIELD");
if ( nAcidShield )
{
effect eShield = EffectDamageShield(0,DAMAGE_BONUS_1d8,DAMAGE_TYPE_ACID);
eShield = SupernaturalEffect(eShield);
eShield = ExtraordinaryEffect(eShield);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eShield,OBJECT_SELF);
}
int nSerratedEdge = GetLocalInt(OBJECT_SELF,"SERRATED_EDGE");
if ( nSerratedEdge )
{
effect eShield = EffectDamageShield(0,DAMAGE_BONUS_1d6,DAMAGE_TYPE_SLASHING);
eShield = SupernaturalEffect(eShield);
eShield = ExtraordinaryEffect(eShield);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eShield,OBJECT_SELF);
}
int nSpikedArmor = GetLocalInt(OBJECT_SELF,"SPIKED_ARMOR");
if ( nSpikedArmor )
{
effect eShield = EffectDamageShield(0,DAMAGE_BONUS_1d4,DAMAGE_TYPE_PIERCING);
eShield = SupernaturalEffect(eShield);
eShield = ExtraordinaryEffect(eShield);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eShield,OBJECT_SELF);
}
int nGlow = GetLocalInt (OBJECT_SELF,"GLOW_COLOR");
if (nGlow == 1)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_BLUE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 2)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_BROWN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 3)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_GREEN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 4)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_GREY);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 5)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_BLUE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 6)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_BROWN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 7)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_GREEN);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 8)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_ORANGE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 9)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_PURPLE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 10)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_RED);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 11)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_YELLOW);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 12)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_ORANGE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 13)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_PURPLE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 14)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_RED);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 15)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_WHITE);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
else if (nGlow == 16)
{
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_YELLOW);
eVis = SupernaturalEffect(eVis);
eVis = ExtraordinaryEffect(eVis);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF));
}
ms_Nomenclature(OBJECT_SELF);
rnd_skin(OBJECT_SELF);
rnd_head(OBJECT_SELF);
rnd_tattoo(OBJECT_SELF);
// Execute default OnSpawn script.
ExecuteScript("nw_c2_default9", OBJECT_SELF);
//Post Spawn event requeste
if (nSpecEvent == 2 || nSpecEvent == 3)
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN));
}
}