SCRIPT_CHAPTER

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

section DECLARE

// entites

	_MERLIN			17
	_DUMMY_CTR		470
	_CRYSTAL_PORTE		373
	_DUMMY_FOULQUE		471
	_LANCELOT		83
	_EPEE_DE_VERITE		384	//4
	_EPEE_VERITE_2		878
	_DUMMY_MERLIN		599
	_ECU_NOIR_2		910

	_CHARIOT_REINE		553
	_PIERRE_MALEFIQUE_RHIA_INT	888
	_PIERRE_MALEFIQUE_RN_INT	889
	_PIERRE_MALEFIQUE_GC_INT	890
	_PIERRE_MALEFIQUE_RHIA_EXT	1028
	_PIERRE_MALEFIQUE_RN_EXT	1029
	_PIERRE_MALEFIQUE_GC_EXT	1030

	_PIERRE_MERLIN		31
	_PIERRE_MERLIN2		32

	_ECU_NOIR		554	//6
	_TABLETTE_PLOMB_1_OFF	555
	_TABLETTE_PLOMB_2_AM	556

	_DM_CB			263


// items objet
	_IO_ECU_NOIR		211
	_IO_TABLETTE_PLOMB_1	212
	_II_MORGANOR		13
	_IO_EPEE_VERITE		179
	_II_SAGRAMOR		118
	_II_GUENIEVRE		117
	_IO_BROCHE_LUTISSE	86	//ch 1 2 3

// items indice

// items destinations
	$bje
	$bjp
// evenements

	// use
	_U_TABL1	6
	_U_TABL2	7
	_U_TABL3	36

	// pick
	_P_TABLETTE	1
	_P_ECU_NOIR	2

	// explorer

	_E_PSORCIER1	3
	
	_E_PSORCIER3	35
	_E_PSORCIER4	40
	//_E_PSORCIER5	41
	_E_PSORCIER6	42

	_E_PMERLIN	5
	_E_PMERLIN2	4
	

	// commentaires

	// dialogues

	// CTR
	_IN_MAGO	150
	// generiques
	// options cbts


	// cbts

	//variables


section END


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

section EVENTS

EXPLORE
{
	ID 	_E_PSORCIER1
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		400
		ORIENT		"TO"
		ENTITE		_PIERRE_MALEFIQUE_GC_INT
	}

	COMMENT		3
	ACTION		1
}


EXPLORE
{
	ID 	_E_PSORCIER3
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		400
		ORIENT		"TO"
		ENTITE		_PIERRE_MALEFIQUE_RN_INT
	}

	COMMENT		3
	ACTION		1
}

EXPLORE
{
	ID 	_E_PMERLIN
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		400
		ORIENT		"TO"
		ENTITE		_PIERRE_MERLIN
	}

	COMMENT		4
	ACTION		1
}


EXPLORE
{
	ID 	_E_PMERLIN2
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		400
		ORIENT		"TO"
		ENTITE		_PIERRE_MERLIN2
	}

	COMMENT		4
	ACTION		1
}


USE
{
	ID 	_U_TABL1
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		600
		ORIENT		"TO"
		ENTITE		_PIERRE_MALEFIQUE_GC_INT
	}
	ENTITE		_TABLETTE_PLOMB_2_AM
	ITEM	 	(_IO_TABLETTE_PLOMB_1, _INV_OBJET)
	ANIM		"give 2" "give 2 - pause"
	Sync		"" "give 2 - pause"

	//COMMENT	5
	ACTION		1
	FX		_FX_USE_TABLETTE_PMA_2 ACCESS
	FXFRAME		"tabplb"

}

USE
{
	ID 	_U_TABL3
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		600
		ORIENT		"TO"
		ENTITE		_PIERRE_MALEFIQUE_RN_INT
	}
	ENTITE		_TABLETTE_PLOMB_2_AM
	ITEM		 (_IO_TABLETTE_PLOMB_1, _INV_OBJET)
	ANIM		"give 2" "give 2 - pause"
	Sync		"" "give 2 - pause"
	//COMMENT	5
	ACTION		1
	FX		_FX_USE_TABLETTE_PMC_2 ACCESS
	FXFRAME		"tabplb"

	//joue FX 233
}

COMMENT
{
	ID 	8	//foulque, Arden
	AREA	101


	PRIMTRIG
	{
		TRIGGER		1
	}
	COMMENT		6
}

COMMENT
{
	ID 	9	//Corwyn, Merlin
	AREA	_ARBRE_MERLIN


	PRIMTRIG
	{
		DIST		600
		ORIENT		"TO"
		ENTITE		_DUMMY_MERLIN
	}
	COMMENT		7
	BASEJEU		46
}
ACTION
{
	ID		_IN_MAGO
	AREA		102

	PRIMTRIG
	{
		TRIGGER 1
	}
}
COMMENT
{
	ID 	10
	AREA	10	// foulque : roche noire


	PRIMTRIG
	{
		DIST		1000
		ORIENT		"TO"
		ENTITE		_DUMMY_FOULQUE
	}
	COMMENT		8
	BASEJEU		52
}

COMMENT
{
	ID 	11
	AREA	_GRANDE_CHASSE	// chariot : Corwyn


	PRIMTRIG
	{
		DIST		500
		ORIENT		"TO"
		ENTITE		_ECU_NOIR
	}
	COMMENT		9
	BASEJEU		53
}

PICK
{
	ID 	_P_ECU_NOIR
	AREA	_GRANDE_CHASSE

	HEIGHT	"H0"

	PRIMTRIG
	{
		DIST		300
		ORIENT		"TO"
		ENTITE		_ECU_NOIR
	}
	ENTITE		_ECU_NOIR
	ITEM		(_IO_ECU_NOIR, _INV_OBJET)
	COMMENT		2
	ACTION		1
	BASEJEU		54
	//STATUS	0
}

	PICK
	{
		ID 	_P_TABLETTE
		AREA	_LAC_OFFRANDES

		HEIGHT	"H0"

		PRIMTRIG
		{
			DIST		170
			ORIENT		"TO"
			ENTITE		_TABLETTE_PLOMB_1_OFF
		}
		ENTITE		_TABLETTE_PLOMB_1_OFF
		ITEM		(_IO_TABLETTE_PLOMB_1, _INV_OBJET)
		COMMENT		1
		ACTION		1
	}
	SAVE
	{
		ID 	785
		AREA	_LAC_OFFRANDES


		PRIMTRIG
		{
			TRIGGER		5
		}
		PERSIST		1
	}
	DIALOG
	{
		ID		12
		AREA		_LAC_OFFRANDES
		ENTITE		 _LANCELOT

		PRIMTRIG
		{
			DIST	400
			//ORIENT	"NONE"
			ENTITE	  _LANCELOT
		}

		SECTRIG
		{
			DIST	300
			ORIENT	"FACE"
			ENTITE	  _LANCELOT
		}
		STAND
		{
			ID	1
			TALK	( 10, 11)
			BASEJEU	47
		}

		FIN
		{
			ID	1
			TALK	( 12,13)
			FIGHT	1
		}

		FIN
		{
			ID	2
			TALK	( 24,25)
			STATUS	0
		}
		RETOUR
		{
			ID	1
			TALK	(12,13)
			FIGHT	1
		}
		RETOUR
		{
			ID	2
			TALK	(700, 701)
		}
		USE
		{
			ID	_IO_EPEE_VERITE
			TALK	(18,19)(20, 21)
			ACCESS	_EPEE_VERITE_2
			//ANIM	"jure"
			ANIM	"aspec 15" 	"jurer - pause"
			//Sync	"" "jurer - pause"
			Sync	"" "jurer 2"
			BASEJEU	49
			//fx 228
		}
		USE
		{
			ID	_IO_TABLETTE_PLOMB_1
			TALK	(26,27)
			BASEJEU	48

			ACCESS	_TABLETTE_PLOMB_1_OFF
			ANIM	"give 2" "give 2 - pause"
			Sync	"" "give 2 - pause"
			FX	_FX_USE_TABLETTE_DLG_2 ACCESS
			FXFRAME	"tabplb"
			BASEDOC	189
			
			//fx 230
		}
		USE
		{
			ID	_IO_ECU_NOIR
			TALK	(28,29)(30, 31, _ID_MAGO, _INV_DESTI)
			ACCESS	_ECU_NOIR_2
			ANIM	"give 2" "give 2 - pause"
			Sync	"" "give 2 - pause"
			BASEJEU	55

		}

		SUJET
		{
			ID	_II_MORGANOR
			TALK	(14,15)
			STATUS	0
		}

		SUJET
		{
			ID	 _II_GUENIEVRE
			TALK	(22,23)
			STATUS	0
		}

		SUJET
		{
			ID	 _II_SAGRAMOR
			TALK	(16,17)
			STATUS  0
		}
	}

	FIGHT
	{
		ID 		1
		AREA		_LAC_OFFRANDES
		LIST		(_IO_EPEE_VERITE , _EPEE_DE_VERITE , 1 )
	}


section END


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

section COMBATS

FIGHT
{
	ID		1
	AREA		_LAC_OFFRANDES
	CAMERA		15
	TARGET		_DM_CB
//	WIN		0

	OPPONENT
	{
		ENTITE		_BRADWEN
		BOX		12
		ANIM	"combat 2" "combat 2"
		SOUND	"cb02" 100
		LWEAPON		676
		DEAD		1
	}

	OPPONENT
	{
		ENTITE 		_LANCELOT
		BOX		1
		ANIM	"combat 2" "combat 2"
		
		RWEAPON		41
		LWEAPON		674
		DEAD 		0
	}
}


section END

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

	#OBJ_LOAD		(_DUMMY_MERLIN,		2 ,_ARBRE_MERLIN , 	1, 0, 0)//grande chasse
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_MERLIN)
	#OBJ_LOAD		(_PIERRE_MERLIN,	16 ,_ARBRE_MERLIN , 	1, 1, 0)//tertres
	#COL_ENABLE		(4,6)

	#OBJ_LOAD		(_PIERRE_MERLIN2, 	15 ,_ARBRE_MERLIN , 	1, 1, 0)//rhiannon
	#COL_ENABLE		(2,6)

	#OBJ_LOAD		(_PIERRE_MALEFIQUE_GC_INT,	17 ,_ARBRE_MERLIN , 	1, 1, 0)//grande chasse
	#OBJ_LOAD		(_PIERRE_MALEFIQUE_RN_INT, 	12 ,_ARBRE_MERLIN , 	1, 1, 0)//roche noire

	#OBJ_LOAD		(_PIERRE_MALEFIQUE_GC_EXT,	57 ,_LANDSCAPE_ARDEN , 	1, 1, 0)//grande chasse
	#OBJ_LOAD		(_PIERRE_MALEFIQUE_RN_EXT, 	55 ,_LANDSCAPE_ARDEN , 	1, 1, 0)//roche noire

	#OBJ_LOAD		(_CRYSTAL_PORTE, 	26 ,_ROCHE_NOIRE , 	1, 1, 1)
	#OBJ_LOAD		(_DUMMY_FOULQUE, 	 7 ,_ROCHE_NOIRE , 	1, 1, 1)
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_FOULQUE)

	#OBJ_LOAD		(_ECU_NOIR, 		 8, 	    _GRANDE_CHASSE, 			1, 1, 1)
	#OBJ_LOAD		(_LANCELOT, 		 1, 	    _LAC_OFFRANDES, 	1, 1, 1)
	#OBJ_LOAD		(_DM_CB, 		13, 	    _LAC_OFFRANDES, 	1, 1, 1)
	#OBJ_DISABLECOLLIOBJ	(_DM_CB)

	#OBJ_LOAD		(_TABLETTE_PLOMB_1_OFF,	 2, 	    _LAC_OFFRANDES, 	1, 1, 1)
	#OBJ_LOAD		(_TABLETTE_PLOMB_2_AM,	15, 	    _ARBRE_MERLIN, 	0, 1, 1)

	#OBJ_LOADACCESS		(_EPEE_VERITE_2, 1)
	#OBJ_LOADACCESS		(_ECU_NOIR_2, 1)

	set $bje, 0
	set $bjp, 0

// inventaire

	////#INV_PUTPLQ		(_IO_EPEE_VERITE, _INV_OBJET)

	////#INV_PUTPLQ		(_II_SAGRAMOR, _INV_INDIC)
	////#INV_PUTPLQ		(_II_GUENIEVRE, _INV_INDIC)
	////#INV_PUTPLQ		(_II_MORGANOR, _INV_INDIC)
	////#INV_PUTPLQ		(_IO_BROCHE_LUTISSE, 	_INV_OBJET) 
	
	//#INV_PUTPL		(_IO_TABLETTE_PLOMB_1, _INV_OBJET) //test
	//#INV_PUTPL		(_IO_ECU_NOIR, _INV_OBJET)	//test

	//fx
	#VFX_LOADBOX		(_FX_CYCLE_PIERRE_SORCIER_5, 16, _ARBRE_MERLIN, 0)
	#VFX_START		(_FX_CYCLE_PIERRE_SORCIER_5)
	#VFX_LOADBOX		(_FX_CYCLE_PIERRE_SORCIER_4, 15, _ARBRE_MERLIN, 0)
	#VFX_START		(_FX_CYCLE_PIERRE_SORCIER_4)
	
	#VFX_LOADLINK		(_FX_CYCLE_PLAQUETTE_1, _TABLETTE_PLOMB_1_OFF,	"Pfx", 0)
	#VFX_START		(_FX_CYCLE_PLAQUETTE_1)

	#VFX_LOADBOX		(_FX_KRISTO1, 17, _ARBRE_MERLIN, 0)
	#VFX_START		(_FX_KRISTO1)
	#VFX_LOADBOX		(_FX_KRISTO3, 12, _ARBRE_MERLIN, 0)
	#VFX_START		(_FX_KRISTO3)

	#VFX_LOADBOX		(_FX_KRISTO4, 57, _LANDSCAPE_ARDEN, 0)
	#VFX_START		(_FX_KRISTO4)
	#VFX_LOADBOX		(_FX_KRISTO6, 55, _LANDSCAPE_ARDEN, 0)
	#VFX_START		(_FX_KRISTO6)

	#VFX_LOADLINK		(_FX_DISPAR_P_MALEF1_LK,	 _PIERRE_MALEFIQUE_GC_INT, 	"pmalef", 0)
	#VFX_LOAD		(_FX_DISPAR_P_MALEF1_ENT,	 _PIERRE_MALEFIQUE_GC_INT, 	0)
	#VFX_LOADLINK		(_FX_DISPAR_P_MALEF3_LK,	 _PIERRE_MALEFIQUE_RN_INT, 	"pmalef", 0)
	#VFX_LOAD		(_FX_DISPAR_P_MALEF3_ENT,	 _PIERRE_MALEFIQUE_RN_INT, 	0)
	
	//ne pas voir les ponts
	#COL_ENABLE	( 1, _LAC_OFFRANDES)
	#COL_ENABLE	( 2, _LAC_OFFRANDES)
	#COL_ENABLE	( 3, _LAC_OFFRANDES)

section END

section LOOP
OnEvent _U_TABL1
{
	if $bje = 0
	{
		#BJE_EVENT(50, _E_PSORCIER3)
		set $bje, 1
	}
	if $bjp = 0
	{
		#BJE_EVENT(51, _E_PSORCIER3)
		set $bjp, 1
	}

	//remettre
	if @INV_OWNPL(_IO_TABLETTE_PLOMB_1, _INV_OBJET) = 0
	{
		#INV_PUTPLQ(_IO_TABLETTE_PLOMB_1, _INV_OBJET)
	}
	run 351
	#NAR_COMMENT(5)	//Corwyn a les jetons

}

OnEvent _U_TABL3
{
	if $bje = 0
	{
		#BJE_EVENT(50, _E_PSORCIER3)
		set $bje, 1
	}
	if $bjp = 0
	{
		#BJE_EVENT(51, _E_PSORCIER3)
		set $bjp, 1
	}

	if @INV_OWNPL(_IO_TABLETTE_PLOMB_1, _INV_OBJET) = 0
	{
		#INV_PUTPLQ(_IO_TABLETTE_PLOMB_1, _INV_OBJET)
	}
	run 353
	#NAR_COMMENT(5)	//Corwyn a les jetons

}

OnDialog 12 use _IO_EPEE_VERITE
{
	#DLG_DISABLEFIN(12, _LAC_OFFRANDES, 1)
	#DLG_DISABLERET(12, _LAC_OFFRANDES, 1)
	#DLG_ENABLEFIN(12, _LAC_OFFRANDES, 2)
	#DLG_ENABLERET(12, _LAC_OFFRANDES, 2)
	
	#DLG_ENABLESUJ(12, _LAC_OFFRANDES, _II_MORGANOR)
	#DLG_ENABLESUJ(12, _LAC_OFFRANDES, _II_GUENIEVRE)
	#DLG_ENABLESUJ(12, _LAC_OFFRANDES, _II_SAGRAMOR)
	
	if @INV_OWNPL(_IO_EPEE_VERITE, _INV_OBJET) = 0
	{
		#INV_PUTPLQ(_IO_EPEE_VERITE, _INV_OBJET)
	}
	//#DLG_ENABLERET(12, _LAC_OFFRANDES, 2)
}
OnDialog 12 use _IO_ECU_NOIR
{
	if @INV_OWNPL(_IO_ECU_NOIR, _INV_OBJET) = 0
	{
		#INV_PUTPLQ(_IO_ECU_NOIR, _INV_OBJET)
	}
}
OnDialog 12 use _IO_TABLETTE_PLOMB_1
{
	if @INV_OWNPL(_IO_TABLETTE_PLOMB_1, _INV_OBJET) = 0
	{
		#INV_PUTPLQ(_IO_TABLETTE_PLOMB_1, _INV_OBJET)
	}
}

OnFight 1
{
	#EVT_DISABLE(12)
	over 0
}

OnEvent _IN_MAGO
{
 	#INV_REMPL(	_ID_MAGO, _INV_DESTI)

	endc
}
OnEvent _P_ECU_NOIR
{
	#BJE_ENABLE(54)
}

OnEvent _E_PSORCIER3
{
	if $bje = 0
	{
		#BJE_EVENT(50, _E_PSORCIER3)
		set $bje, 1
	}

}

OnEvent _E_PSORCIER1
{
	if $bje = 0
	{
		#BJE_EVENT(50, _E_PSORCIER1)
		set $bje, 1
	}

}


section END

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

section CTR

CTR
{
	ID	351
	PROG
	{
		#VFX_STOP	(_FX_KRISTO1)
		#VFX_START	(_FX_DISPAR_P_MALEF1_LK)
		#VFX_START	(_FX_DISPAR_P_MALEF1_ENT)
		SyncFx		_FX_DISPAR_P_MALEF1_ENT 0
		#OBJ_DISABLE	(_PIERRE_MALEFIQUE_GC_INT)

		//désactiver entité 374 IN LANDSCAPE
		#VFX_STOP	(_FX_KRISTO4)
		#OBJ_DISABLE	(_PIERRE_MALEFIQUE_GC_EXT)
	}
}


CTR
{
	ID	353
	PROG
	{
		//joue FX disparM ent 565
		#VFX_STOP	(_FX_KRISTO3)
		#VFX_START	(_FX_DISPAR_P_MALEF3_LK)
		#VFX_START	(_FX_DISPAR_P_MALEF3_ENT)
		SyncFx		_FX_DISPAR_P_MALEF3_ENT 0
		#OBJ_DISABLE	(_PIERRE_MALEFIQUE_RN_INT)

		//désactiver entité 656 IN LANDSCAPE
		#VFX_STOP	(_FX_KRISTO6)
		#OBJ_DISABLE	(_PIERRE_MALEFIQUE_RN_EXT)
	}
}

section END