void main() { object oChaosPC = GetLastUsedBy(); object oChaosDevise = GetObjectByTag("ba2_chaosdivice"); object oChaosPortal = GetObjectByTag("ba2_sladbtt"); object oChaosDragon = GetObjectByTag("ba2_drchainv"); effect eChaosBreath = EffectVisualEffect(494); effect eChaosBad = EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_FIRE); location lChaosEffects = GetLocation(GetWaypointByTag("ba2_cdargonsbrtar")); int nChaosUse = GetLocalInt(oChaosPC, "ba2_actlevxtimes"); int nChaosTag; string sChaosTag = GetTag(OBJECT_SELF); if(sChaosTag == "ba2_leverchaos1") { nChaosTag = 1; } else if(sChaosTag == "ba2_leverchaos2") { nChaosTag = 2; } else if(sChaosTag == "ba2_leverchaos3") { nChaosTag = 3; } else if(sChaosTag == "ba2_leverchaos4") { nChaosTag = 4; } else if(sChaosTag == "ba2_leverchaos5") { nChaosTag = 5; } else if(sChaosTag == "ba2_leverchaos6") { nChaosTag = 6; } else if(sChaosTag == "ba2_leverchaos7") { nChaosTag = 7; } else if(sChaosTag == "ba2_leverchaos8") { nChaosTag = 8; } else { nChaosTag = d8(); } int nChaosRoll = GetLocalInt(oChaosDevise, "DRoll"); int nSpawnRoll = d8(); if(GetLocalInt(oChaosDevise, "Activate") == 1) { if(!GetLocalInt(OBJECT_SELF, "TURNED")) { if(nChaosUse < 2) { ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE); SetLocalInt(OBJECT_SELF, "X2_L_PLC_ACTIVATED_STATE", TRUE); SetLocalInt(OBJECT_SELF, "TURNED", TRUE); nChaosUse = nChaosUse + 1; SetLocalInt(oChaosPC, "ba2_actlevxtimes", nChaosUse); if(nChaosTag == nChaosRoll) { SetLocalInt(oChaosPortal, "CanGo", TRUE); AssignCommand(oChaosDragon, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eChaosBreath, lChaosEffects)); AssignCommand(oChaosDragon, ActionSpeakString("Go if you wish...", TALKVOLUME_TALK)); } else { if(nSpawnRoll > 5) { CreateObject(OBJECT_TYPE_CREATURE, "ba2_biochh", lChaosEffects, TRUE); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eChaosBad, lChaosEffects); } else if(nSpawnRoll == 5 || nSpawnRoll == 4) { CreateObject(OBJECT_TYPE_CREATURE, "ba2_azerfwi", lChaosEffects, TRUE); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eChaosBad, lChaosEffects); } else { CreateObject(OBJECT_TYPE_CREATURE, "ba2_azermfi", lChaosEffects, TRUE); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eChaosBad, lChaosEffects); } } } else { SpeakString("You have tried alredy twice and failed. Begone!", TALKVOLUME_TALK); } } } }