#include "hench_i0_ai" #include "events_inc" void main() { object oPC = GetEnteringObject(); if (GetLocalInt(GetArea(OBJECT_SELF), "AmbushPrepared") == FALSE) return; DeleteLocalInt(GetArea(OBJECT_SELF), "AmbushPrepared"); //TEST WriteTimestampedLogEntry("Entered ambush trigger"); string sAreaString = GetLocalString(GetArea(OBJECT_SELF), "AreaString"); string sRegionString = GetStringLeft(sAreaString, 1); int nLevel = GetLocalInt(GetArea(OBJECT_SELF), "Level"); if (nLevel == 1) nLevel = 0; else if (nLevel <= 3) nLevel = 1; else if (nLevel <= 20) nLevel = nLevel - 2; else nLevel = nLevel - 3; //Declare resref string variables string sEnemy1; string sEnemy2; string sEnemy3; string sEnemy4; string sEnemy5; string sEnemy6; string sAdd1; string sAdd2; string sAdd3; string sAdd4; string sAdd5; string sAdd6; //If the region is Green Coast (1) if (sRegionString == "1") { if (nLevel == 0) { sEnemy1 = "anc_rat"; //Rat } if (nLevel == 1) { sEnemy1 = "anc_goblin"; //Goblin (melee) sEnemy2 = "anc_goblinb"; //Goblin (ranged) } if (nLevel == 2) { if (Random(2) == 0) sEnemy1 = "anc_wolf"; //Wolf else { sEnemy1 = "anc_bandit"; //Bandit sEnemy2 = "anc_banditr"; //Bandit rogue sEnemy3 = "anc_bandita"; //Bandit archer } } if (nLevel == 3) { if (Random(3) == 0) { sEnemy1 = "anc_wererat"; //Wererat } else if (Random(2) == 0) { sEnemy1 = "anc_blackbear"; //Black bear sEnemy2 = "anc_boar"; //Boar } else { sEnemy1 = "anc_banditc"; //Bandit cleric sAdd1 = "anc_bandit"; //Bandit sAdd2 = "anc_banditr"; //Bandit rogue sAdd3 = "anc_bandita"; //Bandit archer } } if (nLevel == 4) { if (Random(3) == 0) { sEnemy1 = "anc_goblinelite"; //Goblin elite sEnemy2 = "anc_goblinshaman"; //Goblin shaman sEnemy3 = "anc_worg"; //Worg sAdd1 = "anc_goblin"; //Goblin (melee) sAdd2 = "anc_goblinb"; //Goblin (ranged) } else if (Random(2) == 0) { sEnemy1 = "anc_banditmage"; //Bandit mage sAdd1 = "anc_bandit"; //Bandit sAdd2 = "anc_banditr"; //Bandit rogue sAdd3 = "anc_bandita"; //Bandit archer sAdd4 = "anc_banditc"; //Bandit cleric } else { sEnemy1 = "anc_stinkbeetle"; //Stink beetle sAdd1 = "anc_blackbear"; //Black bear sAdd2 = "anc_boar"; //Boar } } if (nLevel == 5) { if (Random(2) == 0) { sEnemy1 = "anc_goblinrider"; //Goblin rider sAdd1 = "anc_goblinelite"; //Goblin elite sAdd2 = "anc_goblinshaman"; //Goblin shaman sAdd3 = "anc_worg"; //Worg } else sEnemy1 = "anc_troll"; //Troll } if (nLevel == 6) { sEnemy1 = "anc_werewolf"; //Werewolf } if (nLevel == 7) { sEnemy1 = "anc_gnoll"; //Gnoll } if (nLevel == 8) { if (Random(3) == 0) { sEnemy1 = "anc_stagbeetle"; //Stag beetle sAdd1 = "anc_stinkbeetle"; //Stink beetle sAdd2 = "anc_blackbear"; //Black bear sAdd3 = "anc_boar"; //Boar } else if (Random(2) == 0) { sEnemy1 = "anc_trollbers"; //Troll berserker sEnemy2 = "anc_trollcler"; //Troll shaman sAdd1 = "anc_troll"; //Troll } else { sEnemy1 = "anc_rakshasa"; //Rakshasa (male) sEnemy2 = "anc_rakshasaf"; //Rakshasa (female) } } if (nLevel == 9) { if (Random(2) == 0) { sEnemy1 = "anc_werewolfsh"; //Werewolf shaman sAdd1 = "anc_werewolf"; //Werewolf } else sEnemy1 = "anc_wboar"; //Wereboar } if (nLevel == 10) { sEnemy1 = "anc_gnollsh"; //Gnoll shaman sAdd1 = "anc_gnoll"; //Gnoll } if (nLevel == 11 || nLevel == 12) { if (Random(2) == 0) { sEnemy1 = "anc_hillgiant"; //Hill giant } else { sEnemy1 = "anc_hobgoblin"; //Hobgoblin (melee) sEnemy2 = "anc_hobgoblinr"; //Hobgoblin (ranged) } } if (nLevel == 13 || nLevel == 14) { if (Random(3) == 0) { sEnemy1 = "anc_hillgiantchi"; //Hill giant chieftain sAdd1 = "anc_hillgiant"; //Hill giant } else if (Random(2) == 0) { sEnemy1 = "anc_harpy"; //Harpy } else { sEnemy1 = "anc_bugbear"; //Bugbear } } if (nLevel == 15 || nLevel == 16) { sEnemy1 = "anc_hobgoblinsh"; //Hobgoblin shaman sAdd1 = "anc_hobgoblin"; //Hobgoblin (melee) sAdd2 = "anc_hobgoblinr"; //Hobgoblin (ranged) } if (nLevel == 17 || nLevel == 18) { if (Random(2) == 0) { sEnemy1 = "anc_bugbearsh"; //Bugbear shaman sEnemy2 = "anc_bugbearhero"; //Bugbear hero sAdd1 = "anc_bugbear"; //Bugbear } else { sEnemy1 = "anc_beetlemother"; //Hive mother sAdd1 = "anc_stagbeetle"; //Stag beetle } } if (nLevel == 19 || nLevel == 20) { sEnemy1 = "anc_raiter"; //Raiter } if (nLevel >= 21) { if (Random(2) == 0) { if (Random(3) == 0) { sAdd1 = "anc_scale_werewo"; //Red werewolf (scaling) } else if (Random(2) == 0) { sAdd1 = "anc_scale_bbearw"; //Bugbear elite (melee) sAdd2 = "anc_scale_bbeara"; //Bugbear elite (ranged) sAdd3 = "anc_scale_bbeahs"; //Bugbear high shaman } else { sAdd1 = "anc_scale_bandth"; //Black Eye bandit sAdd2 = "anc_scale_bandmb"; //Black Eye rider sAdd3 = "anc_scale_bandar"; //Black Eye archer sAdd4 = "anc_scale_bandro"; //Black Eye rogue sAdd5 = "anc_scale_bandwi"; //Black Eye mage sAdd6 = "anc_scale_bandcl"; //Black Eye cleric } } else { nLevel = GetLocalInt(GetArea(OBJECT_SELF), "Level"); if (Random(3) == 0) { sEnemy1 = "anc_scale_wereal"; //Red werewolf alpha (scaling) } else if (Random(2) == 0) { sEnemy1 = "anc_scale_bbeacw"; //Bugbear chieftain (melee) sEnemy2 = "anc_scale_bbeaca"; //Bugbear chieftain (ranged) sEnemy3 = "anc_scale_bbears"; //Bugbear archshaman } else { sEnemy1 = "anc_scale_bandof"; //Black Eye officer sEnemy2 = "anc_scale_bandca"; //Black Eye cavalryman sEnemy3 = "anc_scale_bandsn"; //Black Eye sniper sEnemy4 = "anc_scale_bandas"; //Black Eye assassin sEnemy5 = "anc_scale_bandam"; //Black Eye archmage sEnemy6 = "anc_scale_bandhp"; //Black Eye high priest } } } } string sWayTag; location lWaypoint; object oCreature; if (sAdd1 == "") { //Spawning a single enemy sWayTag = "event_wp_" + sAreaString + "_1"; lWaypoint = GetLocation(GetWaypointByTag(sWayTag)); oCreature = CreateObject(OBJECT_TYPE_CREATURE, SelectMain(sEnemy1, sEnemy2, sEnemy3, sEnemy4, sEnemy5, sEnemy6), lWaypoint, TRUE); ScaleCreature(oCreature, nLevel); DelayCommand(1.0, AssignCommand(oCreature, HenchDetermineCombatRound())); } else { int i; for (i = 1; i <= 2; i++) { sWayTag = "event_wp_" + sAreaString + "_" + IntToString(i); lWaypoint = GetLocation(GetWaypointByTag(sWayTag)); oCreature = CreateObject(OBJECT_TYPE_CREATURE, SelectAdd(sAdd1, sAdd2, sAdd3, sAdd4), lWaypoint, TRUE); ScaleCreature(oCreature, nLevel); DelayCommand(1.0, AssignCommand(oCreature, HenchDetermineCombatRound())); } } int nDC = GetLocalInt(GetArea(OBJECT_SELF), "Level"); if (nDC < 10) nDC = 10; effect eDaze = EffectLinkEffects(EffectVisualEffect(VFX_DUR_MIND_AFFECTING_NEGATIVE), EffectDazed()); if (!ReflexSave(oPC, nDC, SAVING_THROW_TYPE_TRAP)) ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDaze, oPC, 12.0); DeleteLocalInt(GetArea(OBJECT_SELF), "Level"); }