//:://///////////////////////////////////////////// //:: Name codi_heartbeat //:: //::////////////////////////////////////////////// /* NPC Heartbeat event script caller to run CODI AI & PRC events. */ //::////////////////////////////////////////////// //:: Created By: Jaysyn //:: Created On: 20240331 //::////////////////////////////////////////////// void main() { //:: Declare major variables object oNPC = OBJECT_SELF; object oAttacker; string sResRef = GetResRef(oNPC); //:: Runs special swarm HB // if (sResRef == "ds_repbatswrm001" || // sResRef == "ds_minkankswrm01" || // sResRef == "ds_locustswarm01" || // sResRef == "ar_berzwasp001" || // sResRef == "ar_berzwasp002" ) // { // ExecuteScript("cr_locust_hb", oNPC); // } //:: Equips best armor if ((!GetIsInCombat(oNPC) && (GetItemInSlot(INVENTORY_SLOT_CHEST) == OBJECT_INVALID))) DelayCommand(0.5f, ActionEquipMostEffectiveArmor()); //:: Handles Vampire's Gaseous form death. if(sResRef == "ra_vamp_gas_form") { //:: Get nearest alive PC. oAttacker = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oNPC, 1, CREATURE_TYPE_IS_ALIVE, TRUE); //:: Set destroyable. SetIsDestroyable(TRUE, FALSE, FALSE); //:: Remove plot/immoral/lootable flags JUST in case. SetPlotFlag(oNPC, FALSE); SetImmortal(oNPC, FALSE); SetLootable(oNPC, FALSE); //:: Clear Actions & run away ClearAllActions(); ActionMoveAwayFromObject(oAttacker, TRUE, 300.0f); //:: Destroy ourselves after fleeing the scene DelayCommand(10.0f, DestroyObject(oNPC)); } //:: Execute the CODI NPC OnHeartbeat script ExecuteScript("no_ai_hrt", oNPC); //:: Execute the default NPC OnHeartbeat script //ExecuteScript("nw_c2_default1", oNPC); //:: Execute the PRC NPC OnHeartbeat script ExecuteScript("prc_npc_hb", oNPC); }