IF
        Global("t#spawndomo","AR0504",0)
THEN
        RESPONSE #100
                 SetGlobal("t#spawndomo","AR0504",1)
                 CreateCreature("t#mdomo",[1433.986],0)
END

IF
        Global("t#spawninvi","AR0504",0)
        Global("CbWeddingQuestStarts","GLOBAL",2)
        GlobalTimerExpired("CbFarrahdWeddingTimer","GLOBAL")
        Global("CbCanDoWedding","GLOBAL",1)
        TimeGT(19)
THEN
        RESPONSE #100
                 SetGlobal("t#spawninvi","AR0504",1)
//                 CreateCreature("t#sfinvi",[816.1651],0)
                 CreateCreature("M05PCSPY",[816.1651],0)
                 ActionOverride("M05PCSPY",ChangeAIScript("t#sfinvi",OVERRIDE))

END

IF
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbSurayahGetsMarried","GLOBAL",6)
	Global("CbCanDoWedding","GLOBAL",1)
	Global("CbSaerkIntiateGetTheHellOut","AR0504",1)
	//Exists("t#sfinvi")
	Global("t#spawninvi","AR0504",1)
THEN
	RESPONSE #100
		ActionOverride("CBUSHERW",DestroySelf())
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbSurayahGetsMarried","GLOBAL",6)
	Global("CbCanDoWedding","GLOBAL",1)
	Global("CbSaerkIntiateGetTheHellOut","AR0504",1)
THEN
	RESPONSE #100
		ActionOverride("SBUTLER",Activate("SBUTLER"))
		ActionOverride("SCOOK",Activate("SCOOK"))
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbSurayahGetsMarried","GLOBAL",6)
	Global("CbCanDoWedding","GLOBAL",1)
	Global("CbSaerkIntiateGetTheHellOut","AR0504",1)
	!Global("t#spawninvi","AR0504",1)
//	!Exists("t#sfinvi")
THEN
	RESPONSE #100
		SetGlobal("CbWeddingQuestStarts","GLOBAL",1)
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",2)
	GlobalTimerExpired("CbFarrahdWeddingTimer","GLOBAL")
	Global("CbCanDoWedding","GLOBAL",1)
	TimeGT(19)
THEN
	RESPONSE #100
		SetGlobal("CbWeddingQuestStarts","GLOBAL",3)
		ActionOverride("SBUTLER",Deactivate("SBUTLER"))
		ActionOverride("SCOOK",Deactivate("SCOOK"))
		CreateCreature("CBSAERKW",[1960.561],1)
		CreateCreature("CBSURAYW",[1825.569],14)
		CreateCreature("CBYUSEFW",[1931.662],6)
		CreateCreature("CBNOBL1W",[1768.620],14)
		CreateCreature("CBNOBL2W",[1878.697],6)
		CreateCreature("CBNOBL3W",[1765.658],14)
		CreateCreature("CBNOBL4W",[1824.704],6)
		CreateCreature("CBNOBL5W",[1743.720],10)
		CreateCreature("CBUSHERW",[1852.485],14)
		CreateCreature("CBUSHERW",[1614.656],14)
		CreateCreature("CBUSHERW",[2101.538],1)
		CreateCreature("CBUSHERW",[1670.1156],1)
		CreateCreature("CBUSHERW",[1486.1267],14)
		CreateCreature("CBUSHERW",[777.706],1)
		CreateCreature("CBUSHERW",[1002.559],1)
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",5)
	Global("CbCanDoWedding","GLOBAL",1)
	!GlobalTimerNotExpired("CbNoblesChatter","AR0504")
THEN
	RESPONSE #10
		ActionOverride("CBNOBL1W",DisplayStringHead("CBNOBL1W",@550000))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL1W",DisplayStringHead("CBNOBL1W",@550001)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL2W",DisplayStringHead("CBNOBL2W",@550002))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL2W",DisplayStringHead("CBNOBL2W",@550003)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL3W",DisplayStringHead("CBNOBL3W",@550004)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL3W",DisplayStringHead("CBNOBL3W",@550005)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL4W",DisplayStringHead("CBNOBL4W",@550006)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL4W",DisplayStringHead("CBNOBL4W",@550000)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL5W",DisplayStringHead("CBNOBL5W",@550001)) 
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL5W",DisplayStringHead("CBNOBL5W",@550002))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",6)
	!Global("CbSurayahGetsMarried","GLOBAL",2)
	Global("CbCanDoWedding","GLOBAL",1)
	!GlobalTimerNotExpired("CbNoblesChatter","AR0504")
THEN
	RESPONSE #10
		ActionOverride("CBNOBL1W",DisplayStringHead("CBNOBL1W",@550000))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL1W",DisplayStringHead("CBNOBL1W",@550001))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL2W",DisplayStringHead("CBNOBL2W",@550002))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL2W",DisplayStringHead("CBNOBL2W",@550003))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL3W",DisplayStringHead("CBNOBL3W",@550004))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL3W",DisplayStringHead("CBNOBL3W",@550005))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL4W",DisplayStringHead("CBNOBL4W",@550006))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL4W",DisplayStringHead("CBNOBL4W",@550000))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL5W",DisplayStringHead("CBNOBL5W",@550001))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
	RESPONSE #10
		ActionOverride("CBNOBL5W",DisplayStringHead("CBNOBL5W",@550002))
		SetGlobalTimer("CbNoblesChatter","AR0504",7)
END

IF
	GlobalTimerExpired("CbSurayahsWedding","AR0504")
	Global("CbSurayahGetsMarried","GLOBAL",2)
	Global("CbCanDoWedding","GLOBAL",1)
THEN
	RESPONSE #100
		FadeToColor([20.0],0)
		Wait(1)
		ActionOverride("CBSAERKW",JumpToPoint([1130.1614]))
		ActionOverride("CBSAERKW",Face(5))
		ActionOverride("CBSURAYW",JumpToPoint([1048.1577]))
		ActionOverride("CBSURAYW",Face(5))
		ActionOverride("CBYUSEFW",JumpToPoint([1001.1611]))
		ActionOverride("CBYUSEFW",Face(5))
		ActionOverride("CBNOBL1W",JumpToPoint([1046.1660]))
		ActionOverride("CBNOBL1W",Face(5))
		ActionOverride("CBNOBL2W",JumpToPoint([1018.1687]))
		ActionOverride("CBNOBL2W",Face(5))
		ActionOverride("CBNOBL3W",JumpToPoint([987.1710]))
		ActionOverride("CBNOBL3W",Face(5))
		ActionOverride("CBNOBL4W",JumpToPoint([1080.1685]))
		ActionOverride("CBNOBL4W",Face(5))
		ActionOverride("CBNOBL5W",JumpToPoint([1051.1712]))
		ActionOverride("CBNOBL5W",Face(5))
		ActionOverride(Player1,JumpToPoint([1162.1638]))
		ActionOverride(Player1,Face(5))
		ActionOverride(Player2,JumpToPoint([1190.1659]))
		ActionOverride(Player2,Face(5))
		ActionOverride(Player3,JumpToPoint([1194.1612]))
		ActionOverride(Player3,Face(5))
		ActionOverride(Player4,JumpToPoint([1224.1634]))
		ActionOverride(Player4,Face(5))
		ActionOverride(Player5,JumpToPoint([1224.1590]))
		ActionOverride(Player5,Face(5))
		ActionOverride(Player6,JumpToPoint([1257.1612]))
		ActionOverride(Player6,Face(5))
		CreateCreature("CBPASTRW",[987.1569],14)
		MoveViewPoint([1018.1687],INSTANT)
		FadeFromColor([20.0],0)
		Wait(2)
		ActionOverride("CBPASTRW",StartDialogueNoSet(Player1))
END

IF
	Global("CbWeddingQuestStarts","GLOBAL",6)
	Global("CbSurayahGetsMarried","GLOBAL",1)
	Global("CbCanDoWedding","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobalTimer("CbSurayahsWedding","AR0504",30)
		SetGlobal("CbSurayahGetsMarried","GLOBAL",2)
END

IF
	Global("CbSurayahGetsMarried","GLOBAL",5)
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbCanDoWedding","GLOBAL",1)
	Global("t#spawninvi","AR0504",1)
//	Exists("t#sfinvi")
THEN
	RESPONSE #100
		SetGlobal("CbSurayahGetsMarried","GLOBAL",6)
		ActionOverride("CBUSHERW",EscapeArea())
		ActionOverride("CBNOBL1W",EscapeArea())
		ActionOverride("CBNOBL2W",EscapeArea())
		ActionOverride("CBNOBL3W",EscapeArea())
		ActionOverride("CBNOBL4W",EscapeArea())
		ActionOverride("CBNOBL5W",EscapeArea())
		ActionOverride("CBSAERKW",EscapeArea())
END

IF
	Global("CbSurayahGetsMarried","GLOBAL",3)
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbCanDoWedding","GLOBAL",1)
	!Exists("CBPASTRW")
	!Exists("CBYUSEFW")
	!Exists("CBSURAYW")
THEN
	RESPONSE #100
		SetGlobal("CbSurayahGetsMarried","GLOBAL",4)
END

IF
	Global("CbSurayahRunsAway","GLOBAL",2)
	Global("CbSurayahDoesntGoToStronghold","AR0505",1)
	Global("CbWeddingQuestStarts","GLOBAL",7)
	Global("CbCanDoWedding","GLOBAL",1)
	!InActiveArea("CBSURAYW")
THEN
	RESPONSE #100
		ActionOverride("CBSAERKW",StartDialogueNoSet(Player1))
END

IF
	Global("CbSurayahRunsAway","GLOBAL",3)
	Global("CbSurayahDoesntGoToStronghold","AR0505",2)
	Global("CbWeddingQuestStarts","GLOBAL",8)
	Global("CbCanDoWedding","GLOBAL",1)
	Global("t#spawninvi","AR0504",1)
//	Exists("t#sfinvi")
THEN
	RESPONSE #100
		ActionOverride("CBUSHERW",EscapeArea())
		ActionOverride("CBNOBL1W",EscapeArea())
		ActionOverride("CBNOBL2W",EscapeArea())
		ActionOverride("CBNOBL3W",EscapeArea())
		ActionOverride("CBNOBL4W",EscapeArea())
		ActionOverride("CBNOBL5W",EscapeArea())
		SetGlobal("CbWeddingQuestStarts","GLOBAL",10)
END

IF
	Global("t#spawninvi","AR0504",1)
//	Exists("t#sfinvi")
THEN
	RESPONSE #100
	TriggerActivation("TRAN0505b",FALSE)
	TriggerActivation("TRAN0505a",FALSE)
	TriggerActivation("Tran0500",FALSE)
	Continue()
END

IF
	!Global("t#spawninvi","AR0504",1)
//	!Exists("t#sfinvi")
THEN
	RESPONSE #100
	TriggerActivation("TRAN0505b",TRUE)
	TriggerActivation("TRAN0505a",TRUE)
	TriggerActivation("Tran0500",TRUE)
	Continue()
END

IF
	Global("CbCanDoWedding","GLOBAL",1)
	GlobalGT("CbWeddingQuestStarts","GLOBAL",2)
	!Global("t#spawninvi","AR0504",1)
//	!Exists("t#sfinvi")
THEN
	RESPONSE #100
		SetGlobal("CbCanDoWedding","GLOBAL",2)
END
