//------------------------------------------------------------------------------
func void ZS_HangAround ()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP (Self,self.wp);
	AI_Sit(self,self.wp);
};

func void ZS_HangAround_Loop ()
{
	PrintDebug("ZS_HangAround");
};

//------------------------------------------------------------------------------
func void ZS_Sleep()
{
	PrintDebug	("ZS_Sleep");
	if ((Hlp_StrCmp(Npc_GetNearestWp (self),self.wp)== 0))

	{
		AI_SetWalkmode (self,NPC_WALK);
		AI_GotoWP	(self, self.wp);
	};
	AI_Lie		(self, self.wp);
};

func void ZS_Sleep_Loop()
{
	PrintDebug	("ZS_Sleep_Loop");
};

func void ZS_Sleep_End()
{
	PrintDebug	("ZS_Sleep_End");
	AI_StandUp	(self);
};

//------------------------------------------------------------------------------
func void ZS_Guard()
{
	PrintDebug				("ZS_Guard");
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP				(self, self.wp);
	//AI_Wait					(self, 1);
	AI_AlignToWP			(self);	
};

func void ZS_Guard_Loop()
{
	PrintDebug				("ZS_Guard_Loop");
};

//------------------------------------------------------------------------------
func void ZS_PickOre()
{
};

//------------------------------------------------------------------------------
FUNC VOID ZS_Cook ()
{
	PrintDebug				("ZS_Cook");
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP				(self,self.wp);
	AI_AlignToWP			(self);
	AI_LookForItem			(self,IT_I_SCOOP);
	AI_PlayAni				(self,"T_STAND_2_COOK");

};

FUNC VOID ZS_Cook_Loop()
{
	PrintDebug				("ZS_Cook_Loop");
	AI_AlignToWP			(self);
	Mdl_ApplyRandomAni		(self,"S_COOK","R_COOK_SWEAT");
	Mdl_ApplyRandomAniFreq	(self,"S_COOK",20.0);
};

FUNC VOID ZS_Cook_End()
{
	PrintDebug				("ZS_Cook_End");
	AI_RemoveFromHand		(self,IT_I_SCOOP);
	AI_PlayAni				(self,"T_COOK_2_STAND");
};

//------------------------------------------------------------------------------
func void ZS_Eat()
{
};

//------------------------------------------------------------------------------
FUNC VOID ZS_RepairHut ()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP				(self, self.wp);
	AI_AlignToWP			(self);
	AI_LookForItem			(self, IT_I_Hammer);
	AI_PlayAni				(self,"T_STAND_2_REPAIRHUT");
};

FUNC VOID ZS_RepairHut_Loop ()
{
	Mdl_ApplyRandomAni		(self,"S_REPAIRHUT","R_REPAIRHUT_CHECK");
	Mdl_ApplyRandomAniFreq	(self,"S_REPAIRHUT",20.0);
	AI_AlignToWP			(self);
};

FUNC VOID ZS_RepairHut_End()
{
	AI_RemoveFromHand	(self,IT_I_HAMMER);
	AI_PlayAni			(self,"T_REPAIRHUT_2_STAND");
};

//------------------------------------------------------------------------------
/*func void ZS_Speech()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP(self,self.wp);
	AI_AlignToWP (self);^T_IDOL_STAND_2_S0 //Hinknien
	PrintDebug("ZS_Speech");S_IDOL_S0//AUfrechtknien
	self.aivar[AIV_SPEECH_COUNTER] = 0;T_IDOL_S0_2_S1// Runterbeugen
S_IDOL_S1// auf Boden
T_IDOL_S1_2_S0
	
};*/
func void ZS_Speech()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP (self,self.wp);
	AI_AlignToWP (self);
	AI_PlayAni (self,"T_STAND_2_PRAY");// Hinknien
};

func void ZS_Speech_Loop()
{
};

func void ZS_Speech_End ()
{
	AI_PlayAni (self,"T_PRAY_2_STAND");
};
	
	/* Hardgecodet für Demo 4 !!! Nachher wieder rausnehmen
	PrintDebug("...1");
    self.aivar[AIV_SPEECH_COUNTER] += 1;
	PrintDebug("ZS_Speech_Loop");
	if (self.aivar[AIV_SPEECH_COUNTER] == 1)
	{                                
		PrintDebug("...2"); 
		AI_OutputSVM(self,"$NovSpeech1");
		AI_OutputSVM(self,"$NovSpeech2");
		self.aivar[AIV_SPEECH_COUNTER] += 1;
	}                                
                                     
	else if (self.aivar[AIV_SPEECH_COUNTER] == 2)
	{                                
		PrintDebug("...3");
		AI_OutputSVM(self,"$NovSpeech3");
		self.aivar[AIV_SPEECH_COUNTER] += 1;
	}                                
                                     
	else if (self.aivar[AIV_SPEECH_COUNTER] == 3)
	{                                
		PrintDebug("...4");
		AI_OutputSVM(self,"$NovSpeech4");
		self.aivar[AIV_SPEECH_COUNTER] += 1;
	}                                
                                     
	else if (self.aivar[AIV_SPEECH_COUNTER] == 4)
	{                                
		PrintDebug("...5");
		AI_OutputSVM(self,"$NovSpeech5");
		self.aivar[AIV_SPEECH_COUNTER] += 1;
	}                                
                                     
	else if (self.aivar[AIV_SPEECH_COUNTER] == 5)
	{                                
		PrintDebug("...6");
		AI_OutputSVM(self,"$NovSpeech6");
		self.aivar[AIV_SPEECH_COUNTER] += 1;
	}

	else if (self.aivar[AIV_SPEECH_COUNTER] == 6)
	{
		PrintDebug("...7");
		AI_OutputSVM(self,"$NovSpeech7");
		self.aivar[AIV_SPEECH_COUNTER] = 0;
	};*/
//};

//------------------------------------------------------------------------------
func void ZS_Listen()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP(self, self.wp);
	AI_AlignToWp (self);
	if (other.id == 1300)
	{
		AI_TurnToNpc (self,other);
	};
};
func void ZS_Listen_Loop()
{
};

//------------------------------------------------------------------------------
FUNC VOID ZS_PlayMusic()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP			(self, self.wp);// AI_DoState
	AI_AlignToWP		(self);
	AI_LookForItem		(self, IT_T_LAUTE);
	AI_PlayAni			(self, "T_STAND_2_PLAYMUSIC");
};

FUNC VOID ZS_PlayMusic_Loop ()
{
};

FUNC VOID ZS_PlayMusic_End() 
{ 
	AI_PlayAni			(self, "T_PLAYMUSIC_2_STAND"); 
	AI_RemoveFromHand	(self,IT_T_LAUTE); 
};

func void ZS_Drunk ()
{
	PrintDebug("ZS_Drunk");
	Npc_SetToDrunk (self,60);
	AI_GotoWP (self,Npc_GetNearestWp (self));
	AI_GotoWP (self,Npc_GetNextWP	(self));
};



func void ZS_GotoWP ()
{
	PrintDebug("ZS_GotoWP");
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP (self,self.wp);// Im Zustand gehe dahin geht Nsc dahin ! (Sonst noch fragen ?)
};

func void ZS_GotoWp_Loop ()
{
	var string helpwp1;
	helpwp1 = Npc_GetNearestWP (self);
	var string helpwp2;
	helpwp2 = Npc_GetNextWp(self);
	AI_GotoWP (self,helpwp1);
	AI_GotoWP (self,helpwp2);
};

FUNC VOID ZS_MoveMob()                         
// self		= NSC, dem der Mob im Wege steht   
// mob		= der Mob                          
{                                              
	PrintDebug("ZS_MoveMob");
	Print("Mob im Weg !");                     
}; 

//**************************************************************************************************************************
//				Reste ZS.d
//				==========
//**************************************************************************************************************************

func void ZS_Default()
{
};

func void ZS_Bezerk ()
// Keine Fluchtmöglichkeiten, also DoTheBezerk
{
		B_DrawWeapon(self); //ohne Waffe kein Angriff
		AI_Attack(self,other);// Atttacke ich komme hier nicht weg
};

func void ZS_Dead ()
{
};


func void ZS_High ()
{
};


func void ZS_AssessCall ()
{
};	

func void ZS_AssessTraveler ()
{
};

func void ZS_MovePerson ()
{
};

func void ZS_AssessItem ()
{	
	if (Wld_DetectItem(self,ITEM_KAT_NF))
	{
		AI_TakeItem(self,item);
		if (item.dam_weapon >= 4)
		{
			B_Say(self,"$FoundCoolItem");
		};
	}
	else if (Wld_DetectItem(self,ITEM_KAT_FF))
	{
		AI_TakeItem(self,item);
	}
	else if (Wld_DetectItem(self,ITEM_KAT_FOOD))
	{
		AI_TakeItem(self,item);
	//}
	//else if (Wld_DetectItem (self,ITEM_ZF) && (item.id == 1000) && (self.id == 100))
	//{
	//	AI_DoState(self,ZS_Dance,3);
	};
};

func void ZS_GiveAlarm ()
{
};

func void ZS_GetHelp ()
{
};

func void ZS_Unconcious_Begin ()
{
	self.aivar [0] == 0;
	//AI_Output (/* hinfallen etc., evtl. B_Unconcious ?*/);
};
	
func void ZS_Unconcious ()
{
	if (self.aivar [0] != 40/*Zeitschema mit Mike absprechen, hier mal 120sek oder xxxWeltzeit */)
	{
		//AI_Lie(self,/* Boden*/);
		self.aivar [0] += 1;
	};
};

func void ZS_Unconcious_End ()
{
	//AI_Output (/*Benommen Aufstehen*/);
};

FUNC VOID ZS_WatchForPlayer()
{
	// Do nothing...
};

FUNC VOID ZS_WatchForPlayer_Loop()
{
	if (Wld_DetectPlayer(self)) {
		AI_Attack(self,other);
	};
};

FUNC VOID ZS_Bribe()
{
	AI_SetWalkmode (self,NPC_WALK);
	AI_GotoWP(self,self.wp);
};

FUNC VOID ZS_Bribe_Loop()
{
	VAR C_ITEM selfWeapon;
	VAR C_ITEM otherWeapon;

	if ((self.aivar[0]==0) && (Wld_DetectPlayer(self))) {
		if (Npc_HasEquippedMeleeWeapon(self) && Npc_HasEquippedMeleeWeapon(other))
		{
			selfWeapon	= Npc_GetEquippedMeleeWeapon(self);
			otherWeapon = Npc_GetEquippedMeleeWeapon(other);

			if (selfWeapon.dam_weapon < otherWeapon.dam_weapon)
			{
				self.aivar[0] = 1;	// Asked...
				AI_TurnToNpc	(self,	other);
				//AI_Ask			(self,	"Grunt: 'He Kleiner, deine Klinge gefällt mir. GIB SIE MIR!!!",Bribe_Yes,Bribe_No);
			};
		};
	};
};

FUNC VOID Bribe_Yes()
{
	VAR C_ITEM otherWeapon;

	otherWeapon =	Npc_GetEquippedMeleeWeapon(other);
	Npc_GiveItem	(other,	otherWeapon, self);
	AI_EquipBestMeleeWeapon(self);

	AI_PointAtObj	(self,	other);
	
	AI_Wait			(self,	0.5);
	AI_StopPointAt	(self);	
};

FUNC VOID Bribe_No()
{
	
	AI_Attack		(self,	other);
};

func void ZS_Heal ()
{
};



FUNC VOID ZS_AssessMob()
// self		= NSC
// mob		= NULL !!!
{
	PrintDebug("Mobs detected.");
};


FUNC VOID ZS_MoveNpc()
// self		= NSC, dem der andere NSC im Wege steht
// other	= anderer NSC
{
	PrintDebug("NSC im Weg,");
};

FUNC VOID ZS_Dies()
{
	PrintDebug("Uargh.");
};

FUNC VOID ZS_EnemyDown()
{
	PrintDebug("Ha ! Steh auf, du Lusche !");
};

FUNC VOID ZS_Attack ()	
{
	AI_Attack (self,other);
};

func void ZS_BabeIntruder()
{
	AI_DoState(self,ZS_Dance,1);
};

func void ZS_HelpAttack ()
{
	if (other.guild != 23 && Npc_IsPlayer (other))
	{
		AI_DoState(self,ZS_Attack,0);
	};
};

/*func void ZS_Pray ()
{
	AI_GotoWp (self,"OCC_");
	AI_PlayAni (*/