//:://///////////////////////////////////////////// //:: Name x2_def_heartbeat //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Default Heartbeat script */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: June 11/03 //::////////////////////////////////////////////// #include "prc_inc_spells" /* Swarm, Berzerker Wasp: 10 HD ar_berzwasp001 Swarm, Berzerker Wasp: 14 HD ar_berzwasp002 Swarm, Locust: 08 HD ds_locustswarm01 Swarm, Mini Kank: 04 HD ds_minkankswrm01 Swarm, Reptilian Bat: 04 HD ds_repbatswrm001 */ void FollowTarget(string sTargetTag, float fDistance); void FollowTarget(string sTargetTag, float fDistance) { object oTarget = GetObjectByTag(sTargetTag); if (GetIsObjectValid(oTarget)) { vector vTargetPosition = GetPosition(oTarget); vector vCurrentPosition = GetPosition(OBJECT_SELF); float fDistanceToTarget = VectorMagnitude(vTargetPosition - vCurrentPosition); // Move to the target if the distance is greater than the desired follow distance if (fDistanceToTarget > fDistance) { AssignCommand(OBJECT_SELF, ActionMoveToObject(oTarget, TRUE, fDistance)); } } } void main() { //:: Declare major variables object oNPC = OBJECT_SELF; object oArea = GetArea(oNPC); string sResRef = GetResRef(oNPC); string sAreaResRef = GetResRef(oArea); int nTrampleScore = (GetLocalInt(oNPC, "TRAMPLER") + GetHasFeat(FEAT_CENTAUR_TRAMPLE, oNPC)); int nChargeScore = (GetLocalInt(oNPC, "CHARGER") + GetHasFeat(FEAT_MINOTAUR_CHARGE, oNPC) + GetHasFeat(FEAT_ACROBATIC_CHARGE, oNPC) + GetHasFeat(FEAT_SHIELD_CHARGE ,oNPC) + GetHasFeat(FEAT_POWERFUL_CHARGE, oNPC) + GetHasFeat(FEAT_GREATER_POWERFUL_CHARGE, oNPC) + GetHasFeat(FEAT_RHINO_TRIBE_CHARGE, oNPC) + GetHasFeat(FEAT_FURIOUS_CHARGE, oNPC) + GetHasFeat(FEAT_RECKLESS_CHARGE, oNPC) + GetHasFeat(FEAT_COBALT_CHARGE, oNPC)); int nBullRushScore = (GetLocalInt(oNPC, "BULLRUSHER") + GetHasFeat(FEAT_IMPROVED_BULLRUSH, oNPC) + GetHasFeat(FEAT_RAMPAGING_BULL_RUSH, oNPC) + GetHasFeat(5241, oNPC) + //:: Expert Bull Rush GetHasFeat(5247, oNPC)); //:: Superior Bull Rush int iAwesomeBlow = GetHasFeat(FEAT_AWESOME_BLOW, oNPC); int iOverrun = GetHasFeat(FEAT_IMPROVED_OVERRUN, oNPC); //:: Run Various Combat Maneuver Heartbeats if(iOverrun) { if (GetLocalInt(oNPC, "OverrrunCooldown") != 1) { if(DEBUG) DoDebug( "x2_def_heartbeat: Creature w/ Overrun Detected"); DelayCommand(0.0f, ExecuteScript("overrunner_hb", oNPC)); } else if(DEBUG) DoDebug("x2_def_heartbeat: Overrun is on cooldown."); } if(iAwesomeBlow) { if (GetLocalInt(oNPC, "AwesomeBlowCooldown") != 1) { if(DEBUG) DoDebug("x2_def_heartbeat: Creature w/ Awesome Blow Detected"); DelayCommand(0.0f, ExecuteScript("awesomeblow_hb", oNPC)); } else if(DEBUG) DoDebug("x2_def_heartbeat: Awesome Blow is on cooldown."); } if(nTrampleScore) { if (GetLocalInt(oNPC, "TrampleCooldown") != 1) { if(DEBUG) DoDebug("x2_def_heartbeat: Trampler Detected"); DelayCommand(0.0f, ExecuteScript("trampler_hb", oNPC)); } else if(DEBUG) DoDebug("x2_def_heartbeat: Trample is on cooldown."); } if(nChargeScore) { if (GetLocalInt(oNPC, "ChargeCooldown") != 1) { if(DEBUG) DoDebug("x2_def_heartbeat: Charger Detected"); DelayCommand(0.0f, ExecuteScript("charger_hb", oNPC)); } else if(DEBUG) DoDebug("x2_def_heartbeat: Charge is on cooldown."); } if(nBullRushScore) { if (GetLocalInt(oNPC, "BullRushCooldown") != 1) { if(DEBUG) DoDebug("x2_def_heartbeat: Bull Rusher Detected"); DelayCommand(0.0f, ExecuteScript("bullrusher_hb", oNPC)); } else if(DEBUG) DoDebug("x2_def_heartbeat: Bull Rush is on cooldown."); } //:: Runs Malevolent Spirit HB if (sResRef == "malev_spirit001" ) { ExecuteScript("i420_ghost_hb", oNPC); } //:: Runs Mini-kank swarm HB if (sResRef == "ds_minkankswrm01" ) { ExecuteScript("cr_minikank_hb", oNPC); } //:: Runs Berzerker Wasp swarm HB if (sResRef == "ar_berzwasp001" || sResRef == "ar_berzwasp002" ) { ExecuteScript("cr_berzwasp_hb", oNPC); } //:: Runs special swarm HB if (sResRef == "ds_repbatswrm001" || sResRef == "ds_locustswarm01") { ExecuteScript("cr_locust_hb", oNPC); } //: Handles NPCs that spawn in captivity. (Sand Raiders Quest) if (sResRef == "npc_milos" || sResRef == "npc_flaron" || sResRef == "npc_alia") { if ((sAreaResRef == "alt_altaruk") || (sAreaResRef == "alt_wavircoster")) { SetLocalInt(oNPC, "FREED_NPC", 1); } if(GetLocalInt(oNPC, "FREED_NPC") == 0) { ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0, 7.0); } } //:: Make NPC followers follow the NPC (Sand Raiders Quest) if ((sAreaResRef != "alt_altaruk") && (sAreaResRef != "alt_wavircoster")) { if (sResRef == "npc_flaron" || sResRef == "npc_alia") { if(GetLocalInt(oNPC, "FREED_NPC") == 1) { FollowTarget("NPC_MILOS", 1.0f); } } } ExecuteScript("nw_c2_default1", oNPC); }