// ---------------------------------------------
// Illyria's Script
// ---------------------------------------------

// ---------------------------------------------
// Setting basic dialogue variables
// ---------------------------------------------
IF
    Global("LK#IllyriaCheck","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("LK#IllyriaCheck","GLOBAL",1)
    SetGlobal("LK#IllyriaTalks","GLOBAL",1)
    RealSetGlobalTimer("LK#IllyriaTalksTimer","GLOBAL",300)
END


// ---------------------------------------------
// Dialogues
// ---------------------------------------------
IF
    InParty(Myself)
    See(Player1)
    !StateCheck(Myself,CD_STATE_NOTVALID)
    !StateCheck(Player1,CD_STATE_NOTVALID)
    RealGlobalTimerExpired("LK#IllyriaTalksTimer","GLOBAL")
    CombatCounter(0)
    !See([ENEMY])
    OR(7)
      Global("LK#IllyriaTalks","GLOBAL",1)
      Global("LK#IllyriaTalks","GLOBAL",3)
      Global("LK#IllyriaTalks","GLOBAL",5)
      Global("LK#IllyriaTalks","GLOBAL",7)
      Global("LK#IllyriaTalks","GLOBAL",9)
      Global("LK#IllyriaTalks","GLOBAL",11)
      Global("LK#IllyriaTalks","GLOBAL",13)
THEN
  RESPONSE #100
    MoveToObject(Player1)
    StartDialogueNoSet(Player1)
END

IF
    InParty(Myself)
    See(Player1)
    RealGlobalTimerExpired("LK#IllyriaTalksTimer","GLOBAL")
    OR(6)
      Global("LK#IllyriaTalks","GLOBAL",2)
      Global("LK#IllyriaTalks","GLOBAL",4)
      Global("LK#IllyriaTalks","GLOBAL",6)
      Global("LK#IllyriaTalks","GLOBAL",8)
      Global("LK#IllyriaTalks","GLOBAL",10)
      Global("LK#IllyriaTalks","GLOBAL",12)
THEN
  RESPONSE #100
    IncrementGlobal("LK#IllyriaTalks","GLOBAL",1)
END
