SCRIPT_CHAPTER

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

section DECLARE

// entites
	_EPEE_VERITE		384
	_EPEE_VERITE2		878

	_LUTISSE		170
	_PORTAIL_OGRE		164
	_FANT_CHEV_NOIR		634
	_CHEV_NOIR		171
	_DM_CB			263
	_DUMMY_CROIX		264
	_DUMMY_GOZI		265

	_ECU_DOPPLEGANGER	554
	_EPEE_DOPPLEGANGER	589

	_EPEE_DE_VERITE		384
	_COR			882
	_IO_EPEE_DE_VERITE	179
	_IO_COR			210

// items objet
// items indice

// items destinations
	$stop_if
	_IO_BROCHE_LUTISSE	86
	_IO_ECU_ARTHUR		209
	_IO_EPEE_VERITE		179
	_II_ARTHUR		29
	_II_MORGANOR		13
	_II_EPEE_VERITE		114

// evenements

	// use

	// pick
	_P_EPEE		73
	_P_EPEE_RATE	173

	_E_DRAGON	7
	_PRIER		2
	_PRIER_EV	5
	// explorer
	// commentaires

	// dialogues
	_D_LUTISSE	8
	_D_CHEV_NOIR	9
	// CTR

	// generiques

	// options cbts

	// cbts

section END


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

section EVENTS
//PICK
ACTION
{
	ID	_P_EPEE
	AREA	_COLLINE_ST_GEORGES
	HEIGHT	"H1"


	PRIMTRIG
	{
		ENTITE	_EPEE_VERITE
		DIST	300
		ORIENT  "NONE"
	}
	//ENTITE		_EPEE_VERITE
	//ITEM 		(_IO_EPEE_VERITE, _INV_OBJET)
	ACTION		1
	//COMMENT		1
	STATUS		0
	BASEDOC		147
	BASEJEU		34
	PAUSE		1	// LG
}

ACTION
{
	ID	_P_EPEE_RATE
	AREA	_COLLINE_ST_GEORGES

	PRIMTRIG
	{
		ENTITE	_EPEE_VERITE
		DIST	300
		ORIENT  "NONE"
	}
	ACTION		1
	STATUS		1
	PERSIST		1
	PAUSE		1	// LG
}

EXPLORE
{
	ID	_E_DRAGON
	AREA	_COLLINE_DRAGON_ROUGE
	HEIGHT	"H1"

	PRIMTRIG
	{
		TRIGGER		1
	}
	ACTION		1
	PERSIST		1
	DELAY		10
	COMMENT		701
}

COMMENT
{
	ID	1	// foulque
	AREA	_COLLINE_ST_GEORGES

	PRIMTRIG
	{
		TRIGGER		2
	}
	COMMENT		4

}

COMMENT
{
	ID	6
	AREA	_LANDSCAPE_UFF

	PRIMTRIG
	{
		TRIGGER	2 // ??!!!
	}
	PERSIST		1
	DELAY		30
	COMMENT		6	// pas dans cat

}

ACTION
{
	ID	_PRIER_EV
	AREA	_COLLINE_ST_GEORGES

	PRIMTRIG
	{
		DIST	300
		ORIENT "TO"
		ENTITE	_DUMMY_CROIX
	}
	STATUS 0
	ACTION 1
	PAUSE		1	// LG
}

ACTION
{
	ID	_PRIER
	AREA	_COLLINE_ST_GEORGES

	PRIMTRIG
	{
		DIST	300
		ORIENT "TO"
		ENTITE	_DUMMY_CROIX
	}
	ACTION	1
	PAUSE		1	// LG
}

	DIALOG
	{
		ID		    _D_LUTISSE
		AREA		_CAMP_CHEVALIER_NOIR
		ENTITE		 _LUTISSE
		//CAMERA

		PRIMTRIG
		{
			DIST	300
			//ORIENT	"NONE"
			ENTITE	 _LUTISSE
		}

		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	 _LUTISSE
		}
		//STAND
		//{
		//	ID	1
		//	TALK	( 11, 12)
		//}
		STAND
		{
			ID	1
			TALK	(11,12)(13, 14)
		}
		STAND
		{
			ID	2
			TALK	( 15, 16)(17 ,18)
			BASEJEU		38
			BASEDOC		77
			STATUS		0
		}

		FIN
		{
			ID	1
			TALK	(11, 12)( 13,14)
		}

		FIN
		{
			ID		2
//			TALK		(19,20, _ID_CAMELOT, _INV_DESTI)
			TALK		(19,20)		// LG
			STATUS		0
			BASEJEU		39
		}


		RETOUR
		{
			ID	1
			TALK	(11,12)(13, 14)
		}

		RETOUR
		{
			ID	2
			TALK	(15,16)
			STATUS	0
		}
		SUJET
		{
			ID	 _II_EPEE_VERITE
			TALK	(21,22)
			BASEJEU	35
		}

	}

	DIALOG
	{
		ID		 _D_CHEV_NOIR
		AREA		_TINTAGEL_CAMP_BK
		ENTITE		 _CHEV_NOIR
		CAMERA		2

		PRIMTRIG
		{
			DIST	300
			//ORIENT	"NONE"
			ENTITE	 _CHEV_NOIR
		}

		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	 _CHEV_NOIR
		}

		FIN
		{
			ID	1
			TALK	( 9, 700)
			FIGHT	1

		}

		RETOUR
		{
			ID	1
			TALK	( 9, 700)
			FIGHT	1
		}

	}

	COMMENT
	{
		ID		201
		AREA		_LANDSCAPE_CAMELOT

		PRIMTRIG
		{
			TRIGGER 3
		}

		COMMENT		8	// foulque
	}
	FIGHT
	{
		ID 		1
		AREA		_TINTAGEL_CAMP_BK
		LIST	(_IO_EPEE_VERITE , _EPEE_VERITE2 , 1 )
	}


section END


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

section COMBATS

FIGHT
{
	ID		1
	AREA		_TINTAGEL_CAMP_BK
	CAMERA		7
	TARGET		_DM_CB

//	WIN		0

	OPPONENT
	{
		ENTITE		_BRADWEN
		BOX		19
		ANIM	"combat 1" "combat 1"
		SOUND	"cb01" 100
		LWEAPON		676
		DEAD	0
	}

	OPPONENT
	{
		ENTITE 		_CHEV_NOIR
		BOX		21
		ANIM	"combat 1" "combat 1"

		RWEAPON		_EPEE_DOPPLEGANGER
		LWEAPON		_ECU_DOPPLEGANGER

		DEAD 		1
	}
}


section END

/////////////////////////////////////////////////////////////////
// Programme
/////////////////////////////////////////////////////////////////
section INIT

// desactivation sorties non permises

////Camelot
// atrebates
	#TIM_ADD		(1)

			//id, 		boite, lieu, actif, visible, coll decor
	#OBJ_LOAD		(_EPEE_VERITE,     3, _COLLINE_ST_GEORGES, 1, 1, 0)

	#OBJ_LOAD		(_LUTISSE,  	  17, _TINTAGEL_CAMP_BK, 1, 1, 0)
	//#OBJ_LOAD		(_PORTAIL_OGRE,   13, _TINTAGEL_CAMP_BK, 1, 1, 0) // ??
	#OBJ_LOAD		(_FANT_CHEV_NOIR,  20, _TINTAGEL_CAMP_BK, 0, 1, 0)
	#OBJ_LOAD		(_CHEV_NOIR,  	   3, _TINTAGEL_CAMP_BK, 1, 1, 0)
	#OBJ_LOAD		(_DM_CB,  	   21, _TINTAGEL_CAMP_BK, 1, 0, 0) // dummy : 22
	#OBJ_LOAD		(_DUMMY_CROIX,    9, _COLLINE_ST_GEORGES, 1, 0, 0)
	#OBJ_DISABLECOLLIOBJ	(_DM_CB)
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_CROIX)

	#OBJ_LOADACCESS		(_EPEE_BRADWEN_PALADIN, 1)
	//#OBJ_LOADACCESS	(_EPEE_VERITE2, 1)

	#OBJ_LOAD		(_DUMMY_GOZI,    1, 207, 1, 1, 0)
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_GOZI)
	set $stop_if ,0

// inventaire

////	#INV_PUTPLQ		(_IO_EPEE_BRADWEN, _INV_OBJET) //epee
////	#INV_PUTPLQ		(_II_EPEE_VERITE, _INV_INDIC)

	//#INV_PUTPL		(_IO_EPEE_VERITE, _INV_OBJET) //TEST
	//#INV_PUTPL		(_ID_TINTAGEL, _INV_DESTI) //TEST

	//fx

	#VFX_LOADLINK		(_FX_METAM_CHEVNOIR_FANT_ENT1_LK, 	_CHEV_NOIR, "bassin", 0)
	#VFX_LOAD		(_FX_METAM_CHEVNOIR_FANT_ENT1, 		_CHEV_NOIR, 0)

	#VFX_LOADLINK		(_FX_METAM_CHEVNOIR_FANT_ENT2_LK, 	_FANT_CHEV_NOIR, "bassin", 0)
	#VFX_LOAD		(_FX_METAM_CHEVNOIR_FANT_ENT2, 		_FANT_CHEV_NOIR, 0)

	#VFX_LOADFLOAT		(_FX_FLASHD_ECLAIR_BOUCLIER)
	#VFX_LOADFLOAT		(_FX_FLASHD_ECLAIR_EPEE)
//	set $pub4, 0	//retour carte postale

section END

section LOOP

OnEvent 201
{
	#INV_REMPL	(_ID_CAMELOT, _INV_DESTI)
	endc
}
OnFight 1
{

	run 10
	#BJE_FIGHT		(36,1)
	#BJE_CTR		(37,10)
	#INV_PUTPL		(_IO_COR, _INV_OBJET)
	#DLG_DISABLESTD		(_D_LUTISSE,_CAMP_CHEVALIER_NOIR ,1)
	#DLG_DISABLERET		(_D_LUTISSE, _CAMP_CHEVALIER_NOIR ,1)
	#DLG_DISABLEFIN		(_D_LUTISSE, _CAMP_CHEVALIER_NOIR,1)

	#DLG_ENABLESTD		(_D_LUTISSE, _CAMP_CHEVALIER_NOIR,2)
	#DLG_ENABLERET		(_D_LUTISSE, _CAMP_CHEVALIER_NOIR,2)
	#DLG_ENABLEFIN		(_D_LUTISSE, _CAMP_CHEVALIER_NOIR ,2)

}

OnEvent _PRIER
{
	run	92
	#EVT_ENABLE		(_P_EPEE)
	#EVT_DISABLE		(_P_EPEE_RATE)
}

OnEvent _PRIER_EV
{

	run	93

}


OnEvent _P_EPEE_RATE perm
{
	#EVT_DISABLE		(_P_EPEE_RATE)
	run 95
	#EVT_ENABLE		(_P_EPEE_RATE)
}
OnEvent _P_EPEE
{
	#VFX_LINK		(_FX_FLASHD_ECLAIR_EPEE, _BRADWEN, "mainD")

	run 94
 	if @INV_OWNPL		(_IO_EPEE_VERITE, _INV_OBJET) = 0
	{
		#INV_PUTPL	(_IO_EPEE_VERITE, _INV_OBJET)
 	}

	#INV_PUTPL		( _ID_TINTAGEL, _INV_DESTI)
	#INV_REMPL		(_IO_EPEE_BRADWEN, _INV_OBJET) //epee

	#EVT_ENABLE		(_PRIER_EV)
}

OnDialog _D_CHEV_NOIR fin 1
{
	set		$stop_if, 1
	#VFX_LINK		(_FX_FLASHD_ECLAIR_BOUCLIER, _BRADWEN, "mainD")
	#INV_REMPL		( _ID_TINTAGEL, _INV_DESTI)
}

// LG ----------------

	OnDialog _D_LUTISSE fin 2
	{
		if @INV_OWNPL (_ID_CAMELOT, _INV_DESTI)=0
		{
			#INV_PUTPL (_ID_CAMELOT, _INV_DESTI)
		}
	}

// LG ----------------


	if @OBJ_ENMAIND (_BRADWEN) = 1 & $stop_if = 1 // & combat 2
	{
		#TIM_START	(1)
		add		$stop_if, 1
	}

	if @TIM_VALUE	(1) > 2100 & $stop_if = 2
	{
		#VFX_START	(_FX_FLASHD_ECLAIR_BOUCLIER)
		add		$stop_if, 1
	}

section END

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

section CTR

CTR
{
	ID	10
	PROG
	{
		#CAM_ENABLE	(2)
		#CAM_FORCE	(2,0)
		#NAR_COMMENT(7)	//Corwyn
		SYNCCOMM

		SyncTime 1

		//fx dispar
		#VFX_START	(_FX_METAM_CHEVNOIR_FANT_ENT1_LK)
		#VFX_START	(_FX_METAM_CHEVNOIR_FANT_ENT1)
		SyncFx		_FX_METAM_CHEVNOIR_FANT_ENT1 0

		#OBJ_DISABLE	(_CHEV_NOIR)

		//fx appar
		#OBJ_ENABLE	(_FANT_CHEV_NOIR)
		#VFX_START	(_FX_METAM_CHEVNOIR_FANT_ENT2_LK)
		#VFX_START	(_FX_METAM_CHEVNOIR_FANT_ENT2)
		SyncFx		_FX_METAM_CHEVNOIR_FANT_ENT2 0

		#OBJ_ENMAIND	(_FANT_CHEV_NOIR, _COR)

		#OBJ_SENDEVENT	(_BRADWEN, "aspec 13") // surpris
		SyncState  	_BRADWEN	"pause"	WIDE
		#OBJ_GOTOOBJNEAR(_FANT_CHEV_NOIR, _BRADWEN, 150, 0)

		#OBJ_SENDEVENT	(_FANT_CHEV_NOIR, "dlg nor")
		#NAR_COMMENT	(10)
	 	SYNCCOMM

		#OBJ_SENDEVENT	(_FANT_CHEV_NOIR, "give 2")
		#OBJ_SENDEVENT	(_BRADWEN, "give 2")	// prend
		SyncState 	_FANT_CHEV_NOIR "pause - give 2"

		#OBJ_SUPMAIND	( _FANT_CHEV_NOIR)
		#OBJ_ENMAIND	(_BRADWEN, _COR)
		SyncTime 2

		//fx dispar fantome
		#VFX_LOADLINK	(_FX_DISPAR_BRADWEN_LK, _FANT_CHEV_NOIR,"bassin", 0)
		#VFX_LOAD	(_FX_DISPAR_BRADWEN	,  _FANT_CHEV_NOIR,	0)

		#VFX_START	(_FX_DISPAR_BRADWEN_LK)
		#VFX_START	(_FX_DISPAR_BRADWEN)
		SyncFx 		_FX_DISPAR_BRADWEN 0
		#OBJ_DISABLE	(_FANT_CHEV_NOIR)

		SyncTime 2

		#CAM_UNLOCK	()
		#OBJ_SUPMAIND	( _BRADWEN)

		#CAM_DISABLE	(2)
	}
}


CTR
{
	ID	94
	PROG
	{
		#OBJ_SENDEVENT	(_BRADWEN, "pick 2")

		SyncTime	1

		#OBJ_ENMAIND	(_BRADWEN, _EPEE_VERITE)
		#CAM_FORCE(49,0)

		SyncTime	1
		#OBJ_SENDEVENT	(_BRADWEN, "use sword f")
		SyncTime	1
		#VFX_START	(_FX_FLASHD_ECLAIR_EPEE)

	 	#NAR_COMMENT(1)
	 	//SyncState	_BRADWEN "brandir epee flamme"

	 	SyncState	_BRADWEN "brandir epee flamme - pause"
	 	SyncTime	1

	 	#CAM_UNLOCK	()
	 	#OBJ_SUPMAIND	(_BRADWEN)
	 	SYNCCOMM

		#NAR_COMMENT		(5) // Corwyn
	 	SYNCCOMM
	}
}

CTR
{
	ID	95
	PROG
	{
		#OBJ_SENDEVENT	(_BRADWEN, "pick 2")
		SyncState	_BRADWEN	"pick 2 - pause"
	}
}
CTR
{
	ID	92
	PROG
	{
		SyncState	_BRADWEN "pause"	WIDE
		//anim prier
		#OBJ_SENDEVENT	(_BRADWEN, "aspec 16")
		SyncState	_BRADWEN "pause - degainer 2"
		#OBJ_ENMAIND	(_BRADWEN, _EPEE_BRADWEN_PALADIN)
		#NAR_COMMENT(2)

		SyncState	_BRADWEN "prier chretien - rengainer 2"
		#OBJ_SUPMAIND	(_BRADWEN)
		SyncState	_BRADWEN "rengainer - pause 2"
		SYNCCOMM

	}
}


CTR
{
	ID	93
	PROG
	{
		SyncState	_BRADWEN "pause"	WIDE
		//anim prier
		#OBJ_SENDEVENT	(_BRADWEN, "aspec 16")
		SyncState	_BRADWEN "pause - degainer 2"
		#OBJ_ENMAIND	(_BRADWEN, _EPEE_VERITE)
		#NAR_COMMENT(3)

		SyncState	_BRADWEN "prier chretien - rengainer 2"
		#OBJ_SUPMAIND	(_BRADWEN)
		SyncState	_BRADWEN "rengainer - pause 2"
		SYNCCOMM

	}
}

section END