99 lines
3.5 KiB
Plaintext
99 lines
3.5 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Default On Percieve
|
|
//:: MM_OnPercieve_Walkto
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Checks to see if the perceived target is an
|
|
enemy and if so fires the Determine Combat
|
|
Round function
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Oct 16, 2001
|
|
//:://////////////////////////////////////////////
|
|
#include "inc_utility"
|
|
#include "NW_I0_GENERIC"
|
|
|
|
void main()
|
|
{
|
|
// * 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 oPC = GetLastPerceived();
|
|
|
|
if (!GetIsPC(oPC)) return;
|
|
|
|
if (!GetLastPerceptionSeen()) return;
|
|
object oTarget;
|
|
oTarget = GetObjectByTag("NW_DEATH_CLERIC_01");
|
|
|
|
AssignCommand(oTarget, ActionMoveToObject(GetObjectByTag("hub_1968")));
|
|
|
|
oTarget = OBJECT_SELF;
|
|
|
|
//Visual effects can't be applied to waypoints, so if it is a WP
|
|
//the VFX will be applied to the WP's location instead
|
|
|
|
int nInt;
|
|
nInt = GetObjectType(oTarget);
|
|
|
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), oTarget);
|
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), GetLocation(oTarget));
|
|
|
|
|
|
|
|
//This is the equivalent of a force conversation bubble, should only be used if you want an NPC
|
|
//to say something while he is already engaged in combat.
|
|
if(GetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION) && GetIsPC(GetLastPerceived()) && GetLastPerceptionSeen())
|
|
{
|
|
SpeakOneLinerConversation();
|
|
}
|
|
//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();
|
|
}
|
|
}
|
|
//Do not bother checking the last target seen if already fighting
|
|
else if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
|
|
{
|
|
//Check if the last percieved creature was actually seen
|
|
if(GetLastPerceptionSeen())
|
|
{
|
|
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
|
|
{
|
|
DetermineSpecialBehavior();
|
|
}
|
|
else if(GetIsEnemy(GetLastPerceived()))
|
|
{
|
|
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP))
|
|
{
|
|
SetFacingPoint(GetPosition(GetLastPerceived()));
|
|
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
|
|
DetermineCombatRound();
|
|
}
|
|
}
|
|
//Linked up to the special conversation check to initiate a special one-off conversation
|
|
//to get the PCs attention
|
|
else if(GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION) && GetIsPC(GetLastPerceived()))
|
|
{
|
|
ActionStartConversation(OBJECT_SELF);
|
|
}
|
|
}
|
|
}
|
|
// Send the user-defined event if appropriate
|
|
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen())
|
|
{
|
|
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_PERCEIVE));
|
|
}
|
|
}
|