2025/07/21 Update
Added PEPS AI. Full compile.
This commit is contained in:
@@ -1,75 +1,45 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: 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;
|
||||
}
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
Script: nw_ch_ac4
|
||||
Programmer: Philos
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Associate(Summons, Familiar, Companion) OnDialoge event script;
|
||||
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"
|
||||
#include "nw_inc_gff"
|
||||
void main()
|
||||
{
|
||||
object oMaster = GetMaster();
|
||||
object oCreature = OBJECT_SELF;
|
||||
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);
|
||||
}
|
||||
if(AI_DEBUG) ai_Debug("nw_ch_ac4", "16", GetName(oCreature) + " listens " +
|
||||
IntToString(nMatch) + " to " + GetName(GetLastSpeaker()) + ".");
|
||||
// Skip ASSOCIATE_COMMAND_MASTERUNDERATTACK(11) since it fires for
|
||||
// every physical attack made on our master. This fires alot!
|
||||
if(nMatch == ASSOCIATE_COMMAND_MASTERUNDERATTACK) return;
|
||||
// If we are disabled then we can't listen or talk, Busy is checked in ai_SelectAssociateCommand().
|
||||
if(ai_Disabled(oCreature)) return;
|
||||
object oLastSpeaker = GetLastSpeaker();
|
||||
// Some commands override being busy so we check in ai_SelectAssociateCommand.
|
||||
if(nMatch != -1)
|
||||
{
|
||||
if(GetFactionEqual(oLastSpeaker, oCreature)) ai_SelectAssociateCommand(oCreature, oLastSpeaker, nMatch);
|
||||
}
|
||||
|
||||
// Signal user-defined event
|
||||
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT)) {
|
||||
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
|
||||
else
|
||||
{
|
||||
if (!ai_GetIsBusy(oCreature))
|
||||
{
|
||||
ai_ClearCreatureActions();
|
||||
if(GetAssociateType(oCreature) == ASSOCIATE_TYPE_HENCHMAN) BeginConversation("oc_ai_henchmen", oLastSpeaker);
|
||||
else
|
||||
{
|
||||
json jHenchman = ObjectToJson(oCreature);
|
||||
string sConversation = JsonGetString(GffGetResRef(jHenchman, "Conversation"));
|
||||
if(sConversation == "") BeginConversation("oc_ai_henchmen", oLastSpeaker);
|
||||
BeginConversation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user