Spawner & Overhaul pass.

Added: Reforged, Undead Redux 2, Goblin, Ogre & Orc override content.  Updated appearance & placeables 2DA files to EE.  Added NPC spawners for Goldeyes, Paladins, Town Guards.  Added functionality to the mob randomizer.
This commit is contained in:
Jaysyn904
2021-09-04 14:36:27 -04:00
parent d0d52fb1d0
commit 732d63e1f3
5027 changed files with 435172 additions and 28773 deletions

View File

@@ -1,185 +0,0 @@
///////////////////////////////////
// Carcerian's BattleCry Script //
// "Evil Dead" Edition //
///////////////////////////////////
#include "NW_I0_GENERIC"
const int BattleCryChance = 15;
const int CombatCryChance = 20;
const int DeathCryChance = 20;
const int CustomUndeadChance = 50;
const string COLOR_RED = "<c<> >";
const string COLOR_DARK = "<cSSS>";
const string COLOR_GREEN = "<c <20> >";
const string COLOR_WHITE = "<c<><63><EFBFBD>>";
const string COLOR_VIOLET = "<c<> <20>>";
const string COLOR_YELLOW = "<c<><63> >";
int HasSpoken()
{
if (GetLocalInt(OBJECT_SELF,"HASSPOKEN")) return 1;
SetLocalInt(OBJECT_SELF,"HASSPOKEN",1);
DelayCommand(IntToFloat(d10(4)),SetLocalInt(OBJECT_SELF,"HASSPOKEN",0));
return 0;
}
void DoUndeadChatter()
{
string sMyTag = GetTag(OBJECT_SELF);
if ((FindSubString(sMyTag,"SKEL")>-1)||(FindSubString(sMyTag,"MOHRG")>-1))
{
switch (d3()) // Skeletons
{
case 1 : ActionSpeakString(COLOR_WHITE+"I got a bone to pick with you!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_WHITE+"Forward, you worthless bags of bones!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_WHITE+"CHARGE!",TALKVOLUME_TALK); break;
}
}
else if (FindSubString(sMyTag,"ZOMB")>-1)
{
if (Random(2)) ActionSpeakString(COLOR_GREEN+"Brains!",TALKVOLUME_TALK);
else ActionSpeakString(COLOR_GREEN+"BRAINS!",TALKVOLUME_TALK);
// "More brains!"
}
else if ((FindSubString(sMyTag,"GHOUL")>-1)||(FindSubString(sMyTag,"GHAST")>-1)
||(FindSubString(sMyTag,"WIGHT")>-1))
{
switch (d4()) // Flesh Eaters
{
case 1 : ActionSpeakString(COLOR_GREEN+"I'll feast on your entrails!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_GREEN+"FOOD!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_GREEN+"Live ones!!",TALKVOLUME_TALK); break;
case 4 : ActionSpeakString(COLOR_GREEN+"FLESSSSHHHH!!!",TALKVOLUME_TALK); break;
}
}
else if ((FindSubString(sMyTag,"WRAITH")>-1)||(FindSubString(sMyTag,"ALLIP")>-1)
||(FindSubString(sMyTag,"Bodak")>-1)||(FindSubString(sMyTag,"SHADOW")>-1)
||(FindSubString(sMyTag,"SHFIEND")>-1)||(FindSubString(sMyTag,"SPECTRE")>-1))
{
switch (d4()) // Soul Eaters
{
case 1 : ActionSpeakString(COLOR_VIOLET+"I'll swallow your soul!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_VIOLET+"Your soul will be mine!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_VIOLET+"Mine!!!!",TALKVOLUME_TALK); break;
case 4 : ActionSpeakString(COLOR_VIOLET+"The darkness calls for you...",TALKVOLUME_TALK); break;
}
}
else switch (d6()) // Generic Undead
{
case 1 : ActionSpeakString(COLOR_RED+"I'll swallow your soul!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_RED+"Blood and souls!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_RED+"Joinnnn usssssssss!",TALKVOLUME_TALK); break;
case 4 : ActionSpeakString(COLOR_RED+"For the Master!",TALKVOLUME_TALK); break;
case 5 : ActionSpeakString(COLOR_RED+"For the Master!",TALKVOLUME_TALK); break;
case 6 : ActionSpeakString(COLOR_RED+"One by one we will take you!",TALKVOLUME_TALK); break;
}
}
// For use on perception
void DoBattleCry()
{ //if undead spotted "i see dead people!" "Dead ahead!"
if (d100()<=BattleCryChance)
{
if (HasSpoken()) return;
if ((GetRacialType(OBJECT_SELF) == RACIAL_TYPE_UNDEAD)&&(d100()<=CustomUndeadChance))
{
DoUndeadChatter();
}
else switch (d10())
{
case 1: PlayVoiceChat(VOICE_CHAT_ATTACK); break;
case 2: PlayVoiceChat(VOICE_CHAT_BATTLECRY1); break;
case 3: PlayVoiceChat(VOICE_CHAT_BATTLECRY2); break;
case 4: PlayVoiceChat(VOICE_CHAT_BATTLECRY3); break;
case 5: PlayVoiceChat(VOICE_CHAT_THREATEN); break;
case 6: PlayVoiceChat(VOICE_CHAT_TAUNT); break;
case 7: PlayVoiceChat(VOICE_CHAT_ENEMIES); break;
case 8: PlayVoiceChat(VOICE_CHAT_CHEER); break;
case 9: PlayVoiceChat(VOICE_CHAT_FOLLOWME); break;
case 10: PlayVoiceChat(VOICE_CHAT_LOOKHERE); break;
}
}
}
//For End of Combat Round
void DoCombatCry()
{
if (GetHasEffect(EFFECT_TYPE_FRIGHTENED))
{
if (d100()<=CombatCryChance)
{
if (HasSpoken()) return;
if ((GetRacialType(OBJECT_SELF) == RACIAL_TYPE_UNDEAD)&&(d100()<=CustomUndeadChance))
switch (d6()) //Turned undead :)
{
case 1 : ActionSpeakString(COLOR_YELLOW+"It Burns! It Burns!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_YELLOW+"Cursed Light!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_YELLOW+"Your faith is weak, I can feel your fear...",TALKVOLUME_TALK); break;
case 4 : ActionSpeakString(COLOR_YELLOW+"AAAIIIEEE!!!",TALKVOLUME_TALK); break;
case 5 : ActionSpeakString(COLOR_YELLOW+"NOOO!!!",TALKVOLUME_TALK); break;
case 6 : ActionSpeakString(COLOR_YELLOW+"It Burns!",TALKVOLUME_TALK); break;
}
else switch (d6())
{
case 1: PlayVoiceChat(VOICE_CHAT_FLEE); break;
case 2: PlayVoiceChat(VOICE_CHAT_HELP); break;
case 3: PlayVoiceChat(VOICE_CHAT_GUARDME); break;
case 4: PlayVoiceChat(VOICE_CHAT_CUSS); break;
case 5: PlayVoiceChat(VOICE_CHAT_BADIDEA); break;
case 6: PlayVoiceChat(VOICE_CHAT_NEARDEATH); break;
}
}
}
else
{
if (d100()<=CombatCryChance)
{
if (HasSpoken()) return;
if ((GetRacialType(OBJECT_SELF) == RACIAL_TYPE_UNDEAD)&&(d100()<=CustomUndeadChance))
switch (d6())
{
DoUndeadChatter();
}
else switch (d6())
{
case 1: PlayVoiceChat(VOICE_CHAT_BATTLECRY1); break;
case 2: PlayVoiceChat(VOICE_CHAT_BATTLECRY2); break;
case 3: PlayVoiceChat(VOICE_CHAT_BATTLECRY3); break;
case 4: PlayVoiceChat(VOICE_CHAT_LAUGH); break;
case 5: PlayVoiceChat(VOICE_CHAT_TAUNT); break;
case 6: PlayVoiceChat(VOICE_CHAT_THREATEN); break;
}
}
}
}
//For Creature Death
void DoDeathCry()
{
if (d100()<=DeathCryChance)
{
if (HasSpoken()) return;
if ((GetRacialType(OBJECT_SELF) == RACIAL_TYPE_UNDEAD)&&(d100()<=CustomUndeadChance))
switch (d6())
{
case 1 : ActionSpeakString(COLOR_RED+"Dead by dawn! Dead by dawn!",TALKVOLUME_TALK); break;
case 2 : ActionSpeakString(COLOR_RED+"Death is only the beginning!",TALKVOLUME_TALK); break;
case 3 : ActionSpeakString(COLOR_RED+"Darkness take me...",TALKVOLUME_TALK); break;
case 4 : ActionSpeakString(COLOR_RED+"Free at last...",TALKVOLUME_TALK); break;
case 5 : ActionSpeakString(COLOR_RED+"Time to die...",TALKVOLUME_TALK); break;
case 6 : ActionSpeakString(COLOR_RED+"Thank you...",TALKVOLUME_TALK); break;
} // "No more tears..."
else switch (d6())
{
case 1: PlayVoiceChat(VOICE_CHAT_CUSS); break;
case 2: PlayVoiceChat(VOICE_CHAT_DEATH); break;
case 3: PlayVoiceChat(VOICE_CHAT_NEARDEATH); break;
case 4: PlayVoiceChat(VOICE_CHAT_GOODBYE); break;
case 5: PlayVoiceChat(VOICE_CHAT_LAUGH); break;
case 6: PlayVoiceChat(VOICE_CHAT_HEALME); break;
}
}
}
//void main (){}

View File

@@ -1,200 +0,0 @@
const float fUnlifespan = 300.0;
string SpawnOf(object oSpawnKiller = OBJECT_INVALID)
{
string sSpawn = "";
string sKiller = GetName(oSpawnKiller, FALSE);
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oSpawnKiller);
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oSpawnKiller);
string sLeftTag = GetTag(oLeft);
string sRightTag = GetTag(oRight);
if (!(GetStringRight(sKiller, 6) ==" Spawn") ||
!(GetStringRight(sKiller, 6) ==" Rat"))
if ((GetIsPC(GetMaster(oSpawnKiller))||(GetIsPC(oSpawnKiller))))
{
if ((FindSubString(sKiller, "Morg")>-1)||
(sRightTag=="vampirespawner")||
(sLeftTag=="vampirespawner")) sSpawn = "namechspawn";
/* // No Vampires on Athas
if ((FindSubString(sKiller, "Vampire")>-1)||(sRightTag=="vampirespawner")||(sLeftTag=="vampirespawner"))
{
if (GetGender(OBJECT_SELF)==GENDER_FEMALE) sSpawn = "vampirespawn_f";
else sSpawn = "vampirespawn_m";
} */
else if ((FindSubString(sKiller, "Tyrantfog")>-1)||(sRightTag=="tyrantfogspawner")) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "Ghoul")>-1) sSpawn = "ghoulspawn";
else if (FindSubString(sKiller, "Ghast")>-1) sSpawn = "ghoulspawn";
else if ((FindSubString(sKiller, "Shadow")>-1)||(sRightTag=="shadowspawner")) sSpawn = "shadowspawn";
else if (FindSubString(sKiller, "Spectre")>-1) sSpawn = "spectrespawn";
else if (FindSubString(sKiller, "Wraith")>-1) sSpawn = "wraithspawn";
else if ((FindSubString(sKiller, "Wight")>-1)||(sRightTag=="wightspawner")) sSpawn = "wightspawn";
else if (FindSubString(sKiller, "Crypt Chanter")>-1) sSpawn = "wraithspawn";
else if (FindSubString(sKiller, "Bleakborn")>-1) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "Bodak")>-1) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "T'liz")>-1) sSpawn = "namechspawn";
else if ((FindSubString(sKiller, "Meorty")>-1) ||
(FindSubString(sKiller, "Amithrang")>-1)) sSpawn = "namechspawn";
}
else // Monster Killer
{
if (FindSubString(sKiller, "Tyrantfog")>-1) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "Ghast")>-1) sSpawn = "ghoulspawn";
else if (FindSubString(sKiller, "Ghoul")>-1) sSpawn = "ghoulspawn";
else if (((FindSubString(sKiller, "Meorty")>-1) ||
(FindSubString(sKiller, "Amithrang")>-1))) sSpawn = "namechspawn";
else if (FindSubString(sKiller, "Shadow")>-1) sSpawn = "shadowspawn";
else if (FindSubString(sKiller, "Spectre")>-1) sSpawn = "spectrespawn";
else if (FindSubString(sKiller, "Crypt Chanter")>-1) sSpawn = "wraithspawn";
else if (FindSubString(sKiller, "Bleakborn")>-1) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "Bodak")>-1) sSpawn = "zombiespawn";
else if (FindSubString(sKiller, "T'liz")>-1) sSpawn = "namechspawn";
else if ((FindSubString(sKiller, "Morg")>-1)||
(sRightTag=="vampirespawner")||
(sLeftTag=="vampirespawner")) sSpawn = "namechspawn";
/* //No Vampires on Athas
{
if (GetGender(OBJECT_SELF)==GENDER_FEMALE) sSpawn = "vampirespawn_f";
else sSpawn = "vampirespawn_m";
}*/
else if (FindSubString(sKiller, "Wight")>-1) sSpawn = "wightspawn";
if (FindSubString(sKiller, "Wraith")>-1) sSpawn = "wraithspawn";
}
return sSpawn;
}
int ShadeType(object oShadeKiller = OBJECT_INVALID)
{
int iShade = 0;
string sSpawn = "";
string sKiller = GetName(oShadeKiller);
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oShadeKiller);
string sRightTag = GetTag(oRight);
if ((FindSubString(sKiller, "Shadow")>-1)||(sRightTag=="shadowspawner")) iShade = 1;
else if (FindSubString(sKiller, "Spectre")>-1) iShade = 2;
if (FindSubString(sKiller, "Wraith")>-1) iShade = 3;
return iShade;
}
int IsSpawnable(int iSpawnRace)
{
int iSpawnable = 0;
if ((iSpawnRace == RACIAL_TYPE_ANIMAL)||
(iSpawnRace == RACIAL_TYPE_BEAST)||
(iSpawnRace == RACIAL_TYPE_MAGICAL_BEAST)||
(iSpawnRace == RACIAL_TYPE_SHAPECHANGER)||
(iSpawnRace == RACIAL_TYPE_VERMIN)||
(iSpawnRace == RACIAL_TYPE_ABERRATION)||
(iSpawnRace == RACIAL_TYPE_FEY)||
(iSpawnRace == RACIAL_TYPE_GIANT)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_GOBLINOID)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_MONSTROUS)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_ORC)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_REPTILIAN)||
(iSpawnRace == RACIAL_TYPE_DRAGON)||
(iSpawnRace == RACIAL_TYPE_DWARF)||
(iSpawnRace == RACIAL_TYPE_ELF)||
(iSpawnRace == RACIAL_TYPE_GNOME)||
(iSpawnRace == RACIAL_TYPE_HALFELF)||
(iSpawnRace == RACIAL_TYPE_HALFLING)||
(iSpawnRace == RACIAL_TYPE_HUMAN)||
(iSpawnRace == RACIAL_TYPE_HALFORC))
iSpawnable = 1;
return iSpawnable;
}
int IsNonHuman(int iSpawnRace)
{
int iSpawnable = 0;
if ((iSpawnRace == RACIAL_TYPE_ANIMAL)||
(iSpawnRace == RACIAL_TYPE_BEAST)||
(iSpawnRace == RACIAL_TYPE_DRAGON)||
(iSpawnRace == RACIAL_TYPE_MAGICAL_BEAST)||
(iSpawnRace == RACIAL_TYPE_VERMIN)||
(iSpawnRace == RACIAL_TYPE_ABERRATION)||
(iSpawnRace == RACIAL_TYPE_FEY)||
(iSpawnRace == RACIAL_TYPE_GIANT) ||
(iSpawnRace == RACIAL_TYPE_HUMANOID_GOBLINOID)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_MONSTROUS)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_ORC)||
(iSpawnRace == RACIAL_TYPE_HUMANOID_REPTILIAN))
iSpawnable = 1;
return iSpawnable;
}
int UndeadCheck(object oMyKiller)
{
int iPassed = 0;
int iSpawnVFX = VFX_FNF_SUMMON_UNDEAD;
object oMyKiller = GetLastKiller();
int iRace = GetRacialType(OBJECT_SELF);
int iKillerRace = GetRacialType(oMyKiller);
int iKillerUndeadClass = GetLevelByClass(CLASS_TYPE_UNDEAD, oMyKiller);
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oMyKiller);
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oMyKiller);
string sLeftTag = GetTag(oLeft);
string sRightTag = GetTag(oRight);
if ((iKillerRace==RACIAL_TYPE_UNDEAD)
||(iKillerUndeadClass>0)
||(sRightTag=="tyrantfogspawner")
||(sRightTag=="shadowspawner")
||(sRightTag=="CR_SLAM_PSISHAD1")
||(sLeftTag=="CR_SLAM_PSISHAD1")
||(sRightTag=="vampirespawner")
||(sLeftTag=="vampirespawner"))
if (IsSpawnable(iRace))
{
string sSpawnStr = SpawnOf(oMyKiller);
if (sSpawnStr != "")
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(iSpawnVFX), OBJECT_SELF);
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, sSpawnStr, GetLocation(OBJECT_SELF));
if (GetIsObjectValid(oSpawn)) iPassed = 1;
SetPortraitId(oSpawn, GetPortraitId(OBJECT_SELF));
if (GetIsPC(GetMaster(oMyKiller))||(GetIsPC(oMyKiller)))
{
SetName(oSpawn,GetName(OBJECT_SELF,FALSE)+" "+GetName(oSpawn,TRUE));
if (GetIsObjectValid(GetMaster(oMyKiller)))
AddHenchman(GetMaster(oMyKiller), oSpawn);
else AddHenchman(oMyKiller, oSpawn);
}
else
{
SetName(oSpawn,GetName(OBJECT_SELF,FALSE)+" "+GetName(oSpawn,TRUE));
//if (FindSubString(GetName(OBJECT_SELF)," Spawn")==-1) SetName(GetName(OBJECT_SELF)+ " Spawn");
ChangeFaction(oSpawn,oMyKiller);
}
int iShadeNum = 0;
if (IsNonHuman(iRace))
{
SetCreatureAppearanceType(oSpawn,GetAppearanceType(OBJECT_SELF));
iShadeNum = ShadeType(oMyKiller);
switch (iShadeNum)
{
case 1: //dark shadows
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR)),oSpawn,7.0);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(VFX_DUR_GHOST_TRANSPARENT)),oSpawn,7.0);
break;
case 2: //grey spectre
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(VFX_DUR_GHOST_TRANSPARENT)),oSpawn,7.0);
break;
case 3: //light wraith
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_GREY)),oSpawn,7.0);
break;
}
}
if (iShadeNum>0) //Fly off
{
DelayCommand(fUnlifespan-1.5,ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectDisappear(), oSpawn));
DestroyObject(oSpawn, fUnlifespan);
}
else // Decay and Disintegrate
{
DelayCommand(fUnlifespan-1.5,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_DEATH), oSpawn));
DestroyObject(oSpawn, fUnlifespan);
}
}
}
return iPassed;
}
//void main() {}

285
_module/nss/ar_st_pawn.nss Normal file
View File

@@ -0,0 +1,285 @@
//::////////////////////////////////////////////////////////////////////////////
//:: Store Open Script
//:: ar_st_ingredient
//:: 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,86 @@
//::///////////////////////////////////////////////
//:: PW Merchant Spawn System
//:: CV_PWStore_01.nss
//:: Copyright (c) 2012 Athas Reborn
//:://////////////////////////////////////////////
/*
Grabs a storename rezref from the calling NPC
(STORE_NAME string "STORE_NPCNAME"), checks
area INT VAR to see if store has been spawned.
Yes: Opens existing store with rezref of
"STORE_NAME".
No: Spawns store with rezref of "STORE_NAME"
& sets an area INT VAR so we aren't
constantly overwriting the existing store.
*/
//:://////////////////////////////////////////////
//:: Created By: DM Heatstroke
//:: Created On: January 23 2012
//:://////////////////////////////////////////////
#include "x0_i0_position"
void main()
{
object oMerchant = OBJECT_SELF;
object oBuyer = GetPCSpeaker();
object oModule = GetModule();
object oArea = GetArea(oMerchant);
location lMerchant = GetLocation(oMerchant);
location lBuyer = GetLocation(oBuyer);
location lStore = GetAheadLocation(oMerchant);
string sModule = GetModuleName();
string sAreaName = GetName(oArea, FALSE);
string sAreaRezRef =GetStringLowerCase(GetResRef(oArea));
string sBuyerName = GetName(oBuyer, FALSE);
string sMerchantName = GetName(oMerchant, FALSE);
string sMerchantRezRef = GetResRef(oMerchant);
string sStoreName = GetLocalString(oMerchant, "STORE_NAME");
string sSpawn = "Spawned";
string sAreaVar = InsertString(sSpawn, sStoreName, 0);
//:: Debug Stuff
/* SpeakString("Script Fired");
SpeakString("PC Name is: "+sBuyerName);
SpeakString("Module Name is: "+sModule);
SpeakString("Area Name is: "+sAreaName);
SpeakString("Area RezRef is: "+sAreaRezRef);
SpeakString("Area VAR name is: "+sAreaVar);
SpeakString("Merchant Name is: "+sMerchantName);
SpeakString("Merchant RezRef is: "+sMerchantRezRef);
SpeakString("Store RezRef is: "+sStoreName);
*/
if(!GetLocalInt(oArea, sAreaVar)) // See if the INT VAR is FALSE
{
//:: If not, create the store.
CreateObject(OBJECT_TYPE_STORE, sStoreName, lStore);
//:: Make INT VAR TRUE so we know the spawn has occured.
SetLocalInt(oArea, sAreaVar, TRUE);
//:: SpeakString("Shop has been spawned");
}
else
{
//:: SpeakString("Shop exists");
}
object oStore = GetNearestObjectByTag(sStoreName, OBJECT_SELF);
if (GetObjectType(oStore) == OBJECT_TYPE_STORE)
{
//:: Open store for PC in conversation.
DelayCommand(1.0, OpenStore(oStore, oBuyer));
}
else
{
ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK);
}
}

View File

@@ -0,0 +1,190 @@
//::///////////////////////////////////////////////
//:: Default:On Death
//:: NW_C2_DEFAULT7
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Shouts to allies that they have been killed
The default setting uses the BIOWARE default XP, simply
adjust the XP slider in Module Properties.
Change the variable NPC_XP to 1 to allow for XP per
3rd Ed DMG and adjustments for multiplayer and/or henchmen.
Adjust the XP slider to 0 in Module Properties.
*/
//:://////////////////////////////////////////////
//:: Created By: E.G. Hornbostel, aka Whyteshadow
//:: Modified by 69MEH69 June 2003
//:: Created On: 7/11/2002
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "lib_respawn"
void main()
{
//Change NPC_XP to 1 to initiate modified XP code
int NPC_XP = 0;
int BASEXP = 100;
int BONUSXP = 0;
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
//Added by Mr. Nathan
RespawnCreature(OBJECT_SELF, 60);
//^^^^^^^^^^^^^^^^^^
if(NPC_XP == 1)
{
float fCR = GetChallengeRating(OBJECT_SELF);
int nMonsterXP;
// Get number of party members, and average Party Level
int nPartyMembers;
int nPartyLevelSum;
float fAvgPartyLevel;
object oPC = GetFirstFactionMember(oKiller, TRUE);
object oKilledArea = GetArea(OBJECT_SELF);
object oHench;
while(GetIsObjectValid(oPC))
{
if(oKilledArea == GetArea(oPC))
{
nPartyMembers++;
nPartyLevelSum += GetHitDice(oPC);
oHench = GetHenchman(oPC);
while(GetIsObjectValid(oHench))
{
if(oKilledArea == GetArea(oHench))
{
nPartyMembers++;
nPartyLevelSum += GetHitDice(oHench);
}
oHench =GetHenchman(oHench);
}
}
oPC = GetNextFactionMember(oKiller, TRUE);
}
string sPartyMembers = IntToString(nPartyMembers);
//SendMessageToPC(oKiller, "Party Members = " +sPartyMembers);
if (nPartyMembers == 0)
return;
fAvgPartyLevel = IntToFloat(nPartyLevelSum) / IntToFloat(nPartyMembers);
// Bring partylevel up to 3 if less than 3
//if (FloatToInt(fAvgPartyLevel) < 3) fAvgPartyLevel = 3.0;
// Get the base Monster XP
if ((FloatToInt(fAvgPartyLevel) <= 6) && (fCR < 1.5))
nMonsterXP = BASEXP;
else
{
nMonsterXP = BASEXP * FloatToInt(fAvgPartyLevel);
int nDiff = FloatToInt(((fCR < 1.0) ? 1.0 : fCR) - fAvgPartyLevel);
switch (nDiff)
{
case -7:
nMonsterXP /= 12;
break;
case -6:
nMonsterXP /= 8;
break;
case -5:
nMonsterXP = nMonsterXP * 3 / 16;
break;
case -4:
nMonsterXP /= 4;
break;
case -3:
nMonsterXP /= 3;
break;
case -2:
nMonsterXP /= 2;
break;
case -1:
nMonsterXP = nMonsterXP * 2 / 3;
break;
case 0:
break;
case 1:
nMonsterXP = nMonsterXP * 3 / 2;
break;
case 2:
nMonsterXP *= 2;
break;
case 3:
nMonsterXP *= 3;
break;
case 4:
nMonsterXP *= 4;
break;
case 5:
nMonsterXP *= 6;
break;
case 6:
nMonsterXP *= 8;
break;
case 7:
nMonsterXP *= 12;
break;
default:
nMonsterXP = 0;
}
} // if ((FloatToInt(fAvgPartyLevel) < 6) && (fCR < 1.5)) {...} else {
// Calculations for CR < 1
if (fCR < 0.76 && nMonsterXP)
{
if (fCR <= 0.11)
nMonsterXP = nMonsterXP / 10;
else if (fCR <= 0.13)
nMonsterXP = nMonsterXP / 8;
else if (fCR <= 0.18)
nMonsterXP = nMonsterXP / 6;
else if (fCR <= 0.28)
nMonsterXP = nMonsterXP / 4;
else if (fCR <= 0.4)
nMonsterXP = nMonsterXP / 3;
else if (fCR <= 0.76)
nMonsterXP = nMonsterXP /2;
// Only the CR vs Avg Level table could set nMonsterXP to 0... to fix any
// round downs that result in 0:
if (nMonsterXP == 0) nMonsterXP = 1;
}
nMonsterXP += BONUSXP;
int nCharXP = nMonsterXP / nPartyMembers;
oPC = GetFirstFactionMember(oKiller);
while(GetIsObjectValid(oPC))
{
if (oKilledArea == GetArea(oPC))
GiveXPToCreature(oPC, nCharXP);
oPC = GetNextFactionMember(oKiller, TRUE);
}
}
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
}

View File

@@ -0,0 +1,92 @@
//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just been spawned in
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"
void Lining()
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_HORRID_WILTING), OBJECT_SELF);
DelayCommand(3.0, Lining());
}
void main()
{
SetLocalLocation(OBJECT_SELF, "SpawnHere", GetLocation(OBJECT_SELF));
DelayCommand(2.8, Lining());
// 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_SLEEP);
//Creatures that spawn in during the night will be asleep.
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_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.
// 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.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)
// 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 user 1000 - 1010
*/
//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
// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
string sTag=GetTag(OBJECT_SELF);
string sWaypoint="WP_"+sTag+"_01";
if (GetIsObjectValid(GetNearestObjectByTag(sWaypoint)))
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
else ActionRandomWalk();
}

View File

@@ -0,0 +1,92 @@
//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just been spawned in
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"
void Lining()
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_TENTACLE), OBJECT_SELF, 1.2);
DelayCommand(1.0, Lining());
}
void main()
{
SetLocalLocation(OBJECT_SELF, "SpawnHere", GetLocation(OBJECT_SELF));
DelayCommand(1.0, Lining());
// 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_SLEEP);
//Creatures that spawn in during the night will be asleep.
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_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.
// 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.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)
// 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 user 1000 - 1010
*/
//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
// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
string sTag=GetTag(OBJECT_SELF);
string sWaypoint="WP_"+sTag+"_01";
if (GetIsObjectValid(GetNearestObjectByTag(sWaypoint)))
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
else ActionRandomWalk();
}

View File

@@ -1252,8 +1252,8 @@ string ConvertLeetspeak(string sLetter)
case 36: return "|<";
case 11: return "1";
case 37: return "1";
case 12: return "/\/\";
case 38: return "/\/\";
//case 12: return "/\/\";
//case 38: return "/\/\";
case 13: return "|\|";
case 39: return "|\|";
case 14: return "0";

255
_module/nss/lib_respawn.nss Normal file
View File

@@ -0,0 +1,255 @@
//void main() {}
// Respawns oCreature after waiting nDelay heartbeats (default is 10 minutes)
// uses the location they died at if iUseWaypoint is set to 0. Otherwise, the
// number of waypoints to choose between (0 - n-1). If you specify 1 waypoint
// it respawns the creature where it was initially placed
// Make sure to tag waypoints "RespawnPoint"+ n>=0 or "YourWaypointTag"+ n>=0
// or whatever but don't forget the number at the end!
void RespawnCreature (object oCreature=OBJECT_SELF, int nDelay=900, int iUseWaypoint=1, string sRespawnTag="RespawnPoint");
// usage:
//
// if (GetIsPC(GetEnteringObject()) && !GetLocalInt(OBJECT_SELF, "Populated"))
// RepopArea();
//
// Should be used in the OnEnter event of an area.
// Make sure oArea is an area if you're not calling it from an area event.
void RepopArea (object oArea=OBJECT_SELF);
// usage:
//
// if (GetIsPC(GetExitingObject())
// && !GetIsPC(GetNearestCreatureToLocation(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, Location(OBJECT_SELF, Vector(10.0, 10.0, 1.0), 90.0))))
// DepopArea();
//
// Should be used in the OnExit event of an area.
// Make sure oArea is an area if you're not calling it from an area event.
void DepopArea (object oArea=OBJECT_SELF);
// used in RepopArea() to allow unique tags.
void CheckTag(object oCreature, string sTag, location lWhere);
// used in RepopArea() to keep track of wounded creatures so they don't heal
// upon repopping.
void CheckHP(object oCreature, int nHP);
//This was used to remove duplicate creatures that were produced
//when a pointer would become corrupted while cycling through.
//Bioware has released a workaround though so this is obsolete.
void RemoveDuplicates(object oCreature);
//Called by RemoveDuplicates
void DeleteDupes(object oCreature);
void RespawnToRepop(string sResRef, location lLoc, string sTag, int nHP=0);
void VoidCreateObject(string sResRef, location lLoc, string sTag, int nObjectType=OBJECT_TYPE_CREATURE)
{
CreateObject(nObjectType, sResRef, lLoc, FALSE, sTag);
}
void RespawnCreature (object oCreature=OBJECT_SELF, int nDelay=600, int iUseWaypoint=1, string sRespawnTag="RespawnPoint")
{
//Get the location, tag, and resref for the creature
string sResRef=GetResRef(oCreature);
string sTag=GetTag(oCreature);
location lDiedHere=GetLocation(oCreature);
location lSpawnedHere=GetLocalLocation(oCreature, "SpawnHere");
location lLoc;
if(iUseWaypoint==0)
{
//respawn where the creature died
lLoc=lDiedHere;
}
else if (iUseWaypoint==1)
{
//Respawn the creature where it was placed.
lLoc=lSpawnedHere;
}
else
{
//otherwise, respawn at a random waypoint of the range and name specified
int iRandom=Random(iUseWaypoint);
//used GetNearestObject... so they don't respawn in another area
object oRespawnPoint=GetNearestObjectByTag(sRespawnTag+IntToString(iRandom), oCreature);
//if there's no such waypoint, just respawn where you died
if (!GetIsObjectValid(oRespawnPoint))lLoc=lDiedHere;
else lLoc=GetLocation(oRespawnPoint);
}
if(GetLocalInt(GetArea(oCreature), "Populated"))
AssignCommand(GetModule(), DelayCommand(IntToFloat(nDelay), VoidCreateObject(sResRef, lLoc, sTag)));
else
AssignCommand(GetModule(), DelayCommand(IntToFloat(nDelay), RespawnToRepop(sResRef, lLoc, sTag)));
}
void RepopArea (object oArea=OBJECT_SELF)
{
int bPopulated=GetLocalInt(oArea, "Populated");
string sCreature;
object oCreature;
string sTag;
int nCount;
location lWhere;
int nHP;
int nTotal=GetLocalInt(oArea, "TotalMOBs");
for (nCount=1; nCount<=nTotal; nCount++)
{
sCreature=GetLocalString(oArea, "Creature"+IntToString(nCount));
sTag=GetLocalString(oArea, "Tag"+IntToString(nCount));
lWhere=GetLocalLocation(oArea, "Location"+IntToString(nCount));
nHP=GetLocalInt(oArea, "HP"+IntToString(nCount));
oCreature=CreateObject(OBJECT_TYPE_CREATURE, sCreature, lWhere, FALSE, sTag);
DelayCommand(0.4, CheckHP(oCreature, nHP));
// DelayCommand(0.5, RemoveDuplicates(oCreature));
DeleteLocalString(oArea, "Creature"+IntToString(nCount));
DeleteLocalString(oArea, "Tag"+IntToString(nCount));
DeleteLocalLocation(oArea, "Location"+IntToString(nCount));
DeleteLocalInt(oArea, "HP"+IntToString(nCount));
}
SetLocalInt(oArea, "Populated", TRUE);
DeleteLocalInt(oArea, "TotalMOBs");
}
void DepopArea(object oArea=OBJECT_SELF)
{
location lCheckPoint=Location(oArea, Vector(10.0, 10.0, 1.0), 90.0);
object oCreature=GetNearestCreatureToLocation(PLAYER_CHAR_IS_PC, PLAYER_CHAR_NOT_PC, lCheckPoint);
int nCount=1;
int nTotal=GetLocalInt(oArea, "TotalMOBs");
location lWhere;
int nHP;
while (GetIsObjectValid(oCreature))
{
lWhere=GetLocation(oCreature);
nHP=GetCurrentHitPoints(oCreature);
if (!GetIsPC(GetMaster(oCreature)) && !GetIsPC(GetMaster(GetMaster(oCreature)))
&& !GetIsPC(GetLocalObject(oCreature, "PCMaster")) )
{
SetLocalString(oArea, "Creature"+IntToString(nCount), GetResRef(oCreature));
SetLocalString(oArea, "Tag"+IntToString(nCount), GetTag(oCreature));
SetLocalLocation(oArea, "Location"+IntToString(nCount), lWhere);
SetLocalInt(oArea, "HP"+IntToString(nCount), nHP);
AssignCommand(oCreature, SetIsDestroyable(TRUE));
SetPlotFlag(oCreature, FALSE);
DestroyObject(oCreature);
}
nCount++;
oCreature=GetNearestCreatureToLocation(PLAYER_CHAR_IS_PC, PLAYER_CHAR_NOT_PC, lCheckPoint, nCount);
}
nCount--;
nTotal=nTotal+nCount;
SetLocalInt(oArea, "TotalMOBs", nTotal);
SetLocalInt(oArea, "Populated", FALSE);
}
void CheckTag(object oCreature, string sTag, location lWhere)
{
if (sTag!=GetTag(oCreature))
{
CopyObject(oCreature, lWhere, OBJECT_INVALID, sTag);
DestroyObject(oCreature, 0.1);
}
}
void CheckHP(object oCreature, int nHP)
{
int nCurrentHP=GetCurrentHitPoints(oCreature);
if (nHP==0) return;
if (nHP<nCurrentHP)
DelayCommand(0.2, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nCurrentHP-nHP), oCreature));
}
void RemoveDuplicates(object oCreature)
{
string sTag=GetTag(oCreature);
string sResRef=GetResRef(oCreature);
int nCount=1;
object oDouble=GetNearestObjectByTag(sTag, oCreature);
SetLocalInt(oCreature, "Master", TRUE);
while (GetIsObjectValid(oDouble) && (GetDistanceBetween(oCreature, oDouble)<=2.5))
{
SetLocalInt(oDouble, "Master", FALSE);
DelayCommand(0.5, DeleteDupes(oDouble));
nCount++;
oDouble=GetNearestObjectByTag(sTag, oCreature, nCount);
}
DeleteDupes(oCreature);
}
void DeleteDupes(object oCreature)
{
if (!GetLocalInt(oCreature, "Master"))
DestroyObject(oCreature);
}
void RespawnToRepop(string sResRef, location lLoc, string sTag, int nHP=0)
{
object oArea=GetAreaFromLocation(lLoc);
int nCount=GetLocalInt(oArea, "TotalMOBs")+1;
if(GetLocalInt(oArea, "Populated"))
VoidCreateObject(sResRef, lLoc, sTag);
else
{
SetLocalString(oArea, "Creature"+IntToString(nCount), sResRef);
SetLocalString(oArea, "Tag"+IntToString(nCount), sTag);
SetLocalLocation(oArea, "Location"+IntToString(nCount), lLoc);
SetLocalInt(oArea, "HP"+IntToString(nCount), nHP);
SetLocalInt(oArea, "TotalMOBs", nCount);
}
}

View File

@@ -33,19 +33,22 @@ object oNPC = OBJECT_SELF;
// Chance of guard type creatures dropping gear onDeath.
if ((GetResRef(oNPC) == "npc_baleasgrd001") ||
(GetResRef(oNPC) == "npc_goldeye001") ||
(GetResRef(oNPC) == "npc_baleasgrd003") ||
(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 3% chance to drop armor &/or equipped weapon
int bDroppableA = d100() > 97;
int bDroppableW = d100() > 97;
// 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);
}

View File

@@ -0,0 +1,69 @@
//::///////////////////////////////////////////////
//:: Example Item Event Script
//:: x2_it_example
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
This is an example on how to use the
new default module events for NWN to
have all code concerning one item in
a single file.
Note that this system only works, if
the following events set on your module
OnEquip - x2_mod_def_equ
OnUnEquip - x2_mod_def_unequ
OnAcquire - x2_mod_def_aqu
OnUnAcqucire - x2_mod_def_unaqu
OnActivate - x2_mod_def_act
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-09-10
//:://////////////////////////////////////////////
/*************************************************
* Hijacked by Mr. Nathan for the protection
* of purple worms everywhere.
*
* To change the DC of the swallow attack
* set PW_BITE_DC to the desired level.
* Default is 22.
**************************************************/
#include "x2_inc_switches"
const int PW_BITE_DC=22;
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
object oItem;
// * This code runs when the item has the OnHitCastSpell: Unique power property
// * and it hits a target(weapon) or is being hit (armor)
// * Note that this event fires for non PC creatures as well.
if (nEvent ==X2_ITEM_EVENT_ONHITCAST)
{
oItem = GetSpellCastItem(); // The item casting triggering this spellscript
object oSpellOrigin = OBJECT_SELF ;
object oSpellTarget = GetSpellTargetObject();
if(!ReflexSave(oSpellTarget, PW_BITE_DC))
{
FloatingTextStringOnCreature("You have been swallowed.", oSpellTarget);
DelayCommand(1.0, AssignCommand(oSpellTarget, ClearAllActions()));
DelayCommand(1.1, AssignCommand(oSpellTarget, JumpToLocation(GetLocation(GetWaypointByTag("WP_PW_Stomach")))));
SetLocalObject(GetArea(GetWaypointByTag("WP_PW_Stomach")), "Worm", oSpellOrigin);
SetLocalLocation(oSpellTarget, "WormReturn", GetLocation(oSpellTarget));
//This is an artifact of the respawning system I use inside the
//worm's stomach. It should not be removed unless that is modified.
SetLocalInt(GetArea(GetWaypointByTag("WP_PW_Stomach")), "Populated", TRUE);
}
}
}

View File

@@ -0,0 +1,12 @@
#include "lib_respawn"
void main()
{
string sResRef=GetResRef(OBJECT_SELF);
string sTag=GetTag(OBJECT_SELF);
location lLoc=GetLocation(OBJECT_SELF);
AssignCommand(GetModule(), DelayCommand(18.0, VoidCreateObject(sResRef, lLoc, sTag, OBJECT_TYPE_PLACEABLE)));
}

View File

@@ -0,0 +1,24 @@
void main()
{
if(GetLocalInt(OBJECT_SELF, "DoOnce")) return;
location lLoc=GetLocation(OBJECT_SELF);
object oPC=GetFirstObjectInShape(SHAPE_SPHERE, 25.0, lLoc, FALSE);
object oPW=OBJECT_SELF;
while(GetIsObjectValid(oPC))
{
if(GetIsPC(oPC))
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 6.0));
oPC=GetNextObjectInShape(SHAPE_SPHERE, 25.0, lLoc, FALSE);
AssignCommand(oPC, DelayCommand(0.8, PlaySound("sdr_paralyzed")));
AssignCommand(oPC, DelayCommand(2.5, PlaySound("sim_destruct_low")));
}
//earthquake visual effect. screen shake and rock falling sound
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(356), GetLocation(OBJECT_SELF), 7.0);
SetLocalInt(OBJECT_SELF, "DoOnce", TRUE);
}

View File

@@ -0,0 +1,75 @@
//::///////////////////////////////////////////////
//:: NW_C2_DIMDOORS.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnSpawnIn, sets up scorpions to teleport
during combat (requires scorp_onuserdef in the
user defined event slot for the creature)
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:: Modified By: Luna_C on 5/24/2003 for Scorpions Demo v1.0
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "NW_O2_CONINCLUDE"
void main()
{
SetLocalLocation(OBJECT_SELF, "SpawnHere", GetLocation(OBJECT_SELF));
GenerateNPCTreasure(4, OBJECT_SELF, OBJECT_SELF);
GenerateNPCTreasure(4, OBJECT_SELF, OBJECT_SELF);
// 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_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
// This will set the NPC to give a warning to non-enemies before attacking
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.
// 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.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)
// 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 user 1000 - 1010
*/
//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
// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
ExecuteScript("pw_enc_spawnin", OBJECT_SELF);
}

View File

@@ -0,0 +1,46 @@
//::///////////////////////////////////////////////
//:: NW_C2_DIMDOOR.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Creature randomly hops around
to enemies during combat.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: January 2002
//:://////////////////////////////////////////////
//:: Renamed Scorp_onuserdef 05/24/03 for Scorpions Demo v1.0
//:: Modified By Luna_C with invaluable help from Tallihnn and Allan Keliel.
//:: Be sure to use this with the scorp_spawn script in the onspawn script slot!
//:://////////////////////////////////////////////
void JumpToWeakestEnemy(object oTargetVictim)
{
object oTargetVictim = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
location lTargetVictim = GetLocation((oTargetVictim));
// * won't jump if closer than 4 meters to victim
if ((GetDistanceToObject(oTargetVictim) > 4.0) && (GetObjectSeen(oTargetVictim) == TRUE))
{
ClearAllActions();
effect eVis = EffectDisappearAppear (lTargetVictim);
int nDur=d6()+6;
DelayCommand(0.3,ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, OBJECT_SELF, IntToFloat(nDur)));
DelayCommand(9.0,ActionAttack(oTargetVictim));
}
}
void main()
{
// * During Combat try teleporting around
if (GetUserDefinedEventNumber() == 1003)
{
// * if random OR heavily wounded then teleport to next enemy
if ((Random(100) < 65) || ( (GetCurrentHitPoints() / GetMaxHitPoints()) * 100 < 50) )
{
JumpToWeakestEnemy(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY));
}
}
}

View File

@@ -0,0 +1,25 @@
void main()
{
object oPC = GetEnteringObject();
if (!GetIsObjectValid(oPC)) oPC=GetClickingObject();
object oArea=GetArea(oPC);
object oWorm=GetLocalObject(oArea, "Worm");
location lWhere=GetLocation(oWorm);
if(!GetIsPC(oPC)) return;
if(GetLocalInt(oArea, "CanLeave") || (d20()+GetAbilityModifier(ABILITY_STRENGTH, oPC)>=12))
{
if (!GetIsObjectValid(GetAreaFromLocation(lWhere))) lWhere=GetLocalLocation(oPC, "WormReturn");
SendMessageToPC(oPC, "You manage to claw your way out of the worm's mouth.");
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, JumpToLocation(lWhere));
}
else
SendMessageToPC(oPC, "You try to climb back out the mouth, but are held back by the action of the sphincters.");
}

View File

@@ -0,0 +1,52 @@
//::///////////////////////////////////////////////
//:: Default:On Death
//:: NW_C2_DEFAULT7
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Shouts to allies that they have been killed
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "lib_respawn"
void main()
{
object oKiller = GetLastKiller();
object oArea=GetArea(oKiller);
object oWorm=GetLocalObject(oArea, "Worm");
location lWhere=GetLocation(oWorm);
if (!GetIsPC(oKiller)) return;
if(!GetIsObjectValid(GetAreaFromLocation(lWhere))) lWhere=GetLocalLocation(oKiller, "WormReturn");
if(d20()+GetAbilityModifier(ABILITY_STRENGTH, oKiller)>=20)
{
SendMessageToPC(oKiller, "You manage to break through the worm's stomach lining and escape");
AssignCommand(oKiller, ClearAllActions());
AssignCommand(oKiller, JumpToLocation(lWhere));
}
//Added by Mr. Nathan
RespawnCreature(OBJECT_SELF, 30);
//^^^^^^^^^^^^^^^^^^
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
}

View File

@@ -433,6 +433,14 @@ void main()
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);
@@ -443,12 +451,4 @@ void main()
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN));
}
ms_Nomenclature(OBJECT_SELF);
rnd_skin(OBJECT_SELF);
rnd_head(OBJECT_SELF);
rnd_tattoo(OBJECT_SELF);
}

View File

@@ -4,44 +4,62 @@
Randomize appearance & clothing for commoners
*/
//:://////////////////////////////////////////////
//:: Created By: Jason Collins
//:: Created By: Jaysyn
//:: Created On: Sept 01, 2021
//:://////////////////////////////////////////////
void rnd_skin(object oPC)
{
// Randomize skin color
int nKeepskin = GetLocalInt(OBJECT_SELF,"RA_KEEPSKIN");
int nSkinColor;
nSkinColor = Random(15);
SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, nSkinColor);
if (nKeepskin != 1)
{
SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, nSkinColor);
}
}
void rnd_head(object oPC)
{
// Randomize head
int nKeephead = GetLocalInt(OBJECT_SELF,"RA_KEEPHEAD");
int nKeephair = GetLocalInt(OBJECT_SELF,"RA_KEEPHAIR");
int nHeadNumber;
nHeadNumber = Random(12)+1;
if (nKeephead != 1)
{
SetCreatureBodyPart(CREATURE_PART_HEAD, nHeadNumber, OBJECT_SELF);
}
// Randomize hair color
int nHairColor;
nHairColor = Random(15);
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, nHairColor);
if (nKeephair != 1)
{
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, nHairColor);
}
}
void rnd_tattoo(object oPC)
{
// Randomize Tattoos
int nKeeptats = GetLocalInt(OBJECT_SELF,"RA_KEEPTATS");
int nTattoo1;
nTattoo1 = Random(15);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, nTattoo1);
if (nKeeptats != 1)
{
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, nTattoo1);
}
int nTattoo2;
nTattoo2 = Random(15);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, nTattoo2);
if (nKeeptats != 1)
{
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, nTattoo2);
}
}
void rnd_clothes(object oPC)