Mostly npc script adjusments

and placeable tag changes
This commit is contained in:
EpicValor
2023-09-04 21:06:50 -05:00
parent 430f3102d9
commit a896bdd164
62 changed files with 9383 additions and 293 deletions

View File

@@ -7,7 +7,7 @@ to an areacleanup script which cleans the area
void main()
{
float cleanupdelay = 600.0; //if you change this it alters how long before
float cleanupdelay = 300.0; //if you change this it alters how long before
// the area cleans up, if you do change it INCLUDE THE DECIMAL, or it won't
// work
if(!GetIsPC(GetExitingObject()) ) {

View File

@@ -0,0 +1,60 @@
//::///////////////////////////////////////////////
//:: npc_sit_stay
//:://////////////////////////////////////////////
/*Goes on the OnSpawn and OnConversation script of the NPC that you want to stay <span class="highlight">seated</span>*/
#include "nw_i0_spells"
#include "NW_I0_GENERIC"
void main()
{
int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
object oIntruder;
if (nMatch == -1 && GetCommandable(OBJECT_SELF))
{
ClearAllActions();
}
else
if(nMatch != -1 && GetIsObjectValid(oShouter) && !GetIsPC(oShouter) && GetIsFriend(oShouter))
{
if(nMatch == 4)
{
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
}
else if (nMatch == 5)
{
oIntruder = GetLastHostileActor(oShouter);
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedAttackTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedSpellTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = OBJECT_INVALID;
}
}
}
}
RespondToShout(oShouter, nMatch, oIntruder);
}
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
}
if(GetCommandable(OBJECT_SELF))
{
//{
//BeginConversation();
//}
ClearAllActions();
string sWay = "NW_STOP";
object oWay = GetRandomObjectByTag(sWay, 110.0);
ActionMoveToObject (oWay, FALSE);
}
DelayCommand(GetRandomDelay(180.0, 300.0), ExecuteScript("npc_sit_chair", OBJECT_SELF));
}

View File

@@ -52,11 +52,11 @@ void main()
int nChair = 50;
string sMyTagName = GetTag(OBJECT_SELF);
string sSittableTagName = "CHAIR";
object oChair = GetRandomObjectByTag(sSittableTagName, 99.0);
object oChair = GetRandomObjectByTag(sSittableTagName, 110.0);
ActionMoveToObject (oChair, FALSE);
ActionSit(oChair);
}
DelayCommand(GetRandomDelay(180.0, 240.0), ExecuteScript("npc_sit_chair", OBJECT_SELF));
DelayCommand(GetRandomDelay(180.0, 300.0), ExecuteScript("npc_sit_chair", OBJECT_SELF));
}

View File

@@ -53,10 +53,10 @@ void main()
int nChair = 1;
string sMyTagName = GetTag(OBJECT_SELF);
string sSittableTagName = "CHAIR_" + sMyTagName;
object oChair = GetRandomObjectByTag(sSittableTagName, 99.0);
object oChair = GetRandomObjectByTag(sSittableTagName, 110.0);
ActionMoveToObject (oChair, FALSE);
ActionSit(oChair);
}
DelayCommand(GetRandomDelay(30.0, 60.0), ExecuteScript("npc_sit_stay", OBJECT_SELF));
DelayCommand(GetRandomDelay(120.0, 300.0), ExecuteScript("npc_sit_stay", OBJECT_SELF));
}

View File

@@ -53,10 +53,10 @@ void main()
int nChair = 1;
string sMyTagName = GetTag(OBJECT_SELF);
string sSittableTagName = "Woodenbench";
object oChair = GetRandomObjectByTag(sSittableTagName, 99.0);
object oChair = GetRandomObjectByTag(sSittableTagName, 110.0);
ActionMoveToObject (oChair, FALSE);
ActionSit(oChair);
}
DelayCommand(GetRandomDelay(180.0, 240.0), ExecuteScript("npc_sit_woodenbe", OBJECT_SELF));
DelayCommand(GetRandomDelay(200.0, 280.0), ExecuteScript("npc_sit_woodenbe", OBJECT_SELF));
}

View File

@@ -0,0 +1,13 @@
#include "x0_i0_anims"
#include "x0_i0_treasure"
#include "x2_inc_switches"
void main()
{
SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
ClearAllActions();
ActionSit (GetNearestObjectByTag ("CHAIR", OBJECT_SELF));
DelayCommand(10.0,ExecuteScript("oldman_sit",OBJECT_SELF));
}

View File

@@ -0,0 +1,5 @@
void main()
{
ActionSit (GetNearestObjectByTag ("CHAIR_Queen", OBJECT_SELF));
DelayCommand(10.0,ExecuteScript("queen_sit",OBJECT_SELF));
}

View File

@@ -11,7 +11,7 @@
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "nw_i0_spells"
#include "ms_name_inc"
#include "rnd_commoner_inc"
#include "NW_O2_CONINCLUDE"
@@ -65,7 +65,7 @@ void main()
//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_IMMOBILE_AMBIENT_ANIMATIONS);
//SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//This will play Ambient Animations until the NPC sees an enemy or is cleared.
@@ -110,7 +110,8 @@ void main()
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
DelayCommand(10.5, ExecuteScript("npc_sit_woodenbe", OBJECT_SELF));
DelayCommand(GetRandomDelay(5.0, 15.0), ExecuteScript("npc_sit_woodenbe", OBJECT_SELF));
}

View File

@@ -11,7 +11,7 @@
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "nw_i0_spells"
#include "ms_name_inc"
#include "rnd_commoner_inc"
#include "NW_O2_CONINCLUDE"
@@ -110,7 +110,8 @@ void main()
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
DelayCommand(10.5, ExecuteScript("npc_sit_stay", OBJECT_SELF));
DelayCommand(GetRandomDelay(5.0, 15.0), ExecuteScript("npc_sit_stay", OBJECT_SELF));
}

View File

@@ -0,0 +1,117 @@
//::///////////////////////////////////////////////
//:: 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_i0_spells"
#include "ms_name_inc"
#include "rnd_commoner_inc"
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"
void main()
{
// Randomize Skin Tone
rnd_skin(OBJECT_SELF);
// Randomize Head & Hair color
rnd_head(OBJECT_SELF);
// Randomize Tattoos
rnd_tattoo(OBJECT_SELF);
// Randomize Clothing
rnd_clothes(OBJECT_SELF);
// Randomize Last Name Usage
int bNameChance = d100() > 33;
SetLocalInt(OBJECT_SELF, "NAME_TYPE", bNameChance);
int nOneName = GetLocalInt(OBJECT_SELF,"SINGLE_NAME");
if (nOneName = 1)
{
SetLocalInt(OBJECT_SELF, "NAME_TYPE", 0);
}
//Calls the Random Name Generator
ms_Nomenclature(OBJECT_SELF);
// 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.
SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
// Interacts with placeables + More civilized actions. See Readme.
SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
// Will use random voicechats during animations, if Civilized
// NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)
//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) *****************************************************************************************
SetLocalInt(OBJECT_SELF, "iDialogue", Random(10) + 1);
SetLocalInt(OBJECT_SELF, "iRumor", Random(60) + 1);
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.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
DelayCommand(GetRandomDelay(5.0, 15.0), ExecuteScript("re_rndwayp_go", OBJECT_SELF));
}

View File

@@ -0,0 +1,60 @@
//::///////////////////////////////////////////////
//:: npc_sit_stay
//:://////////////////////////////////////////////
/*Goes on the OnSpawn and OnConversation script of the NPC that you want to stay <span class="highlight">seated</span>*/
#include "nw_i0_spells"
#include "NW_I0_GENERIC"
void main()
{
int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
object oIntruder;
if (nMatch == -1 && GetCommandable(OBJECT_SELF))
{
ClearAllActions();
}
else
if(nMatch != -1 && GetIsObjectValid(oShouter) && !GetIsPC(oShouter) && GetIsFriend(oShouter))
{
if(nMatch == 4)
{
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
}
else if (nMatch == 5)
{
oIntruder = GetLastHostileActor(oShouter);
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedAttackTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedSpellTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = OBJECT_INVALID;
}
}
}
}
RespondToShout(oShouter, nMatch, oIntruder);
}
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
}
if(GetCommandable(OBJECT_SELF))
{
//{
//BeginConversation();
//}
ClearAllActions();
string sWay = "NW_STOP";
object oWay = GetRandomObjectByTag(sWay, 110.0);
ActionMoveToObject (oWay, FALSE);
}
DelayCommand(GetRandomDelay(180.0, 300.0), ExecuteScript("re_rndwayp_go", OBJECT_SELF));
}

View File

@@ -0,0 +1,89 @@
//:://////////////////////////////////////////////////
//:: X0_CH_HEN_HEART
/*
OnHeartbeat event handler for henchmen/associates.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 01/05/2003
//:://////////////////////////////////////////////////
#include "X0_INC_HENAI"
void main()
{ // SpawnScriptDebugger();
// If the henchman is in dying mode, make sure
// they are non commandable. Sometimes they seem to
// 'slip' out of this mode
int bDying = GetIsHenchmanDying();
if (bDying == TRUE)
{
int bCommandable = GetCommandable();
if (bCommandable == TRUE)
{
// lie down again
ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT,
1.0, 65.0);
SetCommandable(FALSE);
}
}
// If we're dying or busy, we return
// (without sending the user-defined event)
if(GetAssociateState(NW_ASC_IS_BUSY) ||
bDying)
return;
// Check to see if should re-enter stealth mode
if (GetIsInCombat() == FALSE)
{
int nStealth=GetLocalInt(OBJECT_SELF, "X2_HENCH_STEALTH_MODE");
if((nStealth == 1 || nStealth == 2)
&& GetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH) == FALSE)
{
SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, TRUE);
effect eEffect = ExtraordinaryEffect(EffectMovementSpeedIncrease(50));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, OBJECT_SELF, 6.0);
}
}
// * checks to see if a ranged weapon was being used
// * if so, it equips it back
if (GetIsInCombat() == FALSE)
{ // SpawnScriptDebugger();
object oRight = GetLocalObject(OBJECT_SELF, "X0_L_RIGHTHAND");
if (GetIsObjectValid(oRight) == TRUE)
{ // * you always want to blank this value, if it not invalid
SetLocalObject(OBJECT_SELF, "X0_L_RIGHTHAND", OBJECT_INVALID);
if (GetWeaponRanged(oRight) == TRUE)
{
ClearAllActions();
bkEquipRanged(OBJECT_INVALID, TRUE, TRUE);
//ActionEquipItem(
return;
}
}
}
ExecuteScript("race_hb", OBJECT_SELF);
ExecuteScript("nw_ch_ac1", OBJECT_SELF);
}