define script EvilCreatures

begin script EvilCreatures

	Pen[NUMBER_OF_TOWNS]
	Player[NUMBER_OF_TOWNS]
	Creature[NUMBER_OF_TOWNS]
	Check[NUMBER_OF_TOWNS]
	Cnt = 0
	Ctr = 0
	Scroll[0]
	Rand = 0
	
start
	// Identify the pens and find the players 
	force while Cnt < townCount
		Check[Cnt] = get building ABODE_NUMBER_CREATURE_PEN in Town[Cnt] min built 1.0
		if Check[Cnt] exists and get Town[Cnt] player != 0
			Player[Ctr] = get Town[Cnt] player
			Pen[Ctr] = Check[Cnt]
			Ctr++
		end if
		Cnt++
	end while
	
	// Let's place a creature a pen. If there are any
	if Ctr != 0
		Cnt = number from 0 to Ctr - 1
		Rand = number from 0 to 4

		if Rand == 0
			Creature[Cnt] = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_COW at {Pen[Cnt]} using only alignment good neutral evil
		elsif Rand == 1
			Creature[Cnt] = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {Pen[Cnt]} using only alignment good neutral evil
		elsif Rand == 2
			Creature[Cnt] = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_COW at {Pen[Cnt]} using only alignment good neutral evil
		elsif Rand == 3
			Creature[Cnt] = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_TIGER at {Pen[Cnt]} using only alignment good neutral evil
		elsif Rand == 4
			Creature[Cnt] = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_APE at {Pen[Cnt]} using only alignment good neutral evil
		end if

		set creature Creature[Cnt] happiness to maximum
		set creature Creature[Cnt] energy to 1.0
		set player Player[Cnt] creature to Creature[Cnt]
		//set player 1 creature to Creature[Cnt]
		set Creature[Cnt] DEVELOPMENT_PHASE_FULLY_MATURE development
		set creature Creature[Cnt] CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 1.0
		set creature Creature[Cnt] CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT -1

		teach Creature[Cnt] all
		set Creature[Cnt] desire CREATURE_DESIRE_TO_LOOK_AROUND to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_WANDERLUST to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_IMPRESS to 0
		set Creature[Cnt] desire CREATURE_DESIRE_CURIOSITY to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_STAY_NEAR_HOME to 0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_HANG_AROUND_AT_HOME to 0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_STEAL to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_ATTACK_TOWN to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_MISCHIEF to 1.0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_PERFORM_EXPRESSIVE_IDLE to 0
		set Creature[Cnt] desire CREATURE_DESIRE_TO_STAY_IN_FRIENDLY_TERRITORY to 0
		set Creature[Cnt] desire CREATURE_DESIRE_ANGER to 0.0
		set Creature[Cnt] desire CREATURE_DESIRE_HUNGER to 0.3
		enable leash on Creature[Cnt]
		detach Creature[Cnt] leash
		wait 3 seconds
		disable leash on Creature[Cnt]

		enable Creature[Cnt] can learn LA_EAT
		enable Creature[Cnt] can learn LA_SLEEP
		enable Creature[Cnt] can learn LA_POO
		enable Creature[Cnt] can learn LA_STEAL
		enable Creature[Cnt] can learn LA_WEIGHTLIFT
		enable Creature[Cnt] can learn LA_GATHER
		enable Creature[Cnt] can learn LA_BUILD
		enable Creature[Cnt] can learn LA_PLAY
		enable Creature[Cnt] can learn LA_WATER
		enable Creature[Cnt] can learn LA_HEAL
		enable Creature[Cnt] can learn LA_ATTACK
		enable Creature[Cnt] can learn LA_SACRIFICE
		enable Creature[Cnt] can learn LA_EXPLORE
		enable Creature[Cnt] can learn LA_MAX 

		set Creature[Cnt] home position {Pen[Cnt]}
		release Creature[Cnt]
		release Creature[Cnt] focus	
	end if

end script EvilCreatures