20255/17/19 Update
Added PEPS AI. Full compile.
This commit is contained in:
@@ -1,90 +1,70 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: SetListeningPatterns
|
||||
//:: NW_C2_DEFAULT4
|
||||
//:: 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 "hench_i0_monsho"
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
Script: 0e_c2_4_convers
|
||||
Programmer: Philos
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Monster OnConversation;
|
||||
Fires when oCreature has been clicked on for conversation.
|
||||
Fires when oCreature hears a shout from another creature.
|
||||
If SetListening is FALSE then oCreature will not "hear" anything.
|
||||
*///////////////////////////////////////////////////////////////////////////////
|
||||
#include "0i_associates"
|
||||
void ai_MonsterCommands(object oCreature, object oSpeaker, int nMatch);
|
||||
void main()
|
||||
{
|
||||
// * if petrified, jump out
|
||||
if (GetHasEffect(EFFECT_TYPE_PETRIFY, OBJECT_SELF) == TRUE)
|
||||
object oCreature = OBJECT_SELF;
|
||||
ExecuteScript("prc_npc_conv", OBJECT_SELF);
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_default4", "15", GetName(oCreature) + " listens " +
|
||||
IntToString(GetListenPatternNumber()) + " to " + GetName(GetLastSpeaker()) + "." +
|
||||
" AI_AM_I_SEARCHING: " + IntToString(GetLocalInt(oCreature, AI_AM_I_SEARCHING)));
|
||||
if(ai_GetIsBusy(oCreature) || ai_Disabled(oCreature) || GetLocalInt(oCreature, AI_AM_I_SEARCHING)) return;
|
||||
if(ai_GetIsInCombat(oCreature))
|
||||
{
|
||||
ai_DoMonsterCombatRound(oCreature);
|
||||
return;
|
||||
}
|
||||
|
||||
// * If dead, exit directly.
|
||||
if (GetIsDead(OBJECT_SELF) == TRUE)
|
||||
object oLastSpeaker = GetLastSpeaker();
|
||||
int nMatch = GetListenPatternNumber();
|
||||
if(nMatch != -1)
|
||||
{
|
||||
return;
|
||||
if(GetFactionEqual(oLastSpeaker, oCreature)) ai_MonsterCommands(oCreature, oLastSpeaker, nMatch);
|
||||
}
|
||||
|
||||
//ExecuteScript("prc_npc_conv", OBJECT_SELF);
|
||||
|
||||
int nMatch = GetListenPatternNumber();
|
||||
object oShouter = GetLastSpeaker();
|
||||
object oIntruder;
|
||||
|
||||
if (nMatch == -1 && GetCommandable(OBJECT_SELF))
|
||||
else
|
||||
{
|
||||
if (GetCommandable(OBJECT_SELF))
|
||||
{
|
||||
ClearAllActions();
|
||||
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 (GetHasEffect(EFFECT_TYPE_CHARMED) == TRUE)
|
||||
{
|
||||
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
|
||||
BeginConversation();
|
||||
}
|
||||
|
||||
ai_ClearCreatureActions();
|
||||
BeginConversation();
|
||||
}
|
||||
else if(nMatch != -1 && GetIsObjectValid(oShouter) && !GetIsPC(oShouter) && GetIsFriend(oShouter))
|
||||
{
|
||||
if(nMatch == 4)
|
||||
{
|
||||
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
|
||||
}
|
||||
else if (nMatch == 5 || nMatch == 1)
|
||||
{
|
||||
oIntruder = GetLocalObject(oShouter, sHenchLastTarget);
|
||||
if(!GetIsObjectValid(oIntruder))
|
||||
{
|
||||
oIntruder = GetLastHostileActor(oShouter);
|
||||
if(!GetIsObjectValid(oIntruder))
|
||||
{
|
||||
oIntruder = GetAttemptedAttackTarget();
|
||||
if(!GetIsObjectValid(oIntruder))
|
||||
{
|
||||
oIntruder = GetAttemptedSpellTarget();
|
||||
if(!GetIsObjectValid(oIntruder))
|
||||
{
|
||||
oIntruder = OBJECT_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HenchMonRespondToShout(oShouter, nMatch, oIntruder);
|
||||
}
|
||||
|
||||
// Send the user-defined event if appropriate
|
||||
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
|
||||
{
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
|
||||
}
|
||||
}
|
||||
void ai_MonsterCommands(object oCreature, object oSpeaker, int nMatch)
|
||||
{
|
||||
object oTarget = GetLocalObject(oSpeaker, AI_MY_TARGET);
|
||||
if(nMatch == AI_ALLY_SEES_AN_ENEMY || nMatch == AI_ALLY_HEARD_AN_ENEMY)
|
||||
{
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_default4", "46", GetName(oCreature) + " heard " +
|
||||
GetName(oSpeaker) + " has seen an enemy!");
|
||||
if(ai_CanIAttack(oCreature)) ai_FindTheEnemy(oCreature, oSpeaker, oTarget, TRUE);
|
||||
}
|
||||
else if(nMatch == AI_ALLY_ATKED_BY_WEAPON ||
|
||||
nMatch == AI_ALLY_ATKED_BY_SPELL)
|
||||
{
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_default4", "53", GetName(oCreature) + " heard " +
|
||||
GetName(oSpeaker) + " has been attacked by " +
|
||||
GetName(GetLocalObject(oSpeaker, AI_MY_TARGET)) + "!");
|
||||
if(ai_CanIAttack(oCreature)) ai_FindTheEnemy(oCreature, oSpeaker, oTarget, TRUE);
|
||||
}
|
||||
else if(nMatch == AI_ALLY_IS_WOUNDED)
|
||||
{
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_default4", "60", GetName(oCreature) + " heard " +
|
||||
GetName(oSpeaker) + " is wounded!");
|
||||
if(ai_GetIsInCombat(oCreature)) ai_TryHealingTalent(oCreature, ai_GetNumOfEnemiesInRange(oCreature), oSpeaker);
|
||||
else ai_TryHealing(oCreature, oSpeaker);
|
||||
}
|
||||
/*else if(nMatch == AI_ALLY_IS_DEAD)
|
||||
{
|
||||
} */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user