816 lines
29 KiB
Plaintext
816 lines
29 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Name ds_ai_onspawn
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:: Copyright (c) 2022 Project RATDOG
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
NPC OnSpawn event script caller to run
|
|
CODI AI & PRC events.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
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.
|
|
|
|
20221201: Jaysyn
|
|
Modified to read desired CODI AI spawner
|
|
from string var "SPAWN_TYPE" set on the NPC,
|
|
defaults to fighter.
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Keith Warner, Georg Zoeller
|
|
//:: Created On: June 11/03
|
|
//:: Modified By: Jaysyn
|
|
//:: Modified On: 20221201
|
|
//:://////////////////////////////////////////////
|
|
|
|
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"
|
|
#include "ds_rnd_armor_inc"
|
|
#include "ds_rnd_level"
|
|
|
|
|
|
void ShrinkEm(object oNPC)
|
|
{
|
|
SetObjectVisualTransform(OBJECT_SELF, OBJECT_VISUAL_TRANSFORM_SCALE, 0.3f);
|
|
}
|
|
|
|
void Embiggen(object oNPC)
|
|
{
|
|
SetObjectVisualTransform(OBJECT_SELF, OBJECT_VISUAL_TRANSFORM_SCALE, 1.15f);
|
|
}
|
|
|
|
void GrowEm(object oNPC)
|
|
{
|
|
SetObjectVisualTransform(OBJECT_SELF, OBJECT_VISUAL_TRANSFORM_SCALE, 1.5f);
|
|
}
|
|
|
|
void NoFreeGear(object oNPC)
|
|
{
|
|
object oArmor;
|
|
object oWeapon;
|
|
|
|
oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, OBJECT_SELF);
|
|
oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);
|
|
|
|
SetDroppableFlag(oArmor, FALSE);
|
|
SetDroppableFlag(oWeapon, FALSE);
|
|
}
|
|
|
|
void AutoLevel(object oNPC)
|
|
{
|
|
// Initialize Variables
|
|
|
|
int nBoost = 0;
|
|
int nTotalPCs = 0;
|
|
int nTotalPCLevel = 0;
|
|
int nAveragePCLevel = 0;
|
|
int nDifficulty = d2(1);
|
|
int nRnd = d3(1);
|
|
int nCreHD = GetHitDice(OBJECT_SELF);
|
|
|
|
object oArea = GetArea(OBJECT_SELF);
|
|
|
|
string sAreaName = GetName(oArea);
|
|
|
|
// Cycle through PCs in Area
|
|
object oPC = GetFirstObjectInArea(oArea);
|
|
|
|
//SendMessageToPC(oPC, "OnSpawn: AutoLevel is running in "+sAreaName+".");
|
|
//SendMessageToAllDMs("OnSpawn: AutoLevel is running in "+sAreaName+".");
|
|
//SendMessageToPC(oPC, "OnSpawn: AutoLevel Difficulty = "+IntToString(nDifficulty));
|
|
//SendMessageToAllDMs("OnSpawn: AutoLevel Difficulty = "+IntToString(nDifficulty));
|
|
//SendMessageToPC(oPC, "OnSpawn: AutoLevel Randomness = "+IntToString(nRnd));
|
|
//SendMessageToAllDMs("OnSpawn: AutoLevel Randomness = "+IntToString(nRnd));
|
|
//SendMessageToPC(oPC, "OnSpawn: Creature starting HD = "+IntToString(nCreHD));
|
|
//SendMessageToAllDMs("OnSpawn: Creature starting HD = "+IntToString(nCreHD));
|
|
|
|
while (oPC != OBJECT_INVALID)
|
|
{
|
|
|
|
if (GetIsPC(oPC) == TRUE || GetIsPC(GetMaster(oPC)) == TRUE) // Summons & henchmen should count towards this.
|
|
{
|
|
nTotalPCs++;
|
|
nTotalPCLevel += GetHitDice(oPC);
|
|
//SendMessageToPC(oPC, "TotalPCs = "+ IntToString(nTotalPCs)+ " TotalHD = "+IntToString(nTotalPCLevel));
|
|
//SendMessageToAllDMs("TotalPCs = "+ IntToString(nTotalPCs)+ " TotalHD = "+IntToString(nTotalPCLevel));
|
|
}
|
|
|
|
oPC = GetNextObjectInArea(oArea);
|
|
}
|
|
|
|
//SendMessageToPC(oPC, "Total PCs in Area = "+IntToString(nTotalPCs));
|
|
//SendMessageToAllDMs("Total PCs in Area = "+IntToString(nTotalPCs));
|
|
|
|
if (nTotalPCs > 0)
|
|
{
|
|
nAveragePCLevel = nTotalPCLevel / nTotalPCs;
|
|
}
|
|
else
|
|
{
|
|
nAveragePCLevel = 3;
|
|
}
|
|
|
|
//SendMessageToPC(oPC, "Average PC Level = "+IntToString(nAveragePCLevel));
|
|
//SendMessageToAllDMs("Average PC Level = "+IntToString(nAveragePCLevel));
|
|
|
|
// Advance creature
|
|
if (nRnd == 1)
|
|
{
|
|
nBoost = nAveragePCLevel + nDifficulty;
|
|
//SendMessageToPC(oPC, "2nd Stage: Adding "+IntToString(nDifficulty)+" difficulty. nBoost = "+IntToString(nBoost));
|
|
//SendMessageToAllDMs("2nd Stage: Adding "+IntToString(nDifficulty)+" difficulty. nBoost = "+IntToString(nBoost));
|
|
//SendMessageToPC(oPC, "2nd Stage: LevelMob Running - Harder Difficulty");
|
|
//SendMessageToAllDMs("2nd Stage: LevelMob Running - Harder Difficulty");
|
|
//SendMessageToPC(oPC, "2nd Stage: LevelMob adding "+IntToString(nBoost)+" Hit Dice");
|
|
//SendMessageToAllDMs("2nd Stage: LevelMob adding "+IntToString(nBoost)+" Hit Dice");
|
|
DelayCommand(0.0f, LevelMob(OBJECT_SELF, nBoost));
|
|
SetLocalInt(OBJECT_SELF, PRC_CASTERLEVEL_OVERRIDE, nBoost);
|
|
}
|
|
else
|
|
{
|
|
nBoost = nAveragePCLevel - nDifficulty;
|
|
//SendMessageToPC(oPC, "2nd Stage: Adding "+IntToString(nDifficulty)+" difficulty. nBoost = "+IntToString(nBoost));
|
|
//SendMessageToAllDMs("2nd Stage: Adding "+IntToString(nDifficulty)+" difficulty. nBoost = "+IntToString(nBoost));
|
|
//SendMessageToPC(oPC, "2nd Stage: LevelMob Running - Easier Difficulty");
|
|
//SendMessageToAllDMs("2nd Stage: LevelMob Running - Easier Difficulty");
|
|
//SendMessageToPC(oPC, "2nd Stage: LevelMob adding "+IntToString(nAveragePCLevel)+" Hit Dice");
|
|
//SendMessageToAllDMs("2nd Stage: LevelMob adding "+IntToString(nAveragePCLevel)+" Hit Dice");
|
|
DelayCommand(0.0f, LevelMob(OBJECT_SELF, nBoost));
|
|
SetLocalInt(OBJECT_SELF, PRC_CASTERLEVEL_OVERRIDE, nBoost);
|
|
}
|
|
}
|
|
|
|
|
|
void main()
|
|
{
|
|
string sTag;
|
|
string sResRef = GetResRef(OBJECT_SELF);
|
|
string sSpawnType = "no_spn_ftr";
|
|
|
|
sSpawnType = GetLocalString(OBJECT_SELF,"SPAWN_TYPE");
|
|
|
|
if (sSpawnType == "")
|
|
{
|
|
sSpawnType = "no_spn_ftr";
|
|
}
|
|
|
|
//: 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 ));
|
|
}
|
|
|
|
//:: Creature will randomly level to within +/-2 levels of area's average PC lvl
|
|
int nAutoLevel = GetLocalInt(OBJECT_SELF,"AUTOLEVEL");
|
|
if (nAutoLevel > 0 )
|
|
{
|
|
DelayCommand(0.0f, AutoLevel(OBJECT_SELF));
|
|
}
|
|
|
|
//:: Randomize Silt Pirate armor
|
|
if ((sResRef == "silt_pirate001") ||
|
|
(sResRef == "silt_pirate002"))
|
|
{
|
|
DelayCommand(0.0f, RndPirateArmor(OBJECT_SELF));
|
|
ActionEquipMostEffectiveArmor();
|
|
}
|
|
|
|
//:: Randomize Bandit armor
|
|
if ((sResRef == "banditguard_001") ||
|
|
(sResRef == "banditguard_002") ||
|
|
(sResRef == "banditguard_003") ||
|
|
(sResRef == "dunebandit_001") ||
|
|
(sResRef == "dunebandit_002") ||
|
|
(sResRef == "dunebandit_003") ||
|
|
(sResRef == "halfbandit_001") ||
|
|
(sResRef == "humanbandit_001") ||
|
|
(sResRef == "humanbandit_002") ||
|
|
(sResRef == "humanbandit_003") ||
|
|
(sResRef == "humanbandit_004") ||
|
|
(sResRef == "humanbandit_005") ||
|
|
(sResRef == "elvenraider001") ||
|
|
(sResRef == "warrensthug001") ||
|
|
(sResRef == "ar_gulgslaver002") ||
|
|
(sResRef == "ar_gulgslaver003") ||
|
|
(sResRef == "ar_gulgslaver004"))
|
|
{
|
|
DelayCommand(0.0f, RndBanditArmor(OBJECT_SELF));
|
|
ActionEquipMostEffectiveArmor();
|
|
}
|
|
|
|
sTag=GetLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG");
|
|
if (GetStringLength(sTag)>0)
|
|
{ // look for master
|
|
object 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(oNPC,"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(90);
|
|
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 nEmbiggen = GetLocalInt(OBJECT_SELF,"EMBIGGEN");
|
|
if (nEmbiggen > 0)
|
|
{
|
|
DelayCommand(0.0f, Embiggen(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 nNatInvis1 = GetLocalInt(OBJECT_SELF,"NATURAL_INVIS");
|
|
if (nNatInvis1 == 1)
|
|
{
|
|
effect eNatInvis = EffectInvisibility(4);
|
|
eNatInvis = SupernaturalEffect(eNatInvis);
|
|
//eNatInvis = ExtraordinaryEffect(eNatInvis);
|
|
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNatInvis,OBJECT_SELF));
|
|
}
|
|
|
|
int nNatInvis2 = GetLocalInt(OBJECT_SELF,"NATURAL_INVIS");
|
|
if (nNatInvis2 == 2)
|
|
{
|
|
effect eNatInvis = EffectInvisibility(4);
|
|
eNatInvis = SupernaturalEffect(eNatInvis);
|
|
eNatInvis = ExtraordinaryEffect(eNatInvis);
|
|
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eNatInvis,OBJECT_SELF));
|
|
}
|
|
|
|
int nSeeInvis = GetLocalInt(OBJECT_SELF,"SEE_INVIS");
|
|
if (nSeeInvis > 0)
|
|
{
|
|
effect eSeeInvis = EffectSeeInvisible();
|
|
eSeeInvis = SupernaturalEffect(eSeeInvis);
|
|
eSeeInvis = ExtraordinaryEffect(eSeeInvis);
|
|
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSeeInvis,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 nIceShield = GetLocalInt(OBJECT_SELF,"FROST_SHIELD");
|
|
if ( nIceShield )
|
|
{
|
|
effect eShield = EffectDamageShield(0,DAMAGE_BONUS_1d6,DAMAGE_TYPE_COLD);
|
|
eShield = SupernaturalEffect(eShield);
|
|
eShield = ExtraordinaryEffect(eShield);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eShield,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));
|
|
}
|
|
|
|
// Check for randomizations.
|
|
|
|
ms_Nomenclature(OBJECT_SELF);
|
|
|
|
int nKeepskin = GetLocalInt(OBJECT_SELF,"DS_KEEPSKIN");
|
|
if (nKeepskin != 1)
|
|
{
|
|
rnd_skin(OBJECT_SELF);
|
|
}
|
|
|
|
int nKeephead = GetLocalInt(OBJECT_SELF,"DS_KEEPHEAD");
|
|
if (nKeephead != 1)
|
|
{
|
|
rnd_head(OBJECT_SELF);
|
|
}
|
|
|
|
int nKeeptats = GetLocalInt(OBJECT_SELF,"DS_KEEPTATS");
|
|
if (nKeeptats != 1)
|
|
{
|
|
rnd_tattoo(OBJECT_SELF);
|
|
}
|
|
|
|
|
|
//:: Handles various Aura effects
|
|
int nAtropal = GetTag(OBJECT_SELF) == "ATROPAL001" ? TRUE : FALSE;
|
|
if(nAtropal)ExecuteScript("atropal_aura",OBJECT_SELF);
|
|
|
|
int AtropalScion = GetTag(OBJECT_SELF) == "ATROPALSCION001" ? TRUE : FALSE;
|
|
if(AtropalScion)ExecuteScript("neaura",OBJECT_SELF);
|
|
|
|
int nBleakborn = GetStringLeft(GetTag(OBJECT_SELF), 9) == "BLEAKBORN" ? TRUE : FALSE;
|
|
if(nBleakborn)ExecuteScript("bleakaura",OBJECT_SELF);
|
|
|
|
int nCryptChanter = GetStringLeft(GetTag(OBJECT_SELF), 12) == "CRYPTCHANTER" ? TRUE : FALSE;
|
|
if(nCryptChanter)ExecuteScript("DrainingMelody",OBJECT_SELF);
|
|
|
|
int nNWalker = GetStringLeft(GetTag(OBJECT_SELF), 11) == "NIGHTWALKER" ? TRUE : FALSE;
|
|
if(nNWalker)ExecuteScript("desecrating_aura",OBJECT_SELF);
|
|
|
|
int nNCrawler = GetStringLeft(GetTag(OBJECT_SELF), 12) == "NIGHTCRAWLER" ? TRUE : FALSE;
|
|
if(nNCrawler)ExecuteScript("desecrating_aura",OBJECT_SELF);
|
|
|
|
int nVoidWraith = GetStringLeft(GetTag(OBJECT_SELF), 10) == "VOIDWRAITH" ? TRUE : FALSE;
|
|
if(nVoidWraith)ExecuteScript("airlessaura",OBJECT_SELF);
|
|
|
|
int nGhast = GetStringLeft(GetTag(OBJECT_SELF), 5) == "GHAST" ? TRUE : FALSE;
|
|
if(nGhast)ExecuteScript("ghast_stench",OBJECT_SELF);
|
|
|
|
int nTliz = GetStringLeft(GetTag(OBJECT_SELF), 4) == "TLIZ" ? TRUE : FALSE;
|
|
if(nTliz)ExecuteScript("tliz_aura",OBJECT_SELF);
|
|
|
|
int nDecay = GetStringLeft(GetTag(OBJECT_SELF), 12) == "ANGELOFDECAY" ? TRUE : FALSE;
|
|
if(nDecay)ExecuteScript("rotura",OBJECT_SELF);
|
|
|
|
int nConsumeInt = GetStringLeft(GetTag(OBJECT_SELF), 13) == "DS_YELMUSKCRP" ? TRUE : FALSE;
|
|
if(nConsumeInt)ExecuteScript("consume_int",OBJECT_SELF);
|
|
|
|
int nDecay1 = GetStringLeft(GetTag(OBJECT_SELF), 13) == "DS_YELMUSKCRP" ? TRUE : FALSE;
|
|
if(nDecay1)ExecuteScript("consume_int",OBJECT_SELF);
|
|
|
|
int nMiniKanks = GetStringLeft(GetTag(OBJECT_SELF), 14) == "DS_MINKANKSWRM" ? TRUE : FALSE;
|
|
if(nMiniKanks)ExecuteScript("swarm_minikank",OBJECT_SELF);
|
|
|
|
int nLocusts = GetStringLeft(GetTag(OBJECT_SELF), 14) == "DS_LOCUSTSWARM" ? TRUE : FALSE;
|
|
if(nLocusts)ExecuteScript("swarm_locust",OBJECT_SELF);
|
|
|
|
int nBerzWasp1 = GetStringLeft(GetTag(OBJECT_SELF), 11) == "AR_BERZWASP" ? TRUE : FALSE;
|
|
if(nBerzWasp1)ExecuteScript("swarm_berzwasp",OBJECT_SELF);
|
|
|
|
int nRepBats = GetStringLeft(GetTag(OBJECT_SELF), 13) == "DS_REPBATSWRM" ? TRUE : FALSE;
|
|
if(nRepBats)ExecuteScript("swarm_repbat",OBJECT_SELF);
|
|
|
|
int nFordorran = GetStringLeft(GetTag(OBJECT_SELF), 12) == "DS_FORDORRAN" ? TRUE : FALSE;
|
|
if(nFordorran)ExecuteScript("fordorran_aura",OBJECT_SELF);
|
|
|
|
int nPrisma = GetStringLeft(GetTag(OBJECT_SELF), 12) == "PRISMASAURUS" ? TRUE : FALSE;
|
|
if(nPrisma)ExecuteScript("prism_aura",OBJECT_SELF);
|
|
|
|
|
|
//:: Randomize Silt Pirate armor
|
|
if ((GetResRef(OBJECT_SELF) == "silt_pirate001") ||
|
|
(GetResRef(OBJECT_SELF) == "silt_pirate002"))
|
|
{
|
|
RndPirateArmor(OBJECT_SELF);
|
|
ActionEquipMostEffectiveArmor();
|
|
}
|
|
|
|
//:: Randomize Bandit armor
|
|
if ((GetResRef(OBJECT_SELF) == "banditguard_001") ||
|
|
(GetResRef(OBJECT_SELF) == "banditguard_002") ||
|
|
(GetResRef(OBJECT_SELF) == "banditguard_003") ||
|
|
(GetResRef(OBJECT_SELF) == "dunebandit_001") ||
|
|
(GetResRef(OBJECT_SELF) == "dunebandit_002") ||
|
|
(GetResRef(OBJECT_SELF) == "dunebandit_003") ||
|
|
(GetResRef(OBJECT_SELF) == "halfbandit_001") ||
|
|
(GetResRef(OBJECT_SELF) == "humanbandit_001") ||
|
|
(GetResRef(OBJECT_SELF) == "humanbandit_002") ||
|
|
(GetResRef(OBJECT_SELF) == "humanbandit_003") ||
|
|
(GetResRef(OBJECT_SELF) == "humanbandit_004") ||
|
|
(GetResRef(OBJECT_SELF) == "humanbandit_005") ||
|
|
(GetResRef(OBJECT_SELF) == "elvenraider001") ||
|
|
(GetResRef(OBJECT_SELF) == "warrensthug001") ||
|
|
(GetResRef(OBJECT_SELF) == "ar_gulgslaver002") ||
|
|
(GetResRef(OBJECT_SELF) == "ar_gulgslaver003") ||
|
|
(GetResRef(OBJECT_SELF) == "ar_gulgslaver004"))
|
|
{
|
|
RndBanditArmor(OBJECT_SELF);
|
|
ActionEquipMostEffectiveArmor();
|
|
}
|
|
|
|
//:: Regeneration (not Fast Healing)
|
|
if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA")
|
|
{
|
|
//:: Setting local variable for tracking Subdual damage
|
|
SetLocalInt(OBJECT_SELF, "nSubDual", 0);
|
|
|
|
//:: OPTIONAL BEHAVIOR - Fire User Defined Event 1001
|
|
SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT);
|
|
|
|
//:: OPTIONAL BEHAVIOR - Fire User Defined Event 1003
|
|
SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT);
|
|
|
|
//:: OPTIONAL BEHAVIOR - Fire User Defined Event 1006
|
|
SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT);
|
|
|
|
//:: OPTIONAL BEHAVIOR - Fire User Defined Event 1007
|
|
SetSpawnInCondition(NW_FLAG_DEATH_EVENT);
|
|
}
|
|
|
|
//Post Spawn event request
|
|
if (nSpecEvent == 2 || nSpecEvent == 3)
|
|
{
|
|
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN));
|
|
}
|
|
|
|
//:: Creature will gain 2 HD for every PC over 4 in an area.
|
|
int nAutoSolo = GetLocalInt(OBJECT_SELF,"AUTOSOLO");
|
|
if (nAutoSolo > 0 )
|
|
{
|
|
int iNewHD = GetNewAutoSoloHitDice(OBJECT_SELF);
|
|
int iNewHP = GetNewAutoSoloHitPoints(OBJECT_SELF);
|
|
|
|
JSONAutoSolo(OBJECT_SELF, iNewHD, iNewHP);
|
|
}
|
|
|
|
/* //:: Handles class level based NPC titles
|
|
int bClassTitle = GetLocalInt(OBJECT_SELF,"CLASS_TITLE");
|
|
if(bClassTitle)
|
|
{
|
|
int nHighClass = GetHighestClassLevel(OBJECT_SELF);
|
|
string sBaseRace = GetLocalString(OBJECT_SELF,"BASE_RACE");
|
|
|
|
DelayCommand(0.0f, SetName(OBJECT_SELF, sBaseRace +" "+ GetClassLevelTitle(nHighClass)));
|
|
} */
|
|
|
|
//:: Execute OnSpawn script.
|
|
if (sResRef == "monst_spider004")
|
|
{
|
|
//:: Execute drop in from above spawn.
|
|
ExecuteScript("nw_c2_dropin9", OBJECT_SELF);
|
|
}
|
|
else
|
|
{
|
|
//:: Execute CODI AI OnSpawn script.
|
|
ExecuteScript(sSpawnType, OBJECT_SELF);
|
|
|
|
//:: Execute default OnSpawn script.
|
|
//ExecuteScript("nw_c2_default9", OBJECT_SELF);
|
|
}
|
|
|
|
//:: Execute PRC OnSpawn script.
|
|
ExecuteScript("prc_npc_spawn", OBJECT_SELF);
|
|
|
|
} |