2025/07/21 Update
Added PEPS AI. Full compile.
This commit is contained in:
201
_removed/nw_c2_default1.nss
Normal file
201
_removed/nw_c2_default1.nss
Normal file
@@ -0,0 +1,201 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Default On Heartbeat
|
||||
//:: NW_C2_DEFAULT1
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This script will have people perform default
|
||||
animations.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Nov 23, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
#include "NW_I0_GENERIC"
|
||||
#include "prc_inc_spells"
|
||||
|
||||
object GetNearestTougherFriend(object oSelf, object oPC) {
|
||||
|
||||
int i = 0;
|
||||
|
||||
object oFriend = oSelf;
|
||||
|
||||
int nEqual = 0;
|
||||
int nNear = 0;
|
||||
while (GetIsObjectValid(oFriend)) {
|
||||
if (GetDistanceBetween(oSelf,oFriend) < 40.0 && oFriend != oSelf) {
|
||||
++nNear;
|
||||
if (GetHitDice(oFriend) > GetHitDice(oSelf))
|
||||
return oFriend;
|
||||
if (GetHitDice(oFriend) == GetHitDice(oSelf))
|
||||
++nEqual;
|
||||
}
|
||||
++i;
|
||||
oFriend = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_FRIEND,
|
||||
oSelf, i);
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"LocalBoss",FALSE);
|
||||
if (nEqual == 0)
|
||||
if (nNear > 0 || GetHitDice(oPC)-GetHitDice(OBJECT_SELF) < 2) {
|
||||
SetLocalInt(OBJECT_SELF,"LocalBoss",TRUE);
|
||||
}
|
||||
|
||||
return OBJECT_INVALID;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
// * if not runnning normal or better Ai then exit for performance reasons
|
||||
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
|
||||
|
||||
ExecuteScript("prc_npc_hb", OBJECT_SELF);
|
||||
|
||||
// Pausanias: monsters try to find you.
|
||||
|
||||
if (GetGameDifficulty() >= GAME_DIFFICULTY_CORE_RULES) {
|
||||
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC,
|
||||
OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION,
|
||||
PERCEPTION_NOT_SEEN);
|
||||
|
||||
if (GetIsObjectValid(oPC) &&
|
||||
GetDistanceToObject(oPC) < 40.0 &&
|
||||
!GetIsObjectValid(GetLastHostileActor()) &&
|
||||
!GetIsInCombat() &&
|
||||
!GetIsFighting(OBJECT_SELF) &&
|
||||
d10() > 2 &&
|
||||
GetIsEnemy(oPC)) {
|
||||
|
||||
int ScoutMode = GetLocalInt(OBJECT_SELF,"ScoutMode");
|
||||
if (ScoutMode == 0) {
|
||||
ScoutMode = d2();
|
||||
SetLocalInt(OBJECT_SELF,"ScoutMode",ScoutMode);
|
||||
}
|
||||
object oTarget = GetNearestTougherFriend(OBJECT_SELF,oPC);
|
||||
if (!GetLocalInt(OBJECT_SELF,"LocalBoss")) {
|
||||
ClearAllActions();
|
||||
object oDoor = GetBlockingDoor();
|
||||
if (GetIsObjectValid(oDoor)) {
|
||||
if (GetLocked(oDoor))
|
||||
ExecuteScript("henchunlock",oDoor);
|
||||
if (GetIsDoorActionPossible(oDoor,DOOR_ACTION_OPEN) &&
|
||||
!GetLocked(oDoor) && !GetIsTrapped(oDoor)) {
|
||||
ActionOpenDoor(oDoor);
|
||||
SetLocalInt(OBJECT_SELF,"OpenedDoor",TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int fDist = 15;
|
||||
if (!GetIsObjectValid(oTarget) || ScoutMode == 1) {
|
||||
fDist = 10;
|
||||
oTarget = oPC;
|
||||
if (d10() > 5) fDist = 25;
|
||||
}
|
||||
|
||||
|
||||
location lNew;
|
||||
if (GetLocalInt(OBJECT_SELF,"OpenedDoor")) {
|
||||
lNew = GetLocalLocation(OBJECT_SELF,"ScoutZone");
|
||||
SetLocalInt(OBJECT_SELF,"OpenedDoor",FALSE);
|
||||
}
|
||||
else {
|
||||
vector vLoc = GetPosition(oTarget);
|
||||
vLoc.x += fDist-IntToFloat(Random(2*fDist+1));
|
||||
vLoc.y += fDist-IntToFloat(Random(2*fDist+1));
|
||||
vLoc.z += fDist-IntToFloat(Random(2*fDist+1));
|
||||
lNew = Location(GetArea(oTarget),vLoc,0.);
|
||||
SetLocalLocation(OBJECT_SELF,"ScoutZone",lNew);
|
||||
}
|
||||
|
||||
ActionMoveToLocation(lNew);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
|
||||
{
|
||||
if(TalentAdvancedBuff(40.0))
|
||||
{
|
||||
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING))
|
||||
{
|
||||
int nDay = FALSE;
|
||||
if(GetIsDay() || GetIsDawn())
|
||||
{
|
||||
nDay = TRUE;
|
||||
}
|
||||
if(GetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT") != nDay)
|
||||
{
|
||||
if(nDay == TRUE)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", FALSE);
|
||||
}
|
||||
WalkWayPoints();
|
||||
}
|
||||
}
|
||||
|
||||
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP))
|
||||
{
|
||||
if(!GetIsPostOrWalking())
|
||||
{
|
||||
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
|
||||
{
|
||||
if(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
|
||||
{
|
||||
if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) && !IsInConversation(OBJECT_SELF))
|
||||
{
|
||||
if(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN))
|
||||
{
|
||||
PlayMobileAmbientAnimations();
|
||||
}
|
||||
else if(GetIsEncounterCreature() &&
|
||||
!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
|
||||
{
|
||||
PlayMobileAmbientAnimations();
|
||||
}
|
||||
else if(GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS) &&
|
||||
!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
|
||||
{
|
||||
PlayImmobileAmbientAnimations();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DetermineSpecialBehavior();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//DetermineCombatRound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
|
||||
{
|
||||
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
|
||||
if(d10() > 6)
|
||||
{
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
|
||||
}
|
||||
}
|
210
_removed/nw_c2_default2.nss
Normal file
210
_removed/nw_c2_default2.nss
Normal file
@@ -0,0 +1,210 @@
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: NW_C2_DEFAULT2
|
||||
/*
|
||||
Default OnPerception event handler for NPCs.
|
||||
|
||||
Handles behavior when perceiving a creature for the
|
||||
first time.
|
||||
*/
|
||||
//:://////////////////////////////////////////////////
|
||||
#include "prc_inc_spells"
|
||||
#include "nw_i0_generic"
|
||||
|
||||
void main()
|
||||
{
|
||||
// * if not runnning normal or better Ai then exit for performance reasons
|
||||
// * if not runnning normal or better Ai then exit for performance reasons
|
||||
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
|
||||
|
||||
ExecuteScript("prc_npc_percep", OBJECT_SELF);
|
||||
|
||||
object oPercep = GetLastPerceived();
|
||||
int bSeen = GetLastPerceptionSeen();
|
||||
int bHeard = GetLastPerceptionHeard();
|
||||
if (bHeard == FALSE)
|
||||
{
|
||||
// Has someone vanished in front of me?
|
||||
bHeard = GetLastPerceptionVanished();
|
||||
}
|
||||
|
||||
// This will cause the NPC to speak their one-liner
|
||||
// conversation on perception even if they are already
|
||||
// in combat.
|
||||
if(GetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION)
|
||||
&& GetIsPC(oPercep)
|
||||
&& bSeen)
|
||||
{
|
||||
SpeakOneLinerConversation();
|
||||
}
|
||||
|
||||
// March 5 2003 Brent
|
||||
// Had to add this section back in, since modifications were not taking this specific
|
||||
// example into account -- it made invisibility basically useless.
|
||||
//If the last perception event was hearing based or if someone vanished then go to search mode
|
||||
if ((GetLastPerceptionVanished()) && GetIsEnemy(GetLastPerceived()))
|
||||
{
|
||||
object oGone = GetLastPerceived();
|
||||
if((GetAttemptedAttackTarget() == GetLastPerceived() ||
|
||||
GetAttemptedSpellTarget() == GetLastPerceived() ||
|
||||
GetAttackTarget() == GetLastPerceived()) && GetArea(GetLastPerceived()) != GetArea(OBJECT_SELF))
|
||||
{
|
||||
ClearAllActions();
|
||||
DetermineCombatRound();
|
||||
}
|
||||
}
|
||||
|
||||
// This section has been heavily revised while keeping the
|
||||
// pre-existing behavior:
|
||||
// - If we're in combat, keep fighting.
|
||||
// - If not and we've perceived an enemy, start to fight.
|
||||
// Even if the perception event was a 'vanish', that's
|
||||
// still what we do anyway, since that will keep us
|
||||
// fighting any visible targets.
|
||||
// - If we're not in combat and haven't perceived an enemy,
|
||||
// see if the perception target is a PC and if we should
|
||||
// speak our attention-getting one-liner.
|
||||
if (GetIsInCombat(OBJECT_SELF))
|
||||
{
|
||||
// don't do anything else, we're busy
|
||||
//MyPrintString("GetIsFighting: TRUE");
|
||||
|
||||
}
|
||||
// * BK FEB 2003 Only fight if you can see them. DO NOT RELY ON HEARING FOR ENEMY DETECTION
|
||||
else if (GetIsEnemy(oPercep) && bSeen)
|
||||
{ // SpawnScriptDebugger();
|
||||
//MyPrintString("GetIsEnemy: TRUE");
|
||||
// We spotted an enemy and we're not already fighting
|
||||
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP)) {
|
||||
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
|
||||
{
|
||||
//MyPrintString("DetermineSpecialBehavior");
|
||||
DetermineSpecialBehavior();
|
||||
} else
|
||||
{
|
||||
//MyPrintString("DetermineCombatRound");
|
||||
SetFacingPoint(GetPosition(oPercep));
|
||||
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
|
||||
DetermineCombatRound();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bSeen)
|
||||
{
|
||||
//MyPrintString("GetLastPerceptionSeen: TRUE");
|
||||
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) {
|
||||
DetermineSpecialBehavior();
|
||||
} else if (GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION)
|
||||
&& GetIsPC(oPercep))
|
||||
{
|
||||
// The NPC will speak their one-liner conversation
|
||||
// This should probably be:
|
||||
// SpeakOneLinerConversation(oPercep);
|
||||
// instead, but leaving it as is for now.
|
||||
ActionStartConversation(OBJECT_SELF);
|
||||
}
|
||||
}
|
||||
else
|
||||
// * July 14 2003: Some minor reactions based on invisible creatures being nearby
|
||||
if (bHeard && GetIsEnemy(oPercep))
|
||||
{
|
||||
// SpeakString("vanished");
|
||||
// * don't want creatures wandering too far after noises
|
||||
if (GetDistanceToObject(oPercep) <= 7.0)
|
||||
{
|
||||
// if (GetHasSpell(SPELL_TRUE_SEEING) == TRUE)
|
||||
if (GetHasSpell(SPELL_TRUE_SEEING))
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_TRUE_SEEING, OBJECT_SELF);
|
||||
}
|
||||
else
|
||||
// if (GetHasSpell(SPELL_SEE_INVISIBILITY) == TRUE)
|
||||
if (GetHasSpell(SPELL_SEE_INVISIBILITY))
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_SEE_INVISIBILITY, OBJECT_SELF);
|
||||
}
|
||||
else
|
||||
// if (GetHasSpell(SPELL_INVISIBILITY_PURGE) == TRUE)
|
||||
if (GetHasSpell(SPELL_INVISIBILITY_PURGE))
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_INVISIBILITY_PURGE, OBJECT_SELF);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActionPlayAnimation(ANIMATION_FIREFORGET_HEAD_TURN_LEFT, 0.5);
|
||||
ActionPlayAnimation(ANIMATION_FIREFORGET_HEAD_TURN_RIGHT, 0.5);
|
||||
ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// activate ambient animations or walk waypoints if appropriate
|
||||
if (!IsInConversation(OBJECT_SELF)) {
|
||||
if (GetIsPostOrWalking()) {
|
||||
WalkWayPoints();
|
||||
} else if (GetIsPC(oPercep) &&
|
||||
(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS)
|
||||
|| GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)
|
||||
|| GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS)
|
||||
|| GetIsEncounterCreature()))
|
||||
{
|
||||
SetAnimationCondition(NW_ANIM_FLAG_IS_ACTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send the user-defined event if appropriate
|
||||
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen())
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_PERCEIVE));
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// Werewolf Addon
|
||||
location lTransform = GetLocation(OBJECT_SELF);
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE,10.0,lTransform,FALSE,OBJECT_TYPE_CREATURE);
|
||||
string sNPCTag = GetTag(oTarget);
|
||||
string sMyTag = GetTag(OBJECT_SELF);
|
||||
int iIsMorph=GetAppearanceType(oTarget);
|
||||
|
||||
if (sMyTag != "PCwerewolf")
|
||||
{
|
||||
while(oTarget != OBJECT_INVALID)
|
||||
{
|
||||
if (GetIsPC(oTarget)&&(GetLocalInt(oTarget,"HAS_WEREWOLF_EFFECT")==1)&&(GetLocalInt(oTarget,"WasSeen")==1))
|
||||
{
|
||||
AdjustReputation(oTarget, oSelf, -100);
|
||||
SetIsTemporaryEnemy(oTarget, oSelf);
|
||||
AssignCommand(oSelf, DetermineCombatRound(oTarget));
|
||||
}
|
||||
if (!GetIsPC(oTarget)&&(GetTag(oTarget)=="PCwerewolf"))
|
||||
{
|
||||
AdjustReputation(oTarget, oSelf, -100);
|
||||
SetIsTemporaryEnemy(oTarget, oSelf);
|
||||
AssignCommand(oSelf, DetermineCombatRound(oTarget));
|
||||
}
|
||||
if (GetIsPC(oTarget)&&(iIsMorph==APPEARANCE_TYPE_WEREWOLF))
|
||||
{
|
||||
AdjustReputation(oTarget, oSelf, -100);
|
||||
SetIsTemporaryEnemy(oTarget, oSelf);
|
||||
AssignCommand(oSelf, DetermineCombatRound(oTarget));
|
||||
}
|
||||
//Get next object.
|
||||
oTarget = GetNextObjectInShape(SHAPE_SPHERE,10.0,lTransform,FALSE,OBJECT_TYPE_CREATURE);
|
||||
}
|
||||
}
|
||||
|
||||
if ((sMyTag == "PCwerewolf") && GetIsPC(oTarget) && (GetLocalInt(oTarget,"AFF_WEREWOLF") != 1))
|
||||
{
|
||||
while(oTarget != OBJECT_INVALID)
|
||||
{
|
||||
AdjustReputation(oTarget, oSelf, -100);
|
||||
SetIsTemporaryEnemy(oTarget, oSelf);
|
||||
AssignCommand(oSelf, DetermineCombatRound(oTarget));
|
||||
}
|
||||
//Get next object.
|
||||
oTarget = GetNextObjectInShape(SHAPE_SPHERE,10.0,lTransform,FALSE,OBJECT_TYPE_CREATURE);
|
||||
}
|
||||
}
|
66
_removed/nw_c2_default3.nss
Normal file
66
_removed/nw_c2_default3.nss
Normal file
@@ -0,0 +1,66 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Default: End of Combat Round
|
||||
//:: NW_C2_DEFAULT3
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
Calls the end of combat script every round
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Oct 16, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
#include "gsc_include"
|
||||
#include "NW_I0_GENERIC"
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_combat", OBJECT_SELF);
|
||||
|
||||
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
|
||||
{ // set variables on target for mounted combat
|
||||
DeleteLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL");
|
||||
DeleteLocalInt(OBJECT_SELF,"nX3_HP_BEFORE");
|
||||
DeleteLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT");
|
||||
if (GetHasFeat(FEAT_MOUNTED_COMBAT,OBJECT_SELF))
|
||||
{ // check for AC increase
|
||||
int nRoll=d20()+GetSkillRank(SKILL_RIDE);
|
||||
nRoll=nRoll-10;
|
||||
if (nRoll>4)
|
||||
{ // ac increase
|
||||
nRoll=nRoll/5;
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectACIncrease(nRoll),OBJECT_SELF,8.5);
|
||||
} // ac increase
|
||||
} // check for AC increase
|
||||
} // set variables on target for mounted combat
|
||||
|
||||
GSC_CheckDisarcionare(OBJECT_SELF);
|
||||
if (GetIsDead(GetAttackTarget())) //see below
|
||||
{ //..
|
||||
ClearAllActions(); //..
|
||||
DetermineCombatRound(); //..
|
||||
} //..
|
||||
else if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
|
||||
{
|
||||
DetermineSpecialBehavior();
|
||||
}
|
||||
else if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
|
||||
{
|
||||
DetermineCombatRound();
|
||||
}
|
||||
if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(1003));
|
||||
}
|
||||
//ExecuteScript("bug_armi",OBJECT_SELF);
|
||||
}
|
||||
/*Bio screwed up the A.I.-- big time. Attacking creatures--no re-evaluate of target
|
||||
if it's <span class="highlight">dying</span>. There is a check in the DetermineCombatRound() function,
|
||||
but it only does a "return;" if the target is dead or <span class="highlight">dying</span>. This means the
|
||||
creature continues its current action of attacking. Digging around in Bio A.I.
|
||||
is like swimming in tar now-- commented out, comment back in, moved this here,
|
||||
moved this there, etc. For now, best to make the fix here as it's easy to track
|
||||
and you can bet they will screw things up again in the A.I. files with patches or
|
||||
expansions. Break, fix, break fix, break, fix, ad nauseam....
|
||||
--Heed.*/
|
||||
|
||||
|
109
_removed/nw_c2_default4.nss
Normal file
109
_removed/nw_c2_default4.nss
Normal file
@@ -0,0 +1,109 @@
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: NW_C2_DEFAULT4
|
||||
/*
|
||||
Default OnConversation event handler for NPCs.
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: Copyright (c) 2002 Floodgate Entertainment
|
||||
//:: Created By: Naomi Novik
|
||||
//:: Created On: 12/22/2002
|
||||
//:://////////////////////////////////////////////////
|
||||
#include "prc_inc_spells"
|
||||
#include "nw_i0_generic"
|
||||
|
||||
void main()
|
||||
{
|
||||
// * if petrified, jump out
|
||||
if (PRCGetHasEffect(EFFECT_TYPE_PETRIFY, OBJECT_SELF) == TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// * If dead, exit directly.
|
||||
if (GetIsDead(OBJECT_SELF) == TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExecuteScript("prc_npc_conv", OBJECT_SELF);
|
||||
|
||||
// See if what we just 'heard' matches any of our
|
||||
// predefined patterns
|
||||
int nMatch = GetListenPatternNumber();
|
||||
object oShouter = GetLastSpeaker();
|
||||
|
||||
|
||||
//DMFI CODE ADDITIONS BEGIN HERE
|
||||
if (GetIsPC(oShouter))
|
||||
{
|
||||
ExecuteScript("dmfi_voice_exe", OBJECT_SELF);
|
||||
}
|
||||
|
||||
if (nMatch == -1 && GetIsPC(oShouter) &&(GetLocalInt(GetModule(), "dmfi_AllMute") || GetLocalInt(OBJECT_SELF, "dmfi_Mute")))
|
||||
{
|
||||
SendMessageToAllDMs(GetName(oShouter) + " is trying to speak to a muted NPC, " + GetName(OBJECT_SELF) + ", in area " + GetName(GetArea(OBJECT_SELF)));
|
||||
SendMessageToPC(oShouter, "This NPC is muted. A DM will be here shortly.");
|
||||
return;
|
||||
}
|
||||
//DMFI CODE ADDITIONS END HERE
|
||||
|
||||
|
||||
|
||||
if (nMatch == -1)
|
||||
{
|
||||
// Not a match -- start an ordinary conversation
|
||||
if (GetCommandable(OBJECT_SELF))
|
||||
{
|
||||
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
|
||||
BeginConversation();
|
||||
}
|
||||
else
|
||||
// * July 31 2004
|
||||
// * If only charmed then allow conversation
|
||||
// * so you can have a better chance of convincing
|
||||
// * people of lowering prices
|
||||
if (PRCGetHasEffect(EFFECT_TYPE_CHARMED) == TRUE)
|
||||
{
|
||||
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
|
||||
BeginConversation();
|
||||
}
|
||||
}
|
||||
// Respond to shouts from friendly non-PCs only
|
||||
else if (GetIsObjectValid(oShouter)
|
||||
&& !GetIsPC(oShouter)
|
||||
&& GetIsFriend(oShouter))
|
||||
{
|
||||
object oIntruder = OBJECT_INVALID;
|
||||
// Determine the intruder if any
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actually respond to the shout
|
||||
RespondToShout(oShouter, nMatch, oIntruder);
|
||||
}
|
||||
|
||||
// Send the user-defined event if appropriate
|
||||
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
|
||||
}
|
||||
}
|
101
_removed/nw_c2_default5.nss
Normal file
101
_removed/nw_c2_default5.nss
Normal file
@@ -0,0 +1,101 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Default On Attacked
|
||||
//:: NW_C2_DEFAULT5
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
If already fighting then ignore, else determine
|
||||
combat round
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Oct 16, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_i0_generic"
|
||||
|
||||
//DMFI CODE ADDITIONS*****************************
|
||||
void SafeFaction(object oCurrent, object oAttacker)
|
||||
{
|
||||
AssignCommand(oAttacker, ClearAllActions());
|
||||
AssignCommand(oCurrent, ClearAllActions());
|
||||
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oAttacker) <= 10)
|
||||
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oAttacker);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oAttacker) <= 10)
|
||||
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oAttacker);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oAttacker) <= 10)
|
||||
{ SetLocalInt(oAttacker, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oAttacker);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//END DMFI CODE ADDITIONS*************************
|
||||
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_physatt", OBJECT_SELF);
|
||||
|
||||
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
|
||||
{ // set variables on target for mounted combat
|
||||
SetLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL",TRUE);
|
||||
SetLocalInt(OBJECT_SELF,"nX3_HP_BEFORE",GetCurrentHitPoints(OBJECT_SELF));
|
||||
} // set variables on target for mounted combat
|
||||
|
||||
//DMFI CODE ADDITIONS*****************************
|
||||
if ((GetIsPC(GetLastAttacker()) && (GetLocalInt(GetModule(), "dmfi_safe_factions")==1)))
|
||||
{
|
||||
SafeFaction(OBJECT_SELF, GetLastAttacker());
|
||||
SpeakString("DM ALERT: Default non-hostile faction member attacked. Player: "+GetName(GetLastAttacker()), TALKVOLUME_SILENT_SHOUT);
|
||||
SendMessageToAllDMs("DMFI Safe Faction setting is currently set to ignore.");
|
||||
SendMessageToPC(GetLastAttacker(), "Script Fired.");
|
||||
return;
|
||||
}
|
||||
//END DMFI CODE ADDITIONS****************************
|
||||
|
||||
|
||||
if(GetFleeToExit()) {
|
||||
// Run away!
|
||||
ActivateFleeToExit();
|
||||
} else if (GetSpawnInCondition(NW_FLAG_SET_WARNINGS)) {
|
||||
// We give an attacker one warning before we attack
|
||||
// This is not fully implemented yet
|
||||
SetSpawnInCondition(NW_FLAG_SET_WARNINGS, FALSE);
|
||||
|
||||
//Put a check in to see if this attacker was the last attacker
|
||||
//Possibly change the GetNPCWarning function to make the check
|
||||
} else {
|
||||
object oAttacker = GetLastAttacker();
|
||||
if (!GetIsObjectValid(oAttacker)) {
|
||||
// Don't do anything, invalid attacker
|
||||
|
||||
} else if (!GetIsFighting(OBJECT_SELF)) {
|
||||
// We're not fighting anyone else, so
|
||||
// start fighting the attacker
|
||||
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) {
|
||||
SetSummonHelpIfAttacked();
|
||||
DetermineSpecialBehavior(oAttacker);
|
||||
} else if (GetArea(oAttacker) == GetArea(OBJECT_SELF)) {
|
||||
SetSummonHelpIfAttacked();
|
||||
DetermineCombatRound(oAttacker);
|
||||
}
|
||||
|
||||
//Shout Attack my target, only works with the On Spawn In setup
|
||||
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
|
||||
|
||||
//Shout that I was attacked
|
||||
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(GetSpawnInCondition(NW_FLAG_ATTACK_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_ATTACKED));
|
||||
}
|
||||
}
|
109
_removed/nw_c2_default6.nss
Normal file
109
_removed/nw_c2_default6.nss
Normal file
@@ -0,0 +1,109 @@
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: NW_C2_DEFAULT6
|
||||
//:: Default OnDamaged handler
|
||||
/*
|
||||
If already fighting then ignore, else determine
|
||||
combat round
|
||||
*/
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: Copyright (c) 2002 Floodgate Entertainment
|
||||
//:: Created By: Naomi Novik
|
||||
//:: Created On: 12/22/2002
|
||||
//:://////////////////////////////////////////////////
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: Modified By: Deva Winblood
|
||||
//:: Modified On: Jan 17th, 2008
|
||||
//:: Added Support for Mounted Combat Feat Support
|
||||
//:://////////////////////////////////////////////////
|
||||
|
||||
#include "nw_i0_generic"
|
||||
#include "x3_inc_horse"
|
||||
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_damaged", OBJECT_SELF);
|
||||
|
||||
object oDamager = GetLastDamager();
|
||||
object oMe=OBJECT_SELF;
|
||||
int nHPBefore;
|
||||
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
|
||||
if (GetHasFeat(FEAT_MOUNTED_COMBAT)&&HorseGetIsMounted(OBJECT_SELF))
|
||||
{ // see if can negate some damage
|
||||
if (GetLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL"))
|
||||
{ // last attack was physical
|
||||
nHPBefore=GetLocalInt(OBJECT_SELF,"nX3_HP_BEFORE");
|
||||
if (!GetLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT"))
|
||||
{ // haven't already had a chance to use this for the round
|
||||
SetLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT",TRUE);
|
||||
int nAttackRoll=GetBaseAttackBonus(oDamager)+d20();
|
||||
int nRideCheck=GetSkillRank(SKILL_RIDE,OBJECT_SELF)+d20();
|
||||
if (nRideCheck>=nAttackRoll&&!GetIsDead(OBJECT_SELF))
|
||||
{ // averted attack
|
||||
if (GetIsPC(oDamager)) SendMessageToPC(oDamager,GetName(OBJECT_SELF)+GetStringByStrRef(111991));
|
||||
//if (GetIsPC(OBJECT_SELF)) SendMessageToPCByStrRef(OBJECT_SELF,111992");
|
||||
if (GetCurrentHitPoints(OBJECT_SELF)<nHPBefore)
|
||||
{ // heal
|
||||
effect eHeal=EffectHeal(nHPBefore-GetCurrentHitPoints(OBJECT_SELF));
|
||||
AssignCommand(GetModule(),ApplyEffectToObject(DURATION_TYPE_INSTANT,eHeal,oMe));
|
||||
} // heal
|
||||
} // averted attack
|
||||
} // haven't already had a chance to use this for the round
|
||||
} // last attack was physical
|
||||
} // see if can negate some damage
|
||||
if(GetFleeToExit()) {
|
||||
// We're supposed to run away, do nothing
|
||||
} else if (GetSpawnInCondition(NW_FLAG_SET_WARNINGS)) {
|
||||
// don't do anything?
|
||||
} else {
|
||||
if (!GetIsObjectValid(oDamager)) {
|
||||
// don't do anything, we don't have a valid damager
|
||||
} else if (!GetIsFighting(OBJECT_SELF)) {
|
||||
// If we're not fighting, determine combat round
|
||||
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) {
|
||||
DetermineSpecialBehavior(oDamager);
|
||||
} else {
|
||||
if(!GetObjectSeen(oDamager)
|
||||
&& GetArea(OBJECT_SELF) == GetArea(oDamager)) {
|
||||
// We don't see our attacker, go find them
|
||||
ActionMoveToLocation(GetLocation(oDamager), TRUE);
|
||||
ActionDoCommand(DetermineCombatRound());
|
||||
} else {
|
||||
DetermineCombatRound();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We are fighting already -- consider switching if we've been
|
||||
// attacked by a more powerful enemy
|
||||
object oTarget = GetAttackTarget();
|
||||
if (!GetIsObjectValid(oTarget))
|
||||
oTarget = GetAttemptedAttackTarget();
|
||||
if (!GetIsObjectValid(oTarget))
|
||||
oTarget = GetAttemptedSpellTarget();
|
||||
|
||||
// If our target isn't valid
|
||||
// or our damager has just dealt us 25% or more
|
||||
// of our hp in damager
|
||||
// or our damager is more than 2HD more powerful than our target
|
||||
// switch to attack the damager.
|
||||
if (!GetIsObjectValid(oTarget)
|
||||
|| (
|
||||
oTarget != oDamager
|
||||
&& (
|
||||
GetTotalDamageDealt() > (GetMaxHitPoints(OBJECT_SELF) / 4)
|
||||
|| (GetHitDice(oDamager) - 2) > GetHitDice(oTarget)
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
// Switch targets
|
||||
DetermineCombatRound(oDamager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send the user-defined event signal
|
||||
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DAMAGED));
|
||||
}
|
||||
}
|
30
_removed/nw_c2_default8.nss
Normal file
30
_removed/nw_c2_default8.nss
Normal file
@@ -0,0 +1,30 @@
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: NW_C2_DEFAULT8
|
||||
/*
|
||||
Default OnDisturbed event handler for NPCs.
|
||||
*/
|
||||
//:://////////////////////////////////////////////////
|
||||
//:: Copyright (c) 2002 Floodgate Entertainment
|
||||
//:: Created By: Naomi Novik
|
||||
//:: Created On: 12/22/2002
|
||||
//:://////////////////////////////////////////////////
|
||||
|
||||
#include "nw_i0_generic"
|
||||
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_disturb", OBJECT_SELF);
|
||||
|
||||
object oTarget = GetLastDisturbed();
|
||||
|
||||
// If we've been disturbed and are not already fighting,
|
||||
// attack our disturber.
|
||||
if (GetIsObjectValid(oTarget) && !GetIsFighting(OBJECT_SELF)) {
|
||||
DetermineCombatRound(oTarget);
|
||||
}
|
||||
|
||||
// Send the disturbed flag if appropriate.
|
||||
if(GetSpawnInCondition(NW_FLAG_DISTURBED_EVENT)) {
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DISTURBED));
|
||||
}
|
||||
}
|
159
_removed/nw_c2_defaultb.nss
Normal file
159
_removed/nw_c2_defaultb.nss
Normal file
@@ -0,0 +1,159 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Default: On Spell Cast At
|
||||
//:: NW_C2_DEFAULTB
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This determines if the spell just cast at the
|
||||
target is harmful or not.
|
||||
|
||||
GZ 2003-Oct-02 : - New AoE Behavior AI. Will use
|
||||
Dispel Magic against AOES
|
||||
- Flying Creatures will ignore
|
||||
Grease
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Dec 6, 2001
|
||||
//:: Last Modified On: 2003-Oct-13
|
||||
//:://////////////////////////////////////////////
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Modified By: Deva Winblood
|
||||
//:: Modified On: Jan 4th, 2008
|
||||
//:: Added Support for Mounted Combat Feat Support
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_i0_generic"
|
||||
#include "x2_i0_spells"
|
||||
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_spellat", OBJECT_SELF);
|
||||
|
||||
object oCaster = GetLastSpellCaster();
|
||||
|
||||
|
||||
if(GetLastSpellHarmful())
|
||||
{
|
||||
SetCommandable(TRUE);
|
||||
|
||||
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
|
||||
{ // set variables on target for mounted combat
|
||||
DeleteLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL");
|
||||
} // set variables on target for mounted combat
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// If I was hurt by someone in my own faction
|
||||
// Then clear any hostile feelings I have against them
|
||||
// After all, we're all just trying to do our job here
|
||||
// if we singe some eyebrow hair, oh well.
|
||||
// ------------------------------------------------------------------
|
||||
if (GetFactionEqual(oCaster, OBJECT_SELF) == TRUE)
|
||||
{
|
||||
ClearPersonalReputation(oCaster, OBJECT_SELF);
|
||||
ClearAllActions(TRUE);
|
||||
DelayCommand(1.2, ActionDoCommand(DetermineCombatRound(OBJECT_INVALID)));
|
||||
// Send the user-defined event as appropriate
|
||||
if(GetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_SPELL_CAST_AT));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int bAttack = TRUE;
|
||||
// ------------------------------------------------------------------
|
||||
// GZ, 2003-Oct-02
|
||||
// Try to do something smart if we are subject to an AoE Spell.
|
||||
// ------------------------------------------------------------------
|
||||
if (MatchAreaOfEffectSpell(GetLastSpell()) == TRUE)
|
||||
{
|
||||
int nAI = (GetBestAOEBehavior(GetLastSpell())); // from x2_i0_spells
|
||||
switch (nAI)
|
||||
{
|
||||
case X2_SPELL_AOEBEHAVIOR_DISPEL_L:
|
||||
case X2_SPELL_AOEBEHAVIOR_DISPEL_N:
|
||||
case X2_SPELL_AOEBEHAVIOR_DISPEL_M:
|
||||
case X2_SPELL_AOEBEHAVIOR_DISPEL_G:
|
||||
case X2_SPELL_AOEBEHAVIOR_DISPEL_C:
|
||||
bAttack = FALSE;
|
||||
ActionCastSpellAtLocation(nAI, GetLocation(OBJECT_SELF));
|
||||
ActionDoCommand(SetCommandable(TRUE));
|
||||
SetCommandable(FALSE);
|
||||
break;
|
||||
|
||||
case X2_SPELL_AOEBEHAVIOR_FLEE:
|
||||
ClearActions(CLEAR_NW_C2_DEFAULTB_GUSTWIND);
|
||||
oCaster = GetLastSpellCaster();
|
||||
ActionForceMoveToObject(oCaster, TRUE, 2.0);
|
||||
DelayCommand(1.2, ActionDoCommand(DetermineCombatRound(oCaster)));
|
||||
bAttack = FALSE;
|
||||
break;
|
||||
|
||||
case X2_SPELL_AOEBEHAVIOR_IGNORE:
|
||||
// well ... nothing
|
||||
break;
|
||||
|
||||
case X2_SPELL_AOEBEHAVIOR_GUST:
|
||||
ActionCastSpellAtLocation(SPELL_GUST_OF_WIND, GetLocation(OBJECT_SELF));
|
||||
ActionDoCommand(SetCommandable(TRUE));
|
||||
SetCommandable(FALSE);
|
||||
bAttack = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Not an area of effect spell, but another hostile spell.
|
||||
// If we're not already fighting someone else,
|
||||
// attack the caster.
|
||||
// ---------------------------------------------------------------------
|
||||
if( !GetIsFighting(OBJECT_SELF) && bAttack)
|
||||
{
|
||||
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
|
||||
{
|
||||
DetermineSpecialBehavior(oCaster);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetermineCombatRound(oCaster);
|
||||
}
|
||||
}
|
||||
|
||||
// We were attacked, so yell for help
|
||||
SetCommandable(TRUE);
|
||||
//Shout Attack my target, only works with the On Spawn In setup
|
||||
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
|
||||
|
||||
//Shout that I was attacked
|
||||
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ---------------------------------------------------------------------
|
||||
// July 14, 2003 BK
|
||||
// If there is a valid enemy nearby and a NON HARMFUL spell has been
|
||||
// cast on me I should call DetermineCombatRound
|
||||
// I may be invisible and casting spells on myself to buff myself up
|
||||
// ---------------------------------------------------------------------
|
||||
// Fix: JE - let's only do this if I'm currently in combat. If I'm not
|
||||
// in combat, and something casts a spell on me, it'll make me search
|
||||
// out the nearest enemy, no matter where they are on the level, which
|
||||
// is kinda dumb.
|
||||
object oEnemy =GetNearestEnemy();
|
||||
if ((GetIsObjectValid(oEnemy) == TRUE) && (GetIsInCombat() == TRUE))
|
||||
{
|
||||
// SpeakString("keep me in combat");
|
||||
DetermineCombatRound(oEnemy);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the user-defined event as appropriate
|
||||
if(GetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_SPELL_CAST_AT));
|
||||
}
|
||||
|
||||
|
||||
}
|
51
_removed/nw_c2_defaulte.nss
Normal file
51
_removed/nw_c2_defaulte.nss
Normal file
@@ -0,0 +1,51 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Default On Blocked
|
||||
//:: NW_C2_DEFAULTE
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This will cause blocked creatures to open
|
||||
or smash down doors depending on int and
|
||||
str.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Nov 23, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
ExecuteScript("prc_npc_blocked", OBJECT_SELF);
|
||||
|
||||
object oDoor = GetBlockingDoor();
|
||||
if (GetObjectType(oDoor) == OBJECT_TYPE_CREATURE)
|
||||
{
|
||||
// * Increment number of times blocked
|
||||
/*SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED", GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") + 1);
|
||||
if (GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") > 3)
|
||||
{
|
||||
SpeakString("Blocked by creature");
|
||||
SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED",0);
|
||||
ClearAllActions();
|
||||
object oEnemy = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
|
||||
if (GetIsObjectValid(oEnemy) == TRUE)
|
||||
{
|
||||
ActionEquipMostDamagingRanged(oEnemy);
|
||||
ActionAttack(oEnemy);
|
||||
}
|
||||
return;
|
||||
} */
|
||||
return;
|
||||
}
|
||||
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
|
||||
{
|
||||
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) && GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
|
||||
{
|
||||
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
|
||||
}
|
||||
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
|
||||
{
|
||||
DoDoorAction(oDoor, DOOR_ACTION_BASH);
|
||||
}
|
||||
}
|
||||
}
|
75
_removed/nw_ch_ac4.nss
Normal file
75
_removed/nw_ch_ac4.nss
Normal file
@@ -0,0 +1,75 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Associate: On Dialogue
|
||||
//:: NW_CH_AC4
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
Determines the course of action to be taken
|
||||
by the generic script after dialogue or a
|
||||
shout is initiated.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Oct 24, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
#include "prc_inc_spells"
|
||||
#include "x0_inc_henai"
|
||||
|
||||
// * This function checks to make sure no
|
||||
// * dehibilating effects are on the player that should
|
||||
// * Don't use getcommandable for this since the dying system
|
||||
// * will sometimes leave a player in a noncommandable state
|
||||
int AbleToTalk(object oSelf)
|
||||
{
|
||||
if (GetCommandable(oSelf) == FALSE)
|
||||
{
|
||||
if (PRCGetHasEffect(EFFECT_TYPE_CONFUSED, oSelf) || PRCGetHasEffect(EFFECT_TYPE_DOMINATED, oSelf) ||
|
||||
PRCGetHasEffect(EFFECT_TYPE_PETRIFY, oSelf) || PRCGetHasEffect(EFFECT_TYPE_PARALYZE, oSelf) ||
|
||||
PRCGetHasEffect(EFFECT_TYPE_STUNNED, oSelf) || PRCGetHasEffect(EFFECT_TYPE_FRIGHTENED, oSelf)
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
object oMaster = GetMaster();
|
||||
int nMatch = GetListenPatternNumber();
|
||||
object oShouter = GetLastSpeaker();
|
||||
object oIntruder;
|
||||
|
||||
//DMFI CODE ADDITIONS BEGIN HERE
|
||||
if (!GetIsInCombat(OBJECT_SELF))
|
||||
ExecuteScript("dmfi_voice_exe", OBJECT_SELF);
|
||||
//DMFI CODE ADDITIONS END HERE
|
||||
|
||||
if (nMatch == -1) {
|
||||
if(AbleToTalk(OBJECT_SELF) || GetCurrentAction() != ACTION_OPENLOCK)
|
||||
{
|
||||
ClearActions(CLEAR_NW_CH_AC4_28);
|
||||
|
||||
// * if in XP2, use an alternative dialog file
|
||||
string sDialog = "";
|
||||
if (GetLocalInt(GetModule(), "X2_L_XP2") == 1)
|
||||
{
|
||||
sDialog = "x2_associate";
|
||||
}
|
||||
BeginConversation(sDialog);
|
||||
}
|
||||
} else {
|
||||
// listening pattern matched
|
||||
if (GetIsObjectValid(oShouter) && oMaster == oShouter)
|
||||
{
|
||||
SetCommandable(TRUE);
|
||||
bkRespondToHenchmenShout(oShouter, nMatch, oIntruder, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Signal user-defined event
|
||||
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT)) {
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
|
||||
}
|
||||
}
|
||||
|
67
_removed/nw_ch_summon_9.nss
Normal file
67
_removed/nw_ch_summon_9.nss
Normal file
@@ -0,0 +1,67 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Associate: On Spawn In
|
||||
//:: NW_CH_AC9
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
|
||||
This must support the OC henchmen and all summoned/companion
|
||||
creatures.
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: Nov 19, 2001
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Updated By: Georg Zoeller, 2003-08-20: Added variable check for spawn in animation
|
||||
|
||||
|
||||
#include "X0_INC_HENAI"
|
||||
#include "x2_inc_switches"
|
||||
void main()
|
||||
{
|
||||
//Sets up the special henchmen listening patterns
|
||||
SetAssociateListenPatterns();
|
||||
|
||||
// Set additional henchman listening patterns
|
||||
bkSetListeningPatterns();
|
||||
|
||||
//DMFI CODE ADDITIONS BEGIN HERE
|
||||
SetListening(OBJECT_SELF, TRUE);
|
||||
SetListenPattern(OBJECT_SELF, "**", 20600); //listen to all text
|
||||
SetLocalInt(OBJECT_SELF, "hls_Listening", 1); //listen to all text
|
||||
//DMFI CODE ADDITIONS END HERE
|
||||
|
||||
// Default behavior for henchmen at start
|
||||
SetAssociateState(NW_ASC_POWER_CASTING);
|
||||
SetAssociateState(NW_ASC_HEAL_AT_50);
|
||||
SetAssociateState(NW_ASC_RETRY_OPEN_LOCKS);
|
||||
SetAssociateState(NW_ASC_DISARM_TRAPS);
|
||||
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER, FALSE);
|
||||
|
||||
//Use melee weapons by default
|
||||
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE);
|
||||
|
||||
// Distance: make henchmen stick closer
|
||||
SetAssociateState(NW_ASC_DISTANCE_4_METERS);
|
||||
if (GetAssociate(ASSOCIATE_TYPE_HENCHMAN, GetMaster()) == OBJECT_SELF) {
|
||||
SetAssociateState(NW_ASC_DISTANCE_2_METERS);
|
||||
}
|
||||
|
||||
// * If Incorporeal, apply changes
|
||||
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) == TRUE)
|
||||
{
|
||||
effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
|
||||
eConceal = ExtraordinaryEffect(eConceal);
|
||||
effect eGhost = EffectCutsceneGhost();
|
||||
eGhost = ExtraordinaryEffect(eGhost);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
|
||||
}
|
||||
|
||||
|
||||
// Set starting location
|
||||
SetAssociateStartLocation();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user