Amon_PRC8/_module/nss/nw_c2_default1.nss

103 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
//::///////////////////////////////////////////////
//:: 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 "hench_i0_ai"
void main()
{
DeleteLocalInt(OBJECT_SELF, HENCH_AI_SCRIPT_RUN_STATE);
// * 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);
// if (GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_HEARD)))
// {
// Jug_Debug("*****" + GetName(OBJECT_SELF) + " heartbeat action " + IntToString(GetCurrentAction()));
// }
if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
{
if(HenchTalentAdvancedBuff(40.0))
{
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
// TODO evalulate continue with combat
return;
}
}
if(GetHasEffect(EFFECT_TYPE_SLEEP))
{
if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
{
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
if(d10() > 6)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
}
}
}
// If we have the 'constant' waypoints flag set, walk to the next
// waypoint.
else if(!GetIsObjectValid(GetNearestSeenOrHeardEnemyNotDead(HENCH_MONSTER_DONT_CHECK_HEARD_MONSTER)))
{
CleanCombatVars();
if (GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
HenchDetermineSpecialBehavior();
}
else if (GetLocalInt(OBJECT_SELF, sHenchLastHeardOrSeen))
{
// continue to move to target
MoveToLastSeenOrHeard();
}
else if (DoStealthAndWander())
{
// nothing to do here
}
// sometimes waypoints are not initialized, special code for Helmed Horror in Host Tower level 4
else if ((GetTag(OBJECT_SELF) == "2Q6_HelmHorror") || GetWalkCondition(NW_WALK_FLAG_CONSTANT))
{
WalkWayPoints();
}
else
{
if(!IsInConversation(OBJECT_SELF))
{
if(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) ||
GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN) ||
GetIsEncounterCreature())
{
PlayMobileAmbientAnimations();
}
else if(GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS))
{
PlayImmobileAmbientAnimations();
}
}
}
}
else if (GetUseHeartbeatDetect())
{
// Jug_Debug(GetName(OBJECT_SELF) + " starting combat round in heartbeat");
HenchDetermineCombatRound();
}
if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT));
}
}