///////////////////////////////////////////////////////////////
// Activate Dwarven Fire
///////////////////////////////////////////////////////////////
void fnBurningSound()
{
  PlaySound("al_cv_firelarge1");
  DelayCommand(10.0,fnBurningSound());
} // fnBurningSound()

void main()
{
    object oPC=GetLastUsedBy();
    object oArea=GetArea(oPC);
    int nC;
    object oFire;
    object oWP;
    int nActive=GetLocalInt(oArea,"nFireActive");
    if (nActive==TRUE)
    { // turn it off
      SendMessageToPC(oPC,"You turn off the main entry way fire defenses.");
      SetLocalInt(oArea,"nFireActive",FALSE);
      nC=1;
      while(nC<11)
      { // destroy fires
        oWP=GetWaypointByTag("DWF_FIRE"+IntToString(nC));
        oFire=GetLocalObject(oWP,"oFire");
        if (oFire!=OBJECT_INVALID) DestroyObject(oFire);
        nC++;
      } // destroy fires
    } // turn it off
    else
    { // turn it on
      SendMessageToPC(oPC,"You turn on the main entry way fire defenses.");
      SetLocalInt(oArea,"nFireActive",TRUE);
      nC=1;
      while(nC<11)
      { // set fires
        oWP=GetWaypointByTag("DWF_FIRE"+IntToString(nC));
        oFire=CreateObject(OBJECT_TYPE_PLACEABLE,"plc_flamelarge",GetLocation(oWP));
        SetLocalObject(oWP,"oFire",oFire);
        nC++;
      } // set fires
      AssignCommand(oFire,fnBurningSound());
    } // turn it on
}