challenge CREATURE_DEVELOPMENT
run script CreatureDevLeashAttachToVillager

begin script CreatureDevLeashAttachToVillager
	MyCreaturePos = marker at [1896.4113, 18.0900, 2527.4729]
	TrainerPos = marker at [1856.9500, 30.2076, 2655.1396] // near the HouseToLeashTo
	MyCreature = get player 1 creature
	Trainer = create VILLAGER MALE at [TrainerPos]
	Highlight=0
	Rope = marker at [1896.4113, 18.0900, 2527.4729] // TODO: should be pos of Rope Icon.
	CamPos = marker at [1894.2354, 28.8333, 2508.1797]
	CamFocus = marker at [1915.0500, 18.0900, 2508.8899]
	CitadelEntrancePos = marker at [1906.8438, 18.0900, 2514.3760]
	TrainerDestination = marker at [1835.8472, 32.3615, 2694.4175]
	StoragePitPos = marker at [1814.3518, 28.1400, 2707.0269]
start
	disable Trainer moveable
	disable Trainer pickup
	Highlight = create highlight HIGHLIGHT_QUEST at [Trainer]
	run script CreatureDevelopmentHighlightNotify(Highlight, Trainer, 100, variable GOOD_ADVISOR, variable HELP_TEXT_GENERAL_CHALLENGE_START_01)
	move MyCreature position to [MyCreaturePos]	
	begin cinema
		set Trainer focus to [TrainerPos]-[10,0,10]
		set camera position to [TrainerPos]-[10,0,10] // TODO: nice camera paths
		set camera focus to [TrainerPos]	// TODO: nice camera paths
		Trainer play ANM_P_BECKON loop 1
		wait until Trainer played
		say "You can attach the leash to a moving object"
		set Trainer focus to [MyCreature]
		Trainer play ANM_P_INTO_POINTING loop 1
		wait until Trainer played
		wait until read
		say "Try it now - attach the leash to me!"
		Trainer play ANM_P_TALKING_AND_POINTING loop 1
		wait until Trainer played
		Trainer play ANM_P_OUT_OF_POINTING loop 1
		wait until Trainer played
		wait until read
		release MyCreature
	end cinema
	wait until MyCreature leashed to Trainer
	begin cinema
		begin dual camera to MyCreature Trainer
			set Trainer focus to [CamPos]
			wait until Trainer played
			Trainer play ANM_P_CROWD_IMPRESSED_1 loop 1
			say "Well done."
			wait until Trainer played
			wait until read
			move Trainer position to [TrainerDestination]
			wait until [Trainer] near [TrainerDestination] radius 5
			set Trainer focus to [StoragePitPos]
			Trainer play ANM_P_INTO_POINTING loop 1
			wait until Trainer played
			wait until read
			say "If you leash your creature to one of these villagers, he will follow them, and learn from them!"			
			Trainer play ANM_P_TALKING_AND_POINTING loop 1
			wait until Trainer played
			Trainer play ANM_P_OUT_OF_POINTING loop 1
			wait until Trainer played
			wait until read
		end dual camera
	end cinema
	delete Trainer
end script CreatureDevLeashAttachToVillager
