SCRIPT_CHAPTER

/////////////////////////////////////////////////////////////////
// Déclaration constantes & variables
/////////////////////////////////////////////////////////////////

section DECLARE

// entites

	_GARDE_CELTE_1			7
	_MORGANOR			16
	_ANACHORETE			91
	_EPEE_DE_VERITE			384
	_ELAD				413
	_GARDE_CELTE_2			415
	_EPEE_BRADWEN_PALADIN		569
	_DUMMY_COMBAT_ELAD		572
	_BOUCLIER_ELAD			672
	_BOUCLIER_BRADWEN_PALADIN	676
	_FOUET_ANACHORETE		685
	_EPEE_ELAD_CBT			748
	_ANACHORETE_CA			1199

// items objet

	_IO_EPEE_BRADWEN_PALADIN	0
	_IO_EPEE_ELAD			123

// items indice

	_II_SAXONS			2
	_II_ELAD			74
	_II_ROI				75
	_II_HONNEUR			76

// items destinations

	_ID_LANDSCAPE_UFF		100

// evenements

	// use

	// pick

	// explorer

	_E_PORTES_CHATEAU_UFF		2
	_E_EPEE_VERITE			3
	_E_SIGNE_DRAGON			4

	// commentaires

	_C_COLLINE_ST_GEORGES		5
	_C_ELAD				6

	// dialogues

	_D_MORGANOR			7
	_D_ANACHORETE			8
	_D_ELAD				9

	// CTR

	_CTR_ARRIVEE_BW_1		12
	_CTR_ARRIVEE_BW_2		20
	_CTR_PRIER			21

	// generiques

	_G_BW_CHATEAU_UFF		17
	_G_PRIERE_CROIX			13
	_G_BW_DEBUT_JEU_1		18
	_G_BW_DEBUT_JEU_2		19

	// options cbts

	_OC_ELAD_GAGNE			1
	_OC_ELAD_PERDU			2

	// cbts

	_CBT_ELAD_GAGNE			1
	_CBT_ELAD_PERDU			2

	// sauvegardes

	_S_AUTO_1			1000

section END


/////////////////////////////////////////////////////////////////
// Définition des événements
/////////////////////////////////////////////////////////////////

section EVENTS

	SAVE
	{
		ID		_S_AUTO_1
		AREA		_ROUTE_UFF

		PRIMTRIG
		{
			DIST	1200
			ORIENT	"NONE"
			ENTITE	_ELAD
		}
	}

	EXPLORE
	{
		ID		_E_PORTES_CHATEAU_UFF
		AREA		_CHATEAU_UFF
		HEIGHT		"H2"

		PRIMTRIG
		{
			DIST	200
			ORIENT	"TO"
			ENTITE	_PORTE_CHATEAU_UFF_N2
		}

		DELAY		10
		PERSIST		1
		ACTION		1
		COMMENT		2
		STATUS		0
	}

	EXPLORE
	{
		ID		_E_EPEE_VERITE
		AREA		_COLLINE_ST_GEORGES
		HEIGHT		"H1"

		PRIMTRIG
		{
			DIST	500
			ORIENT	"TO"
			ENTITE	_EPEE_DE_VERITE
		}

		DELAY		10
		PERSIST		1
		ACTION		1
		COMMENT		3
	}

	EXPLORE
	{
		ID		_E_SIGNE_DRAGON
		AREA		_COLLINE_DRAGON_ROUGE
		HEIGHT		"H0"

		PRIMTRIG
		{
			ORIENT	"NONE"
			TRIGGER	1
		}

		DELAY		10
		PERSIST		1
		ACTION		1
		COMMENT		4
	}

	// ==============================================

	COMMENT
	{
		ID		_C_COLLINE_ST_GEORGES
		AREA		_COLLINE_ST_GEORGES

		PRIMTRIG
		{
			DIST	1500
			ORIENT	"NONE"
			ENTITE	_EPEE_DE_VERITE
		}

		COMMENT		6
	}

	COMMENT
	{
		ID		_C_ELAD
		AREA		_ROUTE_UFF

		PRIMTRIG
		{
			DIST	1000
			ORIENT	"NONE"
			ENTITE	_ELAD
		}

		COMMENT		7
	}

	// ==============================================

	DIALOG
	{
		ID		_D_MORGANOR
		AREA		_CHATEAU_UFF
		ENTITE		_MORGANOR

		STATUS		0

		SECTRIG
		{
			DIST	300
			ORIENT	"FACE"
			ENTITE	_MORGANOR
		}

		PRIMTRIG
		{
			DIST	350
			ORIENT	"NONE"
			ENTITE	_MORGANOR
		}

		STAND
		{
			ID	1
			TALK	(8, 9) (10, 11, _II_ELAD, _INV_INDIC) (12, 13) (14, 15)
			BASEJEU	4
			BASEDOC	52
		}

		FIN
		{
			ID	1
			TALK	(16, 17)
		}

		RETOUR
		{
			ID	1
			TALK	(8, 19)
		}

		SUJET
		{
			ID	_II_ELAD
			TALK	(22, 23, _II_ROI, _INV_INDIC) (24, 25)
			BASEJEU	2
		}

		SUJET
		{
			ID	_II_ROI
			TALK	(26, 27) (28, 29)
			BASEJEU	3
			BASEDOC	11
		}

		USE
		{
			ID	_IO_EPEE_ELAD
			TALK	(20, 21)
			ACCESS	_EPEE_ELAD_CBT
			ANIM	"use cup" "brandir pierre - pause"
			BASEJEU	10
		}
	}

	DIALOG
	{
		ID		_D_ANACHORETE
		AREA		_COLLINE_DRAGON_ROUGE
		ENTITE		_ANACHORETE

		CAMERA		57

		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_ANACHORETE
		}

		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_ANACHORETE
		}

		STAND
		{
			ID	1
			TALK	(30, 31) (32, 33) (34, 35)
			BASEJEU	5
			BASEDOC	30
		}

		FIN
		{
			ID	1
			TALK	(36, 37)
		}

		RETOUR
		{
			ID	1
			TALK	(36, 37)
		}

		SUJET
		{
			ID	_II_ELAD
			TALK	(38, 39) (40, 41, _II_HONNEUR, _INV_INDIC)
		}

		SUJET
		{
			ID	_II_HONNEUR
			TALK	(42, 43) (44, 45)
			BASEJEU	6
		}
	}

	DIALOG
	{
		ID		_D_ELAD
		AREA		_ROUTE_UFF
		ENTITE		_ELAD

		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_ELAD
		}

		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_ELAD
		}

		STAND
		{
			ID	1
			TALK	(46, 47, _II_SAXONS, _INV_INDIC) (48, 49)
			BASEJEU	7
			BASEDOC	51
			FIGHT	_OC_ELAD_PERDU
		}

		FIN
		{
			ID	1
			TALK	(50, 51)
		}

		FIN
		{
			ID	2
			TALK	(56, 57)
			STATUS	0
		}

		RETOUR
		{
			ID	1
			TALK	(52, 53)
		}

		RETOUR
		{
			ID	2
			TALK	(54, 55)
			STATUS	0
		}

		SUJET
		{
			ID	_II_HONNEUR
			TALK	(58, 59)
			ATTACK	1
			BREAK	1
		}

		SUJET
		{
			ID	_II_SAXONS
			TALK	(60, 61) (62, 63) (64, 65)
			BASEJEU	8
			BASEDOC	27
			STATUS	0
		}
	}

	// ==============================================

	FIGHT
	{
		ID		_OC_ELAD_GAGNE
		AREA		_ROUTE_UFF
		LIST		(_IO_EPEE_BRADWEN_PALADIN, _EPEE_BRADWEN_PALADIN, _CBT_ELAD_GAGNE)
	}

	FIGHT
	{
		ID		_OC_ELAD_PERDU
		AREA		_ROUTE_UFF
		LIST		(_IO_EPEE_BRADWEN_PALADIN, _EPEE_BRADWEN_PALADIN, _CBT_ELAD_PERDU)
	}

	// ==============================================

	ACTION		// debut jeu
	{
		ID		_G_BW_DEBUT_JEU_1
		AREA		_LANDSCAPE_UFF

		PRIMTRIG
		{
			ORIENT	"NONE"
			TRIGGER	4
		}
	}

	ACTION		// debut jeu
	{
		ID		_G_BW_DEBUT_JEU_2
		AREA		_CHATEAU_UFF

		PRIMTRIG
		{
			DIST	500
			ORIENT	"NONE"
			ENTITE	_MORGANOR
		}
	}

	ACTION		// fin de chapitre
	{
		ID		_G_BW_CHATEAU_UFF
		AREA		_CHATEAU_UFF

		PRIMTRIG
		{
			ORIENT	"NONE"
			TRIGGER	4
		}
	}

	ACTION
	{
		ID		_G_PRIERE_CROIX
		AREA		_COLLINE_ST_GEORGES

		PRIMTRIG
		{
			ORIENT	"NONE"
			TRIGGER	1
		}

		PERSIST		1
		ACTION		1
		PAUSE		1	// LG
	}

section END


/////////////////////////////////////////////////////////////////
// Définition des combats
/////////////////////////////////////////////////////////////////

section COMBATS

	FIGHT
	{
		ID		_CBT_ELAD_GAGNE
		AREA		_ROUTE_UFF

		OPPONENT
		{
			ENTITE	_BRADWEN
			BOX	8
			ANIM	"combat 6" "combat 6"
			RWEAPON _EPEE_BRADWEN_PALADIN
			LWEAPON	_BOUCLIER_BRADWEN_PALADIN
			SOUND	"cb06" 100
		}

		OPPONENT
		{
			ENTITE	_ELAD
			BOX	1
			ANIM	"combat 6" "combat 6"
			RWEAPON	_EPEE_ELAD_CBT
			LWEAPON	_BOUCLIER_ELAD
		}

		CAMERA	54
		TARGET	_DUMMY_COMBAT_ELAD
	}

	FIGHT
	{
		ID		_CBT_ELAD_PERDU
		AREA		_ROUTE_UFF

		OPPONENT
		{
			ENTITE	_BRADWEN
			BOX	8
			ANIM	"combat 4" "combat 4"
			LWEAPON	_BOUCLIER_BRADWEN_PALADIN
			DEAD	1
			SOUND	"cb04" 100
		}

		OPPONENT
		{
			ENTITE	_ELAD
			BOX	1
			ANIM	"combat 4" "combat 4"
			RWEAPON	_EPEE_ELAD_CBT
			LWEAPON	_BOUCLIER_ELAD
		}

		OPPONENT
		{
			ENTITE	_GARDE_CELTE_1
			BOX	3
			ANIM	"combat 4" "combat 4"
		}


		CAMERA	54
		TARGET	_DUMMY_COMBAT_ELAD
	}

section END

/////////////////////////////////////////////////////////////////
// Programme
/////////////////////////////////////////////////////////////////

section INIT

// desactivation sorties non permises

	#TRG_DISABLESZ		(1, _LANDSCAPE_UFF)
	#TRG_DISABLESZ		(3, _LANDSCAPE_UFF)
	#TRG_DISABLESZ		(5, _LANDSCAPE_UFF)

// objets de collision

	#OBJ_DISABLEDECF	(5, _LANDSCAPE_UFF)
	#OBJ_DISABLEDECF	(2, _LANDSCAPE_UFF)
	#OBJ_DISABLEDECF	(7, _LANDSCAPE_UFF)
	#OBJ_DISABLEDECF	(3, _LANDSCAPE_UFF)
	#COL_ENABLE		(4, _LANDSCAPE_UFF)

// landscape

	#OBJ_LOAD		(_ANACHORETE_CA,	72, _LANDSCAPE_UFF, 1, 1, 0)

// Chateau

	#OBJ_LOAD		(_MORGANOR,		42, _CHATEAU_UFF, 1, 1, 1)

// Colline St Georges

	#OBJ_LOAD		(_EPEE_DE_VERITE,	 3, _COLLINE_ST_GEORGES, 1, 1, 0)

// Colline dragon rouge

	#OBJ_LOADMAIND		(_ANACHORETE,		10, _COLLINE_DRAGON_ROUGE, _FOUET_ANACHORETE, 1, 1, 1)

// Route uffington

	#OBJ_LOAD		(_ELAD,			  1, _ROUTE_UFF, 1, 1, 1)
	#OBJ_LOAD		(_GARDE_CELTE_1,	  3, _ROUTE_UFF, 1, 1, 1)
	#OBJ_LOAD		(_GARDE_CELTE_2,	  4, _ROUTE_UFF, 1, 1, 1)
	#OBJ_LOAD		(_DUMMY_COMBAT_ELAD,	  5, _ROUTE_UFF, 1, 0, 0)

// Portes

	#DOO_LOCK		(_PORTE_CHATEAU_UFF_N1, _CHATEAU_UFF)

// entites flottantes

	#OBJ_LOADACCESS		(_EPEE_ELAD_CBT, 1)
	#OBJ_LOADACCESS		(_EPEE_BRADWEN_PALADIN, 1)

// tempo inv inte

	#INV_PUTPLQ		(_IO_EPEE_BRADWEN_PALADIN, _INV_OBJET)

// colli dummy

	#OBJ_DISABLECOLLIOBJ	(_DUMMY_COMBAT_ELAD)

section END

section LOOP


	OnDialog _D_MORGANOR stand 1
	{
		#EVT_ENABLE	(_E_PORTES_CHATEAU_UFF)
		#TRG_ENABLESZ	(1, _LANDSCAPE_UFF)
		#TRG_ENABLESZ	(3, _LANDSCAPE_UFF)
		#TRG_DISABLEST	(1, _LANDSCAPE_UFF)
		#TRG_DISABLEST	(2, _LANDSCAPE_UFF)
	}

	OnDialog _D_MORGANOR use _IO_EPEE_ELAD
	{
		#EVT_DISABLE	(_E_PORTES_CHATEAU_UFF)
		#DOO_UNLOCK	(_PORTE_CHATEAU_UFF_N1, _CHATEAU_UFF)
	}

	OnDialog _D_ELAD retour 2
	{
		#DLG_DISABLERET	(_D_ELAD, _ROUTE_UFF, 2)
		#DLG_ENABLERET	(_D_ELAD, _ROUTE_UFF, 1)
		#INV_PUTPL	(_IO_EPEE_ELAD, _INV_OBJET)
	}

	OnFight _CBT_ELAD_GAGNE
	{
		#DLG_DISABLERET	(_D_ELAD, _ROUTE_UFF, 1)
		#DLG_DISABLEFIN	(_D_ELAD, _ROUTE_UFF, 1)

		#DLG_ENABLERET	(_D_ELAD, _ROUTE_UFF, 2)
		#DLG_ENABLEFIN	(_D_ELAD, _ROUTE_UFF, 2)
		#DLG_ENABLESUJ	(_D_ELAD, _ROUTE_UFF, _II_SAXONS)
		#BJE_OPTION	(9, 1, _CBT_ELAD_GAGNE)
	}

	OnFight _CBT_ELAD_PERDU
	{
		#EVT_DISABLE	(_D_ELAD)
		over 0
	}

	OnEvent _G_BW_CHATEAU_UFF
	{
		#INV_REMPL	(_II_ELAD, _INV_INDIC)
		ENDC
	}

	OnEvent	_C_COLLINE_ST_GEORGES
	{
		#BDC_ENABLE	(25)
	}

	OnEvent _G_BW_DEBUT_JEU_1
	{
		RUN	12	// _CTR_ARRIVEE_BW_1
		#TRG_ENABLESZ	(5, _LANDSCAPE_UFF)
	}

	OnEvent _G_BW_DEBUT_JEU_2
	{
		RUN	20	// _CTR_ARRIVEE_BW_2
	}

	OnEvent	_G_PRIERE_CROIX	PERM
	{
		RUN		21
		#NAR_COMMENT	(66)
	}

section END

/////////////////////////////////////////////////////////////////
// Définition des CTR
/////////////////////////////////////////////////////////////////

section CTR

	CTR
	{
		ID	_CTR_ARRIVEE_BW_1

		PROG
		{
			#NAR_COMMENT	(68)
			#OBJ_GOTOBOX	(_BRADWEN, 18, 0)
			SyncGoto	_BRADWEN
			SyncTime	2
		}
	}

	CTR
	{
		ID	_CTR_ARRIVEE_BW_2

		PROG
		{
			SyncTime	1
			#NAR_COMMENT	(67)
			#OBJ_GOTOBOX	(_BRADWEN, 45, 1)
			SyncState	_BRADWEN "pause"
			#EVT_ENABLE	(_D_MORGANOR)
		}
	}

	CTR
	{
		ID	_CTR_PRIER

		PROG
		{
			#OBJ_SENDEVENT	(_BRADWEN, "aspec 3")
			SyncState	_BRADWEN "pause - degainer"
			#OBJ_ENMAIND	(_BRADWEN, _EPEE_BRADWEN_PALADIN)
			SyncState	_BRADWEN "prier chretien - rengainer"
			#OBJ_SUPMAIND	(_BRADWEN)
			SyncState	_BRADWEN "rengainer - pause"
		}
	}


section END