#include "nw_i0_2q4luskan"

void main()
{
//Set MYRG variable to 1
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "MYRG", 1);

//Spawn Owlbear to attack the PC
object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("WP_MYRG");
lTarget = GetLocation(oTarget);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_2), GetLocation(oTarget));
DelayCommand(1.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "owlbear", lTarget));

//Check to see if all words have been spoken;
//if so, destroy orb and replace with crystal ball;
//unlock exit door
int nInt1=GetLocalInt(oPC, "IXAM");
int nInt2=GetLocalInt(oPC, "ALRASTIL");
int nInt3=GetLocalInt(oPC, "PENTUKO");
int nInt4=GetLocalInt(oPC, "MYRG");
if ((nInt1 == 1)&&(nInt2 == 1)&&(nInt3 == 1)&&(nInt4 == 1))
   {
   SetPlotFlag(GetObjectByTag("OrbWhite"), FALSE);
   DestroyObject(GetObjectByTag("OrbWhite"),3.5);
   oTarget = GetWaypointByTag("WP_CrystalBall");
   lTarget = GetLocation(oTarget);
   DelayCommand(3.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "crystalballplc", lTarget));
   object oDoor = GetObjectByTag("DoorOrbRoom");
   SetLocked(oDoor, FALSE);
   }
else return;
}
