Benutzer-Werkzeuge

Webseiten-Werkzeuge


devscripts:voelker

Völker (MP tauglich) - Entwicklung

Dieses Skript ist ein Siedler 5 Mod, der eine Völkerauswahl erlaubt und jeweilige Spezialfähigkeiten des gewählten Volks ermöglicht.

Aktuelle Scriptgröße: ca. 30 KB

Anregungen, Wünsche und Vorschläge

Bitte im siedler-maps.de Forum posten unter dem hier gelinktem Beitrag

Entwicklungsstand und Aussichten

Das Skript befindet sich in Entwicklung.
Das Skript soll eine Multiplayertaugliche Modifikation des Originalsspiels sein, durch welche neue Völkereigenschaften integriert werden.

Beteiligte Entwickler

Versions-History und geplante Änderungen

Versions-History

  • Version 0.10
    • Grundlegende Völkerkonfiguration

bisher geplante, noch nicht vollendete Änderungen

  • Auswahl der Völker bei Spielstart
  • Druidenfähigkeiten integrieren

Code

Völker V0.1

-----------------------------------------------------------------------------
-- MapName: XXX
-- Author: XXX
-----------------------------------------------------------------------------
 
function GameCallback_OnGameStart()
 
	-- Include global tool script functions
	Script.Load(Folders.MapTools.."Ai\\Support.lua")
	Script.Load( "Data\\Script\\MapTools\\MultiPlayer\\MultiplayerTools.lua" )
	Script.Load( "Data\\Script\\MapTools\\Tools.lua" )
	Script.Load( "Data\\Script\\MapTools\\WeatherSets.lua" )
	IncludeGlobals("Comfort")
 
	-- Init  global MP stuff
	MultiplayerTools.InitCameraPositionsForPlayers()
	MultiplayerTools.SetUpGameLogicOnMPGameConfig()
    if XNetwork.Manager_DoesExist() == 0 then
	-- Standardschleife für Multiplayersetup 8 Player
        for i=1,8 do
			MultiplayerTools.DeleteFastGameStuff(i)
		end
		local PlayerID = GUI.GetPlayerID()
        Logic.PlayerSetIsHumanFlag( PlayerID, 1 )
        Logic.PlayerSetGameStateToPlaying( PlayerID )
	end
 
	for i = 1,8 do
		Tools.GiveResouces(i, 5000, 5000, 5000, 5000, 5000, 5000)
		ResearchTechnology( Technologies.GT_Construction, i )
		ResearchTechnology( Technologies.GT_Matchlock, i )
		ResearchTechnology( Technologies.GT_Alchemy, i )	
		ResearchTechnology( Technologies.T_Tracking, i )	
		ResearchTechnology( Technologies.GT_PulledBarrel, i )
 
	end
	Ana_Comfort_TrackEntitysIni()
	Globale_Hilfsvariablen()
	Setup_GUIHacks()
	Ana_Setup_PeopleComf()
 
end
 
-- Uebergeordnete Voelkerfunktionen
 
function Ana_Setup_PeopleComf()
	-- Startmana
	gvAna_Ppl_Mana = {50000,50000,50000,50000,50000,50000}
	-- Produktion aktiv
	gvAna_Ppl_ManaProdActive = {false, false, false, false, false, false}
 
	-- Volkwahl (0 ist kein Volk gewaehlt)
	-- (1) Kelten (2) Roemer (3) Germanen (4) Chinesen
	gvAna_Ppl_Player = {0,0,0,0,0,0}
	gvAna_Ppl_PlayerProdPeopleType = {0,0,0,0,0,0}
	gvAna_Ppl_SelectionVisible = true
	gvAna_Ppl_PlayerAllSelected = false
	gvAna_Ppl_ManaProdTriggerTime = 0
	gvAna_Ppl_Status = {}
	gvAna_Ppl_Status.LastMana = 0
	gvAna_Ppl_Status.LastProd = 0
	gvAna_Ppl_Status.LastMotivation = 0
	gvAna_Ppl_Status.LastSettlersRes = 0
	gvAna_Ppl_Status.LastSettlersFarm = 0
	gvAna_Ppl_Status.LastEffectiveness = 0
	gvAna_Ppl_Status.NumberOfSettlers = 0
	gvAna_Ppl_DruidsSpellsPossible = {false,false,false}
 
	gvAna_Ppl_Druids = {}
	gvAna_Ppl_DruidsCD = {}
	gvAna_Ppl_DruidsCDSpell1 = 5
	gvAna_Ppl_DruidsCDSpell2 = 15
	gvAna_Ppl_DruidsCDSpell3 = 30
	for i=1,6 do
		gvAna_Ppl_Druids[i] = {0,0,0,0,0}	
		gvAna_Ppl_DruidsCD[i] = {}
		for u =1,5 do
			gvAna_Ppl_DruidsCD[i][u] = {0,0,0}
		end
	end
	gvAna_Ppl_ChineseRifleUpDelay = {-1,-1,-1,-1,-1,-1}
	gvAna_Ppl_ChineseRifleUpDelayJobId = 0
 
 
	Ana_Ppl_SetupCeltic()
	Ana_Ppl_Setup_Roman()
	Ana_Setup_PeopleSelectionTributes()
	Ana_Setup_PeopleSpecialTributes()
	Ana_Ppl_SetupVariables()
 
	-- benoetigte Jobs
	StartSimpleJob("Ana_Ppl_DruidsCDJob")
	StartSimpleJob("Ana_People_AddManaJob")
	StartSimpleHiResJob("WPUpdateFeedback")
	gvAna_Ppl_WaitForSelectionJob = StartSimpleJob("Ana_WaitForSelection")
 
	-- noetige Trigger
	Trigger.RequestTrigger( Events.LOGIC_EVENT_ENTITY_CREATED, "", "ActionOnEntityCreated", 1)
	Trigger.RequestTrigger( Events.LOGIC_EVENT_ENTITY_DESTROYED, "", "ActionOnEntityDestroyed", 1)
	-- Setupfunktionen
 
 
end
 
function Ana_Ppl_SetupVariables()
	gvAna_Ppl_ManaCosts = {}
 
	-- Kelten
	gvAna_Ppl_ManaCosts[1] = {}
	gvAna_Ppl_ManaCosts[1][9] = 500 -- Manakosten Druide
	gvAna_Ppl_ManaCosts[1][8] = 500 -- Goldkosten Druide
	gvAna_Ppl_ManaCosts[1][1] = 150 -- Zauber 1
	gvAna_Ppl_ManaCosts[1][2] = 400 -- Zauber 2
	gvAna_Ppl_ManaCosts[1][3] = 600 -- Zauber 3
	gvAna_Ppl_RangeSpell1 = 1500
	gvAna_Ppl_RangeSpell3 = 1500
	gvAna_Ppl_CelticMinResources_Pit = 1000
	gvAna_Ppl_CelticRangeResources_Pit = 1000
	gvAna_Ppl_CelticMinResources_Heaps = 100
	gvAna_Ppl_CelticRangeResources_Heaps = 200
 
	-- Römer
	gvAna_Ppl_ManaCosts[2] = {}
	gvAna_Ppl_ManaCosts[2][1] = 150 -- Manakosten Matrialroemer
	gvAna_Ppl_ManaCosts[2][2] = 300 -- Manakosten KriegsMatrialroemer	
	gvAna_Ppl_RomanMinResources = 200
	gvAna_Ppl_RomanRangeResources = 200
	gvAna_Ppl_RomanMinWarResources = 300
	gvAna_Ppl_RomanWarRangeResources = 150
	-- Germanen
	gvAna_Ppl_ManaCosts[3] = {}
	gvAna_Ppl_ManaCosts[3][1] = 300 -- Einheitklasse 1
	gvAna_Ppl_ManaCosts[3][2] = 400 -- Einheitklasse 2
	gvAna_Ppl_ManaCosts[3][3] = 550 -- Einheitklasse 3	
    gvAna_Ppl_ManaCosts[3][4] = 650 -- Einheitklasse 4	
end
 
function Ana_Setup_PeopleSpecialTributes()
	gvAna_Ppl_SpecialTributes = {}	
	for i = 1,6 do		
		gvAna_Ppl_SpecialTributes[i] = ""
	end
	-- Spieler/Volk
	gvAna_Ppl_SpecialTributesCallback = {}
	for i = 1,6 do
		gvAna_Ppl_SpecialTributesCallback[i] = {}
	end
 
	gvAna_Ppl_SpecialTributesCallback[1][1] = function() Ana_Ppl_SpecialTributesCallback(1, 1) end	
	gvAna_Ppl_SpecialTributesCallback[2][1] = function() Ana_Ppl_SpecialTributesCallback(2, 1) end	
	gvAna_Ppl_SpecialTributesCallback[3][1] = function() Ana_Ppl_SpecialTributesCallback(3, 1) end
	gvAna_Ppl_SpecialTributesCallback[4][1] = function() Ana_Ppl_SpecialTributesCallback(4, 1) end
	gvAna_Ppl_SpecialTributesCallback[5][1] = function() Ana_Ppl_SpecialTributesCallback(5, 1) end
	gvAna_Ppl_SpecialTributesCallback[6][1] = function() Ana_Ppl_SpecialTributesCallback(6, 1) end
	gvAna_Ppl_SpecialTributesCallback[1][2] = function() Ana_Ppl_SpecialTributesCallback(1, 2) end	
	gvAna_Ppl_SpecialTributesCallback[2][2] = function() Ana_Ppl_SpecialTributesCallback(2, 2) end	
	gvAna_Ppl_SpecialTributesCallback[3][2] = function() Ana_Ppl_SpecialTributesCallback(3, 2) end
	gvAna_Ppl_SpecialTributesCallback[4][2] = function() Ana_Ppl_SpecialTributesCallback(4, 2) end
	gvAna_Ppl_SpecialTributesCallback[5][2] = function() Ana_Ppl_SpecialTributesCallback(5, 2) end
	gvAna_Ppl_SpecialTributesCallback[6][2] = function() Ana_Ppl_SpecialTributesCallback(6, 2) end
	gvAna_Ppl_SpecialTributesCallback[1][3] = function() Ana_Ppl_SpecialTributesCallback(1, 3) end	
	gvAna_Ppl_SpecialTributesCallback[2][3] = function() Ana_Ppl_SpecialTributesCallback(2, 3) end	
	gvAna_Ppl_SpecialTributesCallback[3][3] = function() Ana_Ppl_SpecialTributesCallback(3, 3) end
	gvAna_Ppl_SpecialTributesCallback[4][3] = function() Ana_Ppl_SpecialTributesCallback(4, 3) end
	gvAna_Ppl_SpecialTributesCallback[5][3] = function() Ana_Ppl_SpecialTributesCallback(5, 3) end
	gvAna_Ppl_SpecialTributesCallback[6][3] = function() Ana_Ppl_SpecialTributesCallback(6, 3) end
 
	gvAna_Ppl_SpecialTributes = {}
	for i = 1,6 do
		gvAna_Ppl_SpecialTributes[i] = {}
		for u = 1,4 do
			gvAna_Ppl_SpecialTributes[i][u] = AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_SpecialTributesCallback[i][u] ) )
		end
	end
 
	Ana_Ppl_SpecialTributesCallback = function(_playerId, _volk)
		if _volk == 1 then
			Ana_Ppl_CreateDruid_Celtic(_playerId);
		elseif _volk == 2 then
			Ana_Ppl_GetResources_Roman(_playerId);
		elseif _volk == 3 then
			Ana_Ppl_GetPatriots_Germanen(_playerId );
		end
		gvAna_Ppl_SpecialTributes[_playerId ][_volk] = AddTribute( CreateATribute(8, "dr", { Gold = 0}, gvAna_Ppl_SpecialTributesCallback[_playerId][_volk] ) )				
	end
 
end
 
function Ana_Setup_ManaProdSwitchTributes()
 
	Ana_Ppl_ProdSwitchTributeCallback = {}
	Ana_Ppl_ProdSwitchTributeCallback[1] = function() Ana_Ppl_ProdSwitchTributeCallback_func(1) end	
	Ana_Ppl_ProdSwitchTributeCallback[2] = function() Ana_Ppl_ProdSwitchTributeCallback_func(2) end	
	Ana_Ppl_ProdSwitchTributeCallback[3] = function() Ana_Ppl_ProdSwitchTributeCallback_func(3) end	
	Ana_Ppl_ProdSwitchTributeCallback[4] = function() Ana_Ppl_ProdSwitchTributeCallback_func(4) end	
	Ana_Ppl_ProdSwitchTributeCallback[5] = function() Ana_Ppl_ProdSwitchTributeCallback_func(5) end	
	Ana_Ppl_ProdSwitchTributeCallback[6] = function() Ana_Ppl_ProdSwitchTributeCallback_func(6) end	
	gvAna_Ppl_ManaProdSwitchTributes = {}
	for i = 1, 6 do
		if not (gvAna_Ppl_Player[i] == 4) then
			gvAna_Ppl_ManaProdSwitchTributes[i] = AddTribute( CreateATribute(i, "Manaproduktion aktivieren/deaktivieren", { Gold = 0}, Ana_Ppl_ProdSwitchTributeCallback[i]) )
		end
	end
 
	Ana_Ppl_ProdSwitchTributeCallback_func = function(_playerId)
		gvAna_Ppl_ManaProdActive[_playerId] = not gvAna_Ppl_ManaProdActive[_playerId]
		gvAna_Ppl_ManaProdSwitchTributes[_playerId] = AddTribute( CreateATribute(_playerId, "Manaproduktion aktivieren/deaktivieren", { Gold = 0}, Ana_Ppl_ProdSwitchTributeCallback[_playerId] ) )
 
	end
 
end
 
function Ana_Setup_PeopleSelectionTributes()	
 
	gvAna_Ppl_PeopleSelectionTribute = {}
	for i = 1,6 do
		gvAna_Ppl_PeopleSelectionTribute[i] = {}
	end
 
	gvAna_Ppl_PeopleSelectionTribute[1][1] = function() Ana_Ppl_SelectPeople_Func(1, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[2][1] = function() Ana_Ppl_SelectPeople_Func(2, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[3][1] = function() Ana_Ppl_SelectPeople_Func(3, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[4][1] = function() Ana_Ppl_SelectPeople_Func(4, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[5][1] = function() Ana_Ppl_SelectPeople_Func(5, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[6][1] = function() Ana_Ppl_SelectPeople_Func(6, 1) end	
	gvAna_Ppl_PeopleSelectionTribute[1][2] = function() Ana_Ppl_SelectPeople_Func(1, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[2][2] = function() Ana_Ppl_SelectPeople_Func(2, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[3][2] = function() Ana_Ppl_SelectPeople_Func(3, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[4][2] = function() Ana_Ppl_SelectPeople_Func(4, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[5][2] = function() Ana_Ppl_SelectPeople_Func(5, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[6][2] = function() Ana_Ppl_SelectPeople_Func(6, 2) end	
	gvAna_Ppl_PeopleSelectionTribute[1][3] = function() Ana_Ppl_SelectPeople_Func(1, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[2][3] = function() Ana_Ppl_SelectPeople_Func(2, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[3][3] = function() Ana_Ppl_SelectPeople_Func(3, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[4][3] = function() Ana_Ppl_SelectPeople_Func(4, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[5][3] = function() Ana_Ppl_SelectPeople_Func(5, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[6][3] = function() Ana_Ppl_SelectPeople_Func(6, 3) end	
	gvAna_Ppl_PeopleSelectionTribute[1][4] = function() Ana_Ppl_SelectPeople_Func(1, 4) end	
	gvAna_Ppl_PeopleSelectionTribute[2][4] = function() Ana_Ppl_SelectPeople_Func(2, 4) end	
	gvAna_Ppl_PeopleSelectionTribute[3][4] = function() Ana_Ppl_SelectPeople_Func(3, 4) end	
	gvAna_Ppl_PeopleSelectionTribute[4][4] = function() Ana_Ppl_SelectPeople_Func(4, 4) end	
	gvAna_Ppl_PeopleSelectionTribute[5][4] = function() Ana_Ppl_SelectPeople_Func(5, 4) end	
	gvAna_Ppl_PeopleSelectionTribute[6][4] = function() Ana_Ppl_SelectPeople_Func(6, 4) end		
	gvAna_Ppl_PeopleSelectionTribute[1][99] = function() Ana_Ppl_SelectPeople_Failclick(1) end		
	gvAna_Ppl_PeopleSelectionTribute[2][99] = function() Ana_Ppl_SelectPeople_Failclick(2) end		
	gvAna_Ppl_PeopleSelectionTribute[3][99] = function() Ana_Ppl_SelectPeople_Failclick(3) end		
	gvAna_Ppl_PeopleSelectionTribute[4][99] = function() Ana_Ppl_SelectPeople_Failclick(4) end		
	gvAna_Ppl_PeopleSelectionTribute[5][99] = function() Ana_Ppl_SelectPeople_Failclick(5) end		
	gvAna_Ppl_PeopleSelectionTribute[6][99] = function() Ana_Ppl_SelectPeople_Failclick(6) end
 
	gvAna_Ppl_PeopleSelectionTributes = {}
	for i = 1,6 do
		gvAna_Ppl_PeopleSelectionTributes[i] = {}
	end	
	for i = 1,6 do
		gvAna_Ppl_PeopleSelectionTributes[i][99] = AddTribute( CreateATribute(i, gvCol.rot.." Voelkerauswahl", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[i][99]) )
		gvAna_Ppl_PeopleSelectionTributes[i][1] = AddTribute( CreateATribute(i, "Kelten  "..gvCol.gruen.." Spezial: Druiden und ihre Zauber (Saegemuehlen)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[i][1]) )
		gvAna_Ppl_PeopleSelectionTributes[i][2] = AddTribute( CreateATribute(i, "Roemer  "..gvCol.gruen.." Spezial: Resourcen durch Mana (Lehmhuetten)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[i][2]) )
		gvAna_Ppl_PeopleSelectionTributes[i][3] = AddTribute( CreateATribute(i, "Germanen  "..gvCol.gruen.." Spezial: Einheiten fuer Mana (Schmieden)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[i][3]) )
		gvAna_Ppl_PeopleSelectionTributes[i][4] = AddTribute( CreateATribute(i, "Chinesen  "..gvCol.gruen.." Spezial: Scharfschuetzeneinheit", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[i][4]) )
	end
 
	Ana_Ppl_SelectPeople_Func = function(_playerId, _volk)
		gvAna_Ppl_Player[_playerId] = _volk
		for i = 1,4 do
			Logic.RemoveTribute( _playerId, gvAna_Ppl_PeopleSelectionTributes[_playerId][i])
		end
		Logic.RemoveTribute( _playerId, gvAna_Ppl_PeopleSelectionTributes[_playerId][99])
 
		if gvAna_Ppl_SelectionVisible then
			if _volk == 1 then Message(gvCol.gruen.." Spieler ".._playerId.." "..gvCol.weiss.." hat die "..gvCol.rot.." Kelten gewaehlt")
			elseif _volk == 2 then Message(gvCol.gruen.." Spieler ".._playerId.." "..gvCol.weiss.." hat die "..gvCol.rot.." Roemer gewaehlt")
			elseif _volk == 3 then Message(gvCol.gruen.." Spieler ".._playerId.." "..gvCol.weiss.." hat die "..gvCol.rot.." Germanen gewaehlt")
			elseif _volk == 4 then Message(gvCol.gruen.." Spieler ".._playerId.." "..gvCol.weiss.." hat die "..gvCol.rot.." Chinesen gewaehlt")		
			end			
		end	
		for i = 1,6 do
			if gvAna_Ppl_Player[i] == 0 then
				local _temp = { Logic.GetPlayerEntities(i, Entities.PB_Headquarters1,1,0) }
				if _temp[2] == nil then
					_temp = { Logic.GetPlayerEntities(i, Entities.PB_Headquarters2,1,0) }
				end
				if _temp[2] == nil then
					_temp = { Logic.GetPlayerEntities(i, Entities.PB_Headquarters3,1,0) }	
				end	
				if _temp[2] == nil then
					gvAna_Ppl_Player[i] = 99
				end
			end
		end
		if gvAna_Ppl_Player[1] > 0 then -- and gvAna_Ppl_Player[2] > 0 and gvAna_Ppl_Player[3] > 0 and gvAna_Ppl_Player[4] > 0 and gvAna_Ppl_Player[5] > 0 and gvAna_Ppl_Player[6] > 0 then
			gvAna_Ppl_PlayerAllSelected = true
		end	
	end
 
	Ana_Ppl_SelectPeople_Failclick = function(_playerId)
		Logic.RemoveTribute( _playerId, gvAna_Ppl_PeopleSelectionTributes[_playerId][99])
 
		for i = 1,4 do
			Logic.RemoveTribute( _playerId, gvAna_Ppl_PeopleSelectionTributes[_playerId][i])
		end
		gvAna_Ppl_PeopleSelectionTributes[_playerId][99] = AddTribute( CreateATribute(_playerId, gvCol.rot.." Voelkerauswahl ", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[_playerId][99]) )
		gvAna_Ppl_PeopleSelectionTributes[_playerId][1] = AddTribute( CreateATribute(_playerId, "Kelten  "..gvCol.gruen.." Spezial: Druiden und ihre Zauber (Saegemuehlen)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[_playerId][1]) )
		gvAna_Ppl_PeopleSelectionTributes[_playerId][2] = AddTribute( CreateATribute(_playerId, "Roemer  "..gvCol.gruen.." Spezial: Resourcen durch Mana (Lehmhuetten)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[_playerId][2]) )
		gvAna_Ppl_PeopleSelectionTributes[_playerId][3] = AddTribute( CreateATribute(_playerId, "Germanen  "..gvCol.gruen.." Spezial: Einheiten fuer Mana (Schmieden)", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[_playerId][3]) )
		gvAna_Ppl_PeopleSelectionTributes[_playerId][4] = AddTribute( CreateATribute(_playerId, "Chinesen  "..gvCol.gruen.." Spezial: Scharfschuetzeneinheit", { Gold = 0}, gvAna_Ppl_PeopleSelectionTribute[_playerId][4]) )
 
	end
 
end
 
function Ana_WaitForSelection()
	if gvAna_Ppl_PlayerAllSelected then
		Message("Alle Spieler haben Ihr Volk gewaehlt!")
		Ana_Setup_ManaProdSwitchTributes()
		for i = 1, 6 do
			if gvAna_Ppl_Player[i] == 1 then
				gvAna_Ppl_PlayerProdPeopleType[i] = Entities.PU_Sawmillworker
			elseif gvAna_Ppl_Player[i] == 2 then
				gvAna_Ppl_PlayerProdPeopleType[i] = Entities.PU_BrickMaker
			elseif gvAna_Ppl_Player[i] == 3 then
				gvAna_Ppl_PlayerProdPeopleType[i] = Entities.PU_Smith
			end
		end
		for i = 1,6 do
			if not (gvAna_Ppl_PlayerProdPeopleType[i] == 0 ) then
				Ana_Comfort_TrackEntityIni(i,gvAna_Ppl_PlayerProdPeopleType[i])
			end
		end
		EndJob(gvAna_Ppl_WaitForSelectionJob)
	end
end
 
-- Kelten
 
function Ana_Ppl_SetupCeltic()
 
	Ana_Ppl_CreateDruid_Celtic = function(_playerId)
 
		local _temp = {}
		local _pos = {}
		if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[1][9] and ( Logic.GetPlayersGlobalResource( _playerId, ResourceType.GoldRaw ) + Logic.GetPlayersGlobalResource( _playerId, ResourceType.Gold ) ) >= gvAna_Ppl_ManaCosts[1][8] then
 
			_temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters1,1,0) }
			if _temp[2] == nil then
				_temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters2,1,0) }
			end
			if _temp[2] == nil then
				_temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters3,1,0) }	
			end		
			_pos = GetPosition(_temp[2])
			_pos.X = _pos.X - 700
			_pos.Y = _pos.Y + 100
			for i = 1,6 do
				if i == 6 then
					if GUI.GetPlayerID() == _playerId then
						Message("Ihr koennt nur 5 Druiden aufeinmal haben")
					end
					break
				end			
				if gvAna_Ppl_Druids[_playerId][i] == 0 then
					gvAna_Ppl_Druids[_playerId][i] = CreateEntity(_playerId, Entities.PU_Hero6, _pos)					
					gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][9]
					Tools.GiveResouces(_playerId, gvAna_Ppl_ManaCosts[1][8] * -1, nil, nil, nil, nil, nil)
					break
				end
			end	
 
		else
			if GUI.GetPlayerID() == _playerId then
				Message("Nicht genug Mana und/oder Gold")
			end
		end	
	end
 
	Ana_Ppl_DruidsCDJob = function()
		for i = 1,6 do
			for u = 1,5 do
				for v = 1,3 do
					if gvAna_Ppl_DruidsCD[i][u][v] >= 0 then
						gvAna_Ppl_DruidsCD[i][u][v] = gvAna_Ppl_DruidsCD[i][u][v] - 1
					end
				end
			end
		end	
	end
 
	Ana_Ppl_ControlDruids = function()
		local _guiplayer = GUI.GetPlayerID()
		if gvAna_Ppl_Player[_guiplayer] == 1 then
			for i = 1,table.getn( gvAna_Ppl_Druids[_guiplayer] ) do
				if IsExisting(gvAna_Ppl_Druids[_guiplayer][i]) and IsDead( gvAna_Ppl_Druids[_guiplayer][i] ) then
					GUI.PayTribute( 8, gvAna_Ppl_DestroyDruidsTributes[_guiplayer][i])
				else
					if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then					
						if gvAna_Ppl_Mana[_guiplayer] >= gvAna_Ppl_ManaCosts[1][1] and gvAna_Ppl_DruidsCD[_guiplayer][i][1] <= 0 then gvAna_Ppl_DruidsSpellsPossible[1] = true;
						else gvAna_Ppl_DruidsSpellsPossible[1] = false; 
						end
						if gvAna_Ppl_Mana[_guiplayer] >= gvAna_Ppl_ManaCosts[1][2] and gvAna_Ppl_DruidsCD[_guiplayer][i][2] <= 0 then gvAna_Ppl_DruidsSpellsPossible[2] = true;
						else gvAna_Ppl_DruidsSpellsPossible[2] = false; 
						end
						if gvAna_Ppl_Mana[_guiplayer] >= gvAna_Ppl_ManaCosts[1][3] and gvAna_Ppl_DruidsCD[_guiplayer][i][3] <= 0 then XGUIEng.DisableButton(gvGUI_WidgetID.CommandGuard, 0);
						else XGUIEng.DisableButton(gvGUI_WidgetID.CommandGuard, 1); 
						end
 
					end
 
				end
			end
		end	
	end
 
	Ana_Ppl_DruidsTributes = function()
		-- Destroy Druid - Player/Druid
		gvAna_Ppl_DestroyDruidsTribute = {}
		gvAna_Ppl_DestroyDruidsTributes = {}
		for i = 1,6 do
			gvAna_Ppl_DestroyDruidsTribute[i] = {}
			gvAna_Ppl_DestroyDruidsTributes[i] = {}
		end
 
		gvAna_Ppl_DestroyDruidsTribute[1][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(1, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[1][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(1, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[1][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(1, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[1][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(1, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[1][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(1, 5) end		
		gvAna_Ppl_DestroyDruidsTribute[2][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(2, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[2][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(2, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[2][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(2, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[2][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(2, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[2][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(2, 5) end		
		gvAna_Ppl_DestroyDruidsTribute[3][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(3, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[3][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(3, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[3][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(3, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[3][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(3, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[3][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(3, 5) end		
		gvAna_Ppl_DestroyDruidsTribute[4][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(4, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[4][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(4, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[4][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(4, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[4][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(4, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[4][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(4, 5) end		
		gvAna_Ppl_DestroyDruidsTribute[5][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(5, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[5][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(5, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[5][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(5, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[5][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(5, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[5][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(5, 5) end		
		gvAna_Ppl_DestroyDruidsTribute[6][1] = function() Ana_Ppl_DestroyDruidsTribute_Func(6, 1) end	
		gvAna_Ppl_DestroyDruidsTribute[6][2] = function() Ana_Ppl_DestroyDruidsTribute_Func(6, 2) end		
		gvAna_Ppl_DestroyDruidsTribute[6][3] = function() Ana_Ppl_DestroyDruidsTribute_Func(6, 3) end		
		gvAna_Ppl_DestroyDruidsTribute[6][4] = function() Ana_Ppl_DestroyDruidsTribute_Func(6, 4) end		
		gvAna_Ppl_DestroyDruidsTribute[6][5] = function() Ana_Ppl_DestroyDruidsTribute_Func(6, 5) end			
 
 
 
 
		for i = 1,5 do
			gvAna_Ppl_DestroyDruidsTributes[1][i] = AddTribute( CreateATribute(8, "ddddr", { Gold = 0}, gvAna_Ppl_DestroyDruidsTribute[1][i] ) )			
		end	
		StartSimpleJob("Ana_Ppl_ControlDruids")
 
		gvAna_Ppl_DruidSpellTributes = {}
		for i = 1,6 do
			gvAna_Ppl_DruidSpellTributes[i] = {}
			for u = 1,5 do
				gvAna_Ppl_DruidSpellTributes[i][u] = {}
			end
		end
 
		gvAna_Ppl_DruidSpellTribute = {}
		for i = 1,6 do
			gvAna_Ppl_DruidSpellTribute[i] = {}
			for u = 1,5 do
				gvAna_Ppl_DruidSpellTribute[i][u] = {}
			end
		end	
 
 
		gvAna_Ppl_DruidSpellTribute[1][1][1] = function() Ana_Ppl_DruidSpell_1(1, 1); end
		gvAna_Ppl_DruidSpellTribute[2][1][1] = function() Ana_Ppl_DruidSpell_1(2, 1) end
		gvAna_Ppl_DruidSpellTribute[3][1][1] = function() Ana_Ppl_DruidSpell_1(3, 1) end
		gvAna_Ppl_DruidSpellTribute[4][1][1] = function() Ana_Ppl_DruidSpell_1(4, 1) end
		gvAna_Ppl_DruidSpellTribute[5][1][1] = function() Ana_Ppl_DruidSpell_1(5, 1) end
		gvAna_Ppl_DruidSpellTribute[6][1][1] = function() Ana_Ppl_DruidSpell_1(6, 1) end
		gvAna_Ppl_DruidSpellTribute[1][2][1] = function() Ana_Ppl_DruidSpell_1(1, 2) end
		gvAna_Ppl_DruidSpellTribute[2][2][1] = function() Ana_Ppl_DruidSpell_1(2, 2) end
		gvAna_Ppl_DruidSpellTribute[3][2][1] = function() Ana_Ppl_DruidSpell_1(3, 2) end
		gvAna_Ppl_DruidSpellTribute[4][2][1] = function() Ana_Ppl_DruidSpell_1(4, 2) end
		gvAna_Ppl_DruidSpellTribute[5][2][1] = function() Ana_Ppl_DruidSpell_1(5, 2) end
		gvAna_Ppl_DruidSpellTribute[6][2][1] = function() Ana_Ppl_DruidSpell_1(6, 2) end
		gvAna_Ppl_DruidSpellTribute[1][3][1] = function() Ana_Ppl_DruidSpell_1(1, 3) end
		gvAna_Ppl_DruidSpellTribute[2][3][1] = function() Ana_Ppl_DruidSpell_1(2, 3) end
		gvAna_Ppl_DruidSpellTribute[3][3][1] = function() Ana_Ppl_DruidSpell_1(3, 3) end
		gvAna_Ppl_DruidSpellTribute[4][3][1] = function() Ana_Ppl_DruidSpell_1(4, 3) end
		gvAna_Ppl_DruidSpellTribute[5][3][1] = function() Ana_Ppl_DruidSpell_1(5, 3) end
		gvAna_Ppl_DruidSpellTribute[6][3][1] = function() Ana_Ppl_DruidSpell_1(6, 3) end
		gvAna_Ppl_DruidSpellTribute[1][4][1] = function() Ana_Ppl_DruidSpell_1(1, 4) end
		gvAna_Ppl_DruidSpellTribute[2][4][1] = function() Ana_Ppl_DruidSpell_1(2, 4) end
		gvAna_Ppl_DruidSpellTribute[3][4][1] = function() Ana_Ppl_DruidSpell_1(3, 4) end
		gvAna_Ppl_DruidSpellTribute[4][4][1] = function() Ana_Ppl_DruidSpell_1(4, 4) end
		gvAna_Ppl_DruidSpellTribute[5][4][1] = function() Ana_Ppl_DruidSpell_1(5, 4) end
		gvAna_Ppl_DruidSpellTribute[6][4][1] = function() Ana_Ppl_DruidSpell_1(6, 4) end
		gvAna_Ppl_DruidSpellTribute[1][5][1] = function() Ana_Ppl_DruidSpell_1(1, 5) end
		gvAna_Ppl_DruidSpellTribute[2][5][1] = function() Ana_Ppl_DruidSpell_1(2, 5) end
		gvAna_Ppl_DruidSpellTribute[3][5][1] = function() Ana_Ppl_DruidSpell_1(3, 5) end
		gvAna_Ppl_DruidSpellTribute[4][5][1] = function() Ana_Ppl_DruidSpell_1(4, 5) end
		gvAna_Ppl_DruidSpellTribute[5][5][1] = function() Ana_Ppl_DruidSpell_1(5, 5) end
		gvAna_Ppl_DruidSpellTribute[6][5][1] = function() Ana_Ppl_DruidSpell_1(6, 5) end
 
		gvAna_Ppl_DruidSpellTribute[1][1][2] = function() Ana_Ppl_DruidSpell_2(1, 1) end
		gvAna_Ppl_DruidSpellTribute[2][1][2] = function() Ana_Ppl_DruidSpell_2(2, 1) end
		gvAna_Ppl_DruidSpellTribute[3][1][2] = function() Ana_Ppl_DruidSpell_2(3, 1) end
		gvAna_Ppl_DruidSpellTribute[4][1][2] = function() Ana_Ppl_DruidSpell_2(4, 1) end
		gvAna_Ppl_DruidSpellTribute[5][1][2] = function() Ana_Ppl_DruidSpell_2(5, 1) end
		gvAna_Ppl_DruidSpellTribute[6][1][2] = function() Ana_Ppl_DruidSpell_2(6, 1) end
		gvAna_Ppl_DruidSpellTribute[1][2][2] = function() Ana_Ppl_DruidSpell_2(1, 2) end
		gvAna_Ppl_DruidSpellTribute[2][2][2] = function() Ana_Ppl_DruidSpell_2(2, 2) end
		gvAna_Ppl_DruidSpellTribute[3][2][2] = function() Ana_Ppl_DruidSpell_2(3, 2) end
		gvAna_Ppl_DruidSpellTribute[4][2][2] = function() Ana_Ppl_DruidSpell_2(4, 2) end
		gvAna_Ppl_DruidSpellTribute[5][2][2] = function() Ana_Ppl_DruidSpell_2(5, 2) end
		gvAna_Ppl_DruidSpellTribute[6][2][2] = function() Ana_Ppl_DruidSpell_2(6, 2) end
		gvAna_Ppl_DruidSpellTribute[1][3][2] = function() Ana_Ppl_DruidSpell_2(1, 3) end
		gvAna_Ppl_DruidSpellTribute[2][3][2] = function() Ana_Ppl_DruidSpell_2(2, 3) end
		gvAna_Ppl_DruidSpellTribute[3][3][2] = function() Ana_Ppl_DruidSpell_2(3, 3) end
		gvAna_Ppl_DruidSpellTribute[4][3][2] = function() Ana_Ppl_DruidSpell_2(4, 3) end
		gvAna_Ppl_DruidSpellTribute[5][3][2] = function() Ana_Ppl_DruidSpell_2(5, 3) end
		gvAna_Ppl_DruidSpellTribute[6][3][2] = function() Ana_Ppl_DruidSpell_2(6, 3) end
		gvAna_Ppl_DruidSpellTribute[1][4][2] = function() Ana_Ppl_DruidSpell_2(1, 4) end
		gvAna_Ppl_DruidSpellTribute[2][4][2] = function() Ana_Ppl_DruidSpell_2(2, 4) end
		gvAna_Ppl_DruidSpellTribute[3][4][2] = function() Ana_Ppl_DruidSpell_2(3, 4) end
		gvAna_Ppl_DruidSpellTribute[4][4][2] = function() Ana_Ppl_DruidSpell_2(4, 4) end
		gvAna_Ppl_DruidSpellTribute[5][4][2] = function() Ana_Ppl_DruidSpell_2(5, 4) end
		gvAna_Ppl_DruidSpellTribute[6][4][2] = function() Ana_Ppl_DruidSpell_2(6, 4) end
		gvAna_Ppl_DruidSpellTribute[1][5][2] = function() Ana_Ppl_DruidSpell_2(1, 5) end
		gvAna_Ppl_DruidSpellTribute[2][5][2] = function() Ana_Ppl_DruidSpell_2(2, 5) end
		gvAna_Ppl_DruidSpellTribute[3][5][2] = function() Ana_Ppl_DruidSpell_2(3, 5) end
		gvAna_Ppl_DruidSpellTribute[4][5][2] = function() Ana_Ppl_DruidSpell_2(4, 5) end
		gvAna_Ppl_DruidSpellTribute[5][5][2] = function() Ana_Ppl_DruidSpell_2(5, 5) end
		gvAna_Ppl_DruidSpellTribute[6][5][2] = function() Ana_Ppl_DruidSpell_2(6, 5) end
 
		gvAna_Ppl_DruidSpellTribute[1][1][3] = function() Ana_Ppl_DruidSpell_3(1, 1) end
		gvAna_Ppl_DruidSpellTribute[2][1][3] = function() Ana_Ppl_DruidSpell_3(2, 1) end
		gvAna_Ppl_DruidSpellTribute[3][1][3] = function() Ana_Ppl_DruidSpell_3(3, 1) end
		gvAna_Ppl_DruidSpellTribute[4][1][3] = function() Ana_Ppl_DruidSpell_3(4, 1) end
		gvAna_Ppl_DruidSpellTribute[5][1][3] = function() Ana_Ppl_DruidSpell_3(5, 1) end
		gvAna_Ppl_DruidSpellTribute[6][1][3] = function() Ana_Ppl_DruidSpell_3(6, 1) end
		gvAna_Ppl_DruidSpellTribute[1][2][3] = function() Ana_Ppl_DruidSpell_3(1, 2) end
		gvAna_Ppl_DruidSpellTribute[2][2][3] = function() Ana_Ppl_DruidSpell_3(2, 2) end
		gvAna_Ppl_DruidSpellTribute[3][2][3] = function() Ana_Ppl_DruidSpell_3(3, 2) end
		gvAna_Ppl_DruidSpellTribute[4][2][3] = function() Ana_Ppl_DruidSpell_3(4, 2) end
		gvAna_Ppl_DruidSpellTribute[5][2][3] = function() Ana_Ppl_DruidSpell_3(5, 2) end
		gvAna_Ppl_DruidSpellTribute[6][2][3] = function() Ana_Ppl_DruidSpell_3(6, 2) end
		gvAna_Ppl_DruidSpellTribute[1][3][3] = function() Ana_Ppl_DruidSpell_3(1, 3) end
		gvAna_Ppl_DruidSpellTribute[2][3][3] = function() Ana_Ppl_DruidSpell_3(2, 3) end
		gvAna_Ppl_DruidSpellTribute[3][3][3] = function() Ana_Ppl_DruidSpell_3(3, 3) end
		gvAna_Ppl_DruidSpellTribute[4][3][3] = function() Ana_Ppl_DruidSpell_3(4, 3) end
		gvAna_Ppl_DruidSpellTribute[5][3][3] = function() Ana_Ppl_DruidSpell_3(5, 3) end
		gvAna_Ppl_DruidSpellTribute[6][3][3] = function() Ana_Ppl_DruidSpell_3(6, 3) end
		gvAna_Ppl_DruidSpellTribute[1][4][3] = function() Ana_Ppl_DruidSpell_3(1, 4) end
		gvAna_Ppl_DruidSpellTribute[2][4][3] = function() Ana_Ppl_DruidSpell_3(2, 4) end
		gvAna_Ppl_DruidSpellTribute[3][4][3] = function() Ana_Ppl_DruidSpell_3(3, 4) end
		gvAna_Ppl_DruidSpellTribute[4][4][3] = function() Ana_Ppl_DruidSpell_3(4, 4) end
		gvAna_Ppl_DruidSpellTribute[5][4][3] = function() Ana_Ppl_DruidSpell_3(5, 4) end
		gvAna_Ppl_DruidSpellTribute[6][4][3] = function() Ana_Ppl_DruidSpell_3(6, 4) end
		gvAna_Ppl_DruidSpellTribute[1][5][3] = function() Ana_Ppl_DruidSpell_3(1, 5) end
		gvAna_Ppl_DruidSpellTribute[2][5][3] = function() Ana_Ppl_DruidSpell_3(2, 5) end
		gvAna_Ppl_DruidSpellTribute[3][5][3] = function() Ana_Ppl_DruidSpell_3(3, 5) end
		gvAna_Ppl_DruidSpellTribute[4][5][3] = function() Ana_Ppl_DruidSpell_3(4, 5) end
		gvAna_Ppl_DruidSpellTribute[5][5][3] = function() Ana_Ppl_DruidSpell_3(5, 5) end
		gvAna_Ppl_DruidSpellTribute[6][5][3] = function() Ana_Ppl_DruidSpell_3(6, 5) end
 
		for i = 1,6 do
			for u = 1,5 do
				for v = 1,3 do
					gvAna_Ppl_DruidSpellTributes[i][u][v] = AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_DruidSpellTribute[i][u][v] ) )		
 
				end
			end
		end
 
	end
 
	Ana_Ppl_DruidSpell_1 = function(_playerId, _druidId)
		-- Funktion made by Noigi => Priester&Schamanenskript, nur angepasst!
 
		if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[1][1] then
			gvAna_Ppl_DruidsCD[_playerId][_druidId][1] = gvAna_Ppl_DruidsCDSpell1
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][1]
			local pos = GetPosition( gvAna_Ppl_Druids[_playerId][_druidId] )
			local claypits = {Logic.GetEntitiesInArea( Entities.XD_ClayPit1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 2 )};
			for i = 2,claypits[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( claypits[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Pit);
				Logic.SetResourceDoodadGoodAmount( claypits[i], resources + gvAna_Ppl_CelticMinResources_Pit + randombonus );
				local targetpos = GetPosition( claypits[i] );
				for i = 1,2 do
					Logic.CreateEffect( GGL_Effects.FXCrushBuilding, targetpos.X, targetpos.Y, 0 );
					Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
				end
			end
			local stonepits = {Logic.GetEntitiesInArea( Entities.XD_StonePit1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 2 )};
			for i = 2,stonepits[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( stonepits[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Pit);
				Logic.SetResourceDoodadGoodAmount( stonepits[i], resources + gvAna_Ppl_CelticMinResources_Pit + randombonus );
				local targetpos = GetPosition( stonepits[i] );
				for i = 1,2 do
					Logic.CreateEffect( GGL_Effects.FXCrushBuilding, targetpos.X, targetpos.Y, 0 );
					Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
				end
			end
			local ironpits = {Logic.GetEntitiesInArea( Entities.XD_IronPit1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 2 )};
			for i = 2,ironpits[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( ironpits[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Pit);
				Logic.SetResourceDoodadGoodAmount( ironpits[i], resources + gvAna_Ppl_CelticMinResources_Pit + randombonus );
				local targetpos = GetPosition( ironpits[i] );
				for i = 1,2 do
					Logic.CreateEffect( GGL_Effects.FXCrushBuilding, targetpos.X, targetpos.Y, 0 );
					Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
				end
			end
			local sulfurpits = {Logic.GetEntitiesInArea( Entities.XD_SulfurPit1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 2 )};
			for i = 2,sulfurpits[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( sulfurpits[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Pit);
				Logic.SetResourceDoodadGoodAmount( sulfurpits[i], resources + gvAna_Ppl_CelticMinResources_Pit + randombonus );
				local targetpos = GetPosition( sulfurpits[i] );
				for i = 1,2 do
					Logic.CreateEffect( GGL_Effects.FXCrushBuilding, targetpos.X, targetpos.Y, 0 );
					Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
				end
			end
			local clayheaps = {Logic.GetEntitiesInArea( Entities.XD_Clay1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 5 )};
			for i = 2,clayheaps[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( clayheaps[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Heaps);
				Logic.SetResourceDoodadGoodAmount( clayheaps[i], resources + gvAna_Ppl_CelticMinResources_Heaps + randombonus );
				local targetpos = GetPosition( clayheaps[i] );
				Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
			end
			local stoneheaps = {Logic.GetEntitiesInArea( Entities.XD_Stone1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 5 )};
			for i = 2,stoneheaps[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( stoneheaps[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Heaps);
				Logic.SetResourceDoodadGoodAmount( stoneheaps[i], resources + gvAna_Ppl_CelticMinResources_Heaps + randombonus );
				local targetpos = GetPosition( stoneheaps[i] );
				Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
			end
			local ironheaps = {Logic.GetEntitiesInArea( Entities.XD_Iron1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 5 )};
			for i = 2,ironheaps[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( ironheaps[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Heaps);
				Logic.SetResourceDoodadGoodAmount( ironheaps[i], resources + gvAna_Ppl_CelticMinResources_Heaps + randombonus );
				local targetpos = GetPosition( ironheaps[i] );
				Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
			end
			local sulfurheaps = {Logic.GetEntitiesInArea( Entities.XD_Sulfur1, pos.X, pos.Y, gvAna_Ppl_RangeSpell1, 5 )};
			for i = 2,sulfurheaps[1]+1 do
				local resources = Logic.GetResourceDoodadGoodAmount( sulfurheaps[i] );
				local randombonus = math.random(1,gvAna_Ppl_CelticRangeResources_Heaps);
				Logic.SetResourceDoodadGoodAmount( sulfurheaps[i], resources + gvAna_Ppl_CelticMinResources_Heaps + randombonus );
				local targetpos = GetPosition( sulfurheaps[i] );
				Logic.CreateEffect( GGL_Effects.FXExplosionShrapnel, targetpos.X, targetpos.Y, 0 );
			end
			Logic.CreateEffect( GGL_Effects.FXDarioFear, pos.X, pos.Y, 0 );
			if GUI.GetPlayerID() == _playerId then
				Sound.PlayGUISound( Sounds.OnKlick_PB_SulfurMine3, 80 );
				Sound.PlayGUISound( Sounds.OnKlick_PB_StoneMine3, 80 );
				Sound.PlayGUISound( Sounds.OnKlick_PB_ClayMine3, 80 );
			end
			Ana_Ppl_SpellEffect(pos, gvAna_Ppl_RangeSpell1, _playerId, GGL_Effects.FXDieHero)
 
		else
			if GUI.GetPlayerID == gvAna_Ppl_Mana[_playerId] then
				Message("Nicht genug Mana!")
			end
		end
		gvAna_Ppl_DruidSpellTributes[_playerId][_druidId][1] =  AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_DruidSpellTribute[_playerId][_druidId][1] ) )
 
	end
 
	Ana_Ppl_DruidSpell_2 = function(_playerId, _druidId)
		if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[1][2] then
			local _pos = GetPosition( gvAna_Ppl_Druids[_playerId][_druidId] )
			local Zufallssoldat = GetRandom( 2 )
			local Unit = ""
			local soldiers = 16
			if Zufallssoldat == 0 then Zufallssoldat = Entities.CU_Evil_LeaderSkirmisher1
				Unit = "Speerwerfer"
			elseif Zufallssoldat == 1 then Zufallssoldat = Entities.CU_Evil_LeaderBearman1
				Unit = "Baerenmenschen"
			end
			local freiepl = math.floor(Logic.GetPlayerAttractionLimit(_playerId))-math.floor(Logic.GetPlayerAttractionUsage(_playerId))
			if freiepl < 17 then
				if freiepl < 8 then
					if GUI.GetPlayerID() == _playerId then			
						Message("Nicht genug freie Siedlungsplaetze fuer die Beschwoerung")
					end			
				else
					soldiers = freiepl
					if GUI.GetPlayerID() == _playerId then
						if GUI.GetPlayerID() == _playerId then
							Message("An Mangel freier Plaetze weniger beschworen")
						end					
						CreateArmyTroops( _playerId, _pos, Zufallssoldat, soldiers, 1, 0, _pos )						
						gvAna_Ppl_DruidsCD[_playerId][_druidId][2] = gvAna_Ppl_DruidsCDSpell2
						gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][2]						
						if GUI.GetPlayerID() == _playerId then
							Message(Unit.." beschworen. "..gvAna_Ppl_ManaCosts[1][2].." Mana abgezogen.")
						end					
					end
				end
 
			else				
				if GUI.GetPlayerID() == _playerId then
					Sound.PlayGUISound( Sounds.Military_SO_Skirmisher_rnd_2, 80 );
				end
				CreateArmyTroops( _playerId, _pos, Zufallssoldat, soldiers, 1, 0, _pos )
				gvAna_Ppl_DruidsCD[_playerId][_druidId][2] = gvAna_Ppl_DruidsCDSpell2
				gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][2]	
				if GUI.GetPlayerID() == _playerId then
					Message(Unit.." beschworen. "..gvAna_Ppl_ManaCosts[1][2].." Mana abgezogen.")
				end
			end		
 
		else
			if GUI.GetPlayerID == gvAna_Ppl_Mana[_playerId] then
				Message("Nicht genug Mana!")
			end
		end
		gvAna_Ppl_DruidSpellTributes[_playerId][_druidId][2] =  AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_DruidSpellTribute[_playerId][_druidId][2] ) )
 
	end
 
	Ana_Ppl_DruidSpell_3 = function(_playerId, _druidId)
		if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[1][3] then
			local _pos = GetPosition( gvAna_Ppl_Druids[_playerId][_druidId] )
			--gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][1]
			local Zufallssoldat = GetRandom(3) + 1
			local check = 0
			local enemysoldiers
			Ana_Ppl_SpellEffect(_pos, gvAna_Ppl_RangeSpell3, _playerId, GGL_Effects.FXDarioFear)
			for i = 1,4 do
				if Zufallssoldat == 1 then
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderPoleArm4, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end
 
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderPoleArm3, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end			
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderPoleArm2, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end			
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderPoleArm1, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end			
				elseif Zufallssoldat == 2 then
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderSword4, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderSword3, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end				
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderSword2, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end				
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderSword1, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end					
				elseif Zufallssoldat == 3 then
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderBow4, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderBow3, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end				
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderBow2, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end				
					enemysoldiers = {Logic.GetEntitiesInArea( Entities.PU_LeaderBow1, _pos.X, _pos.Y, gvAna_Ppl_RangeSpell3, 20 )};
					check = Ana_Ppl_DruidSpell3_Convert(_playerId, enemysoldiers); if check > 0 then break end					
				else Zufallssoldat = 0
				end
				Zufallssoldat = Zufallssoldat + 1
			end
			if check == 1 then
				if GUI.GetPlayerID() == _playerId then	
					Sound.PlayGUISound( Sounds.OnKlick_PB_Tower1, 80 );
				end
				gvAna_Ppl_DruidsCD[_playerId][_druidId][3] = gvAna_Ppl_DruidsCDSpell3
				gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][3]
			elseif check == 2 then
				if GUI.GetPlayerID() == _playerId then
					Message("Nicht genug freie Siedlungsplaetze fuer die konvertierung!")
				end
			else
				if GUI.GetPlayerID() == _playerId then
					Sound.PlayGUISound( Sounds.OnKlick_PB_Tower1, 80 );
				end
				gvAna_Ppl_DruidsCD[_playerId][_druidId][3] = gvAna_Ppl_DruidsCDSpell3
				gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[1][3]
				if GUI.GetPlayerID() == _playerId then
					Message("Keine konvertierbaren Einheiten in der Naehe! Mana verschwendet!")
				end
			end
		else
			if GUI.GetPlayerID == gvAna_Ppl_Mana[_playerId] then
				Message("Nicht genug Mana!")
			end
		end
		gvAna_Ppl_DruidSpellTributes[_playerId][_druidId][3] =  AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_DruidSpellTribute[_playerId][_druidId][3] ) )
 
	end
 
	Ana_Ppl_DruidSpell3_Convert = function(_playerId, _soldiers)
		for i = 2,_soldiers[1]+1 do
			if not ( XNetwork.GameInformation_GetLogicPlayerTeam( _playerId ) == XNetwork.GameInformation_GetLogicPlayerTeam(GetPlayer( _soldiers[i]) ) ) then
				local _soldier = {Logic.GetSoldiersAttachedToLeader(_soldiers[i])}
				local _count = 0
				for u = 1,table.getn(_soldier) do
					_count = _count + 1
				end 			
				local _freeplace = math.floor(Logic.GetPlayerAttractionLimit(_playerId))-math.floor(Logic.GetPlayerAttractionUsage(_playerId))
				if _freeplace >= _count then
					local _pos = GetPosition( _soldiers[i] )
					Logic.CreateEffect( GGL_Effects.FXDieHero, _pos.X, _pos.Y, GetPlayer( _soldiers[i]));				
					ChangePlayer(_soldiers[i],_playerId)
					return 1
				else
					return 2
				end
 
			end
		end
		return 0	
	end
 
	Ana_Ppl_DestroyDruidsTribute_Func = function(_playerId, _druidId)
		DestroyEntity( gvAna_Ppl_Druids[_playerId][_druidId] ); 
		gvAna_Ppl_Druids[_playerId][_druidId] = 0;
		gvAna_Ppl_DestroyDruidsTributes[_playerId][_druidId] = AddTribute( CreateATribute(8, "ddddr", { Gold = 0}, gvAna_Ppl_DestroyDruidsTribute[_playerId][_druidId] ) )		
	end
 
	Ana_Ppl_DruidsTributes()
 
end
 
 
-- Roemer
 
function Ana_Ppl_Setup_Roman()
 
	gvAna_Ppl_RomanWarTribute = {}
	gvAna_Ppl_RomanWarTribute[1] = function() Ana_Ppl_GetWarResources_Roman(1) end	
	gvAna_Ppl_RomanWarTribute[2] = function() Ana_Ppl_GetWarResources_Roman(2) end		
	gvAna_Ppl_RomanWarTribute[3] = function() Ana_Ppl_GetWarResources_Roman(3) end		
	gvAna_Ppl_RomanWarTribute[4] = function() Ana_Ppl_GetWarResources_Roman(4) end		
	gvAna_Ppl_RomanWarTribute[5] = function() Ana_Ppl_GetWarResources_Roman(5) end
	gvAna_Ppl_RomanWarTribute[6] = function() Ana_Ppl_GetWarResources_Roman(6) end	
 
	gvAna_Ppl_RomanWarTributes = {}
	for i=1,6 do
		gvAna_Ppl_RomanWarTributes[i] = AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_RomanWarTribute[i] ) )
	end
 
 
end
 
function Ana_Ppl_GetResources_Roman(_playerId)
 
	if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[2][1]  then
		local Zufallsres = GetRandom( 3 )
		local Zufallsmenge = GetRandom( gvAna_Ppl_RomanRangeResources )
		Zufallsmenge = gvAna_Ppl_RomanMinResources + Zufallsmenge
		if Zufallsres == 0 then
			Tools.GiveResouces(_playerId, nil, Zufallsmenge, nil, nil, nil, nil)
			if GUI.GetPlayerID() == _playerId then 
				Sound.PlayGUISound( Sounds.OnKlick_PB_ClayMine3, 80 );
				Message(Zufallsmenge.." Lehm erhalten!") 
			end
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[2][1]			
		elseif Zufallsres == 1 then
			Tools.GiveResouces(_playerId, nil, nil, Zufallsmenge, nil, nil, nil)
			if GUI.GetPlayerID() == _playerId then
				Sound.PlayGUISound( Sounds.OnKlick_PB_Sawmill1, 80 );
				Message(Zufallsmenge.." Holz erhalten!") 
			end
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[2][1]		
		elseif Zufallsres == 2 then
			Tools.GiveResouces(_playerId, nil, nil, nil, Zufallsmenge, nil, nil)
			if GUI.GetPlayerID() == _playerId then 
				Sound.PlayGUISound( Sounds.OnKlick_PB_StoneMine3, 80 );
				Message(Zufallsmenge.." Stein erhalten!") 
			end
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[2][1]
		end		
	else
		if GUI.GetPlayerID() == _playerId then
			Message("Nicht genug Mana")
		end
	end
	gvAna_Ppl_RomanWarTributes[_playerId] = AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_RomanWarTribute[_playerId] ) )
 
end
 
function Ana_Ppl_GetWarResources_Roman(_playerId)
	if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[2][2]  then
		local Zufallsres = GetRandom( 2 )
		local Zufallsmenge = GetRandom( gvAna_Ppl_RomanWarRangeResources )
		Zufallsmenge = gvAna_Ppl_RomanMinWarResources + Zufallsmenge
		if Zufallsres == 0 then
			Tools.GiveResouces(_playerId, nil, nil, nil, nil, Zufallsmenge, nil)
			if GUI.GetPlayerID() == _playerId then 
				Sound.PlayGUISound( Sounds.OnKlick_PB_IronMine3, 80 );
				Message(Zufallsmenge.." Eisen erhalten!") 
			end
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[2][2]			
		elseif Zufallsres == 1 then
			Tools.GiveResouces(_playerId, nil, nil, nil, nil, nil, Zufallsmenge)
			if GUI.GetPlayerID() == _playerId then
				Sound.PlayGUISound( Sounds.OnKlick_PB_SulfurMine3, 80 );
				Message(Zufallsmenge.." Schwefel erhalten!") 
			end
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - gvAna_Ppl_ManaCosts[2][2]		
		end
	else
		if GUI.GetPlayerID() == _playerId then
			Message("Nicht genug Mana")
		end
	end
	gvAna_Ppl_RomanWarTributes[_playerId] = AddTribute( CreateATribute(8, "", { Gold = 0}, gvAna_Ppl_RomanWarTribute[_playerId] ) )
 
end
 
-- Germanen
 
function Ana_Ppl_GetPatriots_Germanen(_playerId)
 
 
	if gvAna_Ppl_Mana[_playerId] >= gvAna_Ppl_ManaCosts[3][4]  then
 
		local Zufallssoldat = GetRandom( 3 )
		local ManaCosts
		local Unit
		local soldiers
		if Zufallssoldat == 0 then
			if Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSpear3) == 1 then Zufallssoldat = Entities.PU_LeaderPoleArm4
				ManaCosts = gvAna_Ppl_ManaCosts[3][4]; soldiers = 9
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSpear2) == 1 then Zufallssoldat = Entities.PU_LeaderPoleArm3
				ManaCosts = gvAna_Ppl_ManaCosts[3][3]; soldiers = 9			
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSpear1) == 1 then Zufallssoldat = Entities.PU_LeaderPoleArm2
				ManaCosts = gvAna_Ppl_ManaCosts[3][2]; soldiers = 5		
			else  Zufallssoldat = Entities.PU_LeaderPoleArm1
				ManaCosts = gvAna_Ppl_ManaCosts[3][1]; soldiers = 5			
			end
			Unit = "Speerkaempfer"
		elseif Zufallssoldat == 1 then
			if Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSword3) == 1 then Zufallssoldat = Entities.PU_LeaderSword4
				ManaCosts = gvAna_Ppl_ManaCosts[3][4]; soldiers = 9
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSword2) == 1 then Zufallssoldat = Entities.PU_LeaderSword3
				ManaCosts = gvAna_Ppl_ManaCosts[3][3]; soldiers = 9	
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeSword1) == 1 then Zufallssoldat = Entities.PU_LeaderSword2
				ManaCosts = gvAna_Ppl_ManaCosts[3][2]; soldiers = 5	
			else  Zufallssoldat = Entities.PU_LeaderSword1
				ManaCosts = gvAna_Ppl_ManaCosts[3][1]; soldiers = 5	
			end			
			Unit = "Schwertkaempfer"
		else
			if Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeBow3) == 1 then Zufallssoldat = Entities.PU_LeaderBow4
				ManaCosts = gvAna_Ppl_ManaCosts[3][4]; soldiers = 9
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeBow2) == 1 then Zufallssoldat = Entities.PU_LeaderBow3
				ManaCosts = gvAna_Ppl_ManaCosts[3][3]; soldiers = 9	
			elseif Logic.IsTechnologyResearched(GUI.GetPlayerID(), T_UpgradeBow1) == 1 then Zufallssoldat = Entities.PU_LeaderBow2
				ManaCosts = gvAna_Ppl_ManaCosts[3][2]; soldiers = 5	
			else  Zufallssoldat = Entities.PU_LeaderBow1
				ManaCosts = gvAna_Ppl_ManaCosts[3][1]; soldiers = 5	
			end		
			Unit = "Bogenschuetze"
		end	
		if (math.floor(Logic.GetPlayerAttractionLimit(_playerId))-math.floor(Logic.GetPlayerAttractionUsage(_playerId))) < soldiers then
			if GUI.GetPlayerID() == _playerId then			
				Message("Nicht genug freie Siedlungsplaetze fuer neue Truppen")
			end
		else
			local _temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters1,1,0) }
			if _temp[2] == nil then
				_temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters2,1,0) }
			end
			if _temp[2] == nil then
				_temp = { Logic.GetPlayerEntities(_playerId, Entities.PB_Headquarters3,1,0) }	
			end		
			local _pos = GetPosition(_temp[2])
			_pos.X = _pos.X - 700
			_pos.Y = _pos.Y + 100
 
 
			CreateArmyTroops( _playerId, _pos, Zufallssoldat, 8, 1, 0, _pos )
			gvAna_Ppl_Mana[_playerId] = gvAna_Ppl_Mana[_playerId] - ManaCosts	
			if GUI.GetPlayerID() == _playerId then
				Sound.PlayGUISound( Sounds.fanfare, 80 );	
				Message("Eine Einheit "..Unit.." ist euch beigetreten. "..ManaCosts.." Mana abgezogen.")
			end
		end
 
	else
		if GUI.GetPlayerID() == _playerId then
			Message("Nicht genug Mana")
		end
	end
 
end
 
-- Chinesen
 
function gvAna_Ppl_ChineseRifleUpDelayJob()
	for i = 1,6 do
		if gvAna_Ppl_ChineseRifleUpDelay[i] > 0 then
			gvAna_Ppl_ChineseRifleUpDelay[i] = gvAna_Ppl_ChineseRifleUpDelay[i] - 1
		end
	end
	if gvAna_Ppl_ChineseRifleUpDelay[1] < 1 and gvAna_Ppl_ChineseRifleUpDelay[2] < 1 and gvAna_Ppl_ChineseRifleUpDelay[3] < 1 and gvAna_Ppl_ChineseRifleUpDelay[4] < 1 and gvAna_Ppl_ChineseRifleUpDelay[5] < 1 and gvAna_Ppl_ChineseRifleUpDelay[6] < 1 then
		EndJob(gvAna_Ppl_ChineseRifleUpDelayJobId)
		gvAna_Ppl_ChineseRifleUpDelayJobId = 0
	end
end
 
-- Spelleffekt Comfort
 
function Ana_Ppl_SpellEffect(_pos, _range, _playerId, _type)
	local _effect = {}
	local _sin30 = 0.5 * _range
	local _cos30 = 0.866 * _range
	local _sin60 = 0.866 * _range
	local _cos60 = 0.5 * _range
 
	for i = 1,12 do
		_effect[i] = {}
	end
 
	_effect[1].X = _pos.X + _range; _effect[1].Y = _pos.Y
	_effect[2].X = _pos.X - _range; _effect[2].Y = _pos.Y
	_effect[3].X = _pos.X; _effect[3].Y = _pos.Y + _range
	_effect[4].X = _pos.X; _effect[4].Y = _pos.Y - _range
	_effect[5].X = _pos.X + _sin30; _effect[5].Y = _pos.Y + _cos30
	_effect[6].X = _pos.X + _sin60; _effect[6].Y = _pos.Y + _cos60
	_effect[7].X = _pos.X + _sin30; _effect[7].Y = _pos.Y - _cos30
	_effect[8].X = _pos.X + _sin60; _effect[8].Y = _pos.Y - _cos60
	_effect[9].X = _pos.X - _sin30; _effect[9].Y = _pos.Y - _cos30
	_effect[10].X = _pos.X - _sin60; _effect[10].Y = _pos.Y - _cos60
	_effect[11].X = _pos.X - _sin30; _effect[11].Y = _pos.Y + _cos30
	_effect[12].X = _pos.X - _sin60; _effect[12].Y = _pos.Y + _cos60
	for i = 1,12 do
		Logic.CreateEffect( _type, _effect[i].X, _effect[i].Y, _playerId );
	end
end
 
 
-- CreateArmyComfort (aus Wiki)
 
function CreateArmyTroops( _player, _position, _leaderType, _numberOfSoldiers, _troops, _experience, _move )
    local army = {
        player     = _player,
    }
    local tD  = {
        maxNumberOfSoldiers = _numberOfSoldiers,
        minNumberOfSoldiers = 0,
        experiencePoints    = _experience,
        leaderType          = _leaderType,
        position            = _position,
    }
    for i = 1,_troops do
        army[i] = CreateTroop( army , tD )
    end
    if _move ~= nil then
        for i = 1,_troops do
            Move( army[i], _move)
        end
    end
 
end 
 
-- Tributfunktionen 
function AddTribute( _tribute )
    assert( type( _tribute ) == "table", "Tribut muß ein Table sein" );
    assert( type( _tribute.text ) == "string", "Tribut.text muß ein String sein" );
    assert( type( _tribute.cost ) == "table", "Tribut.cost muß ein Table sein" );
    assert( type( _tribute.playerId ) == "number", "Tribut.playerId muß eine Nummer sein" );
    assert( not _tribute.Tribute , "Tribut.Tribute darf nicht vorbelegt sein");
 
    uniqueTributeCounter = uniqueTributeCounter or 1;
    _tribute.Tribute = uniqueTributeCounter;
    uniqueTributeCounter = uniqueTributeCounter + 1;
 
    local tResCost = {};
    for k, v in pairs( _tribute.cost ) do
        assert( ResourceType[k] );
        assert( type( v ) == "number" );
        table.insert( tResCost, ResourceType[k] );
        table.insert( tResCost, v );
    end
 
    Logic.AddTribute( _tribute.playerId, _tribute.Tribute, 0, 0, _tribute.text, unpack( tResCost ) );
    SetupTributePaid( _tribute );
    return _tribute.Tribute;
end
 
function CreateATribute(_playerID, _text, _cost, _callback)
    local tribute =  {};
    tribute.playerId = _playerID;
    tribute.text = _text;
    tribute.cost = _cost;
    tribute.Callback = _callback;
    return tribute
end
 
function GameCallback_FulfillTribute()
    return 1
end
 
---------------------------------------------------
 
function Ana_People_AddManaJob()
	local _TimeNowTrigger = Logic.GetTime()
	-- Manaproduktion alle 5 Sekunden
	if gvAna_Ppl_ManaProdTriggerTime + 5 <= _TimeNowTrigger then
		for i=1,6 do
			-- falls Volk gewaehlt und nicht Chinese
			if not (gvAna_Ppl_Player[i] == 0 or gvAna_Ppl_Player == 4) then
				Ana_People_AddManaByPeople(gvAna_Ppl_Player[i], i)					
			end
 
		end
		gvAna_Ppl_ManaProdTriggerTime = _TimeNowTrigger
	end
end
 
 function Ana_People_AddManaByPeople(_peopleId, _playerId)
	local _settler = {}
	local _numberofsettlers = 0
	local _manacalc = {}
	local _statistics = {}
	_statistics.Motivation = 0
	_statistics.SettlersResidence = 0
	_statistics.SettlersFarm = 0
	_manacalc.count = 0
	_manacalc.multiplicator = 0
	_manacalc.production = 0
	for i = 1, Track_Entity_Table[_playerId][ gvAna_Ppl_PlayerProdPeopleType[_playerId] ].count do
		if not ( Logic.GetSettlersWorkBuilding( Track_Entity_Table[_playerId][ gvAna_Ppl_PlayerProdPeopleType[_playerId] ][i] ) == 0) then
			local Multiplicator = 1
			local Motivation = Logic.GetSettlersMotivation(Track_Entity_Table[_playerId][ gvAna_Ppl_PlayerProdPeopleType[_playerId] ][i])
			if not (Logic.GetSettlersFarm(Track_Entity_Table[_playerId][ gvAna_Ppl_PlayerProdPeopleType[_playerId] ][i]) == 0) then
				Multiplicator = Multiplicator + 0.25
				if GUI.GetPlayerID() == _playerId then
					_statistics.SettlersFarm = _statistics.SettlersFarm + 1
				end					
			end
			if not (Logic.GetSettlersResidence(Track_Entity_Table[_playerId][ gvAna_Ppl_PlayerProdPeopleType[_playerId] ][i]) == 0) then
				Multiplicator = Multiplicator + 0.25
				if GUI.GetPlayerID() == _playerId then
					_statistics.SettlersResidence = _statistics.SettlersResidence + 1
				end
			end
			if Motivation > 1.19 then Multiplicator = Multiplicator + 0.25
			elseif Motivation > 0.99 then Multiplicator = Multiplicator + 0.1
			elseif Motivation > 0.79 then Multiplicator = Multiplicator + 0
			elseif Motivation > 0.59 then Multiplicator = Multiplicator - 0.1
			else  Multiplicator = Multiplicator - 0.15
			end
 
			_manacalc.multiplicator = _manacalc.multiplicator + Multiplicator
			_manacalc.count = _manacalc.count + 1
			if GUI.GetPlayerID() == _playerId then
				_statistics.Motivation = _statistics.Motivation + Motivation
			end
 
		end
	end
 
	if _manacalc.count > 0 then
		_manacalc.multiplicator = _manacalc.multiplicator / _manacalc.count
		_manacalc.amount = _manacalc.count / 2
		_manacalc.Sulfur = Logic.GetPlayersGlobalResource( _playerId, ResourceType.SulfurRaw ) + Logic.GetPlayersGlobalResource( _playerId, ResourceType.Sulfur )
		if _manacalc.amount > _manacalc.Sulfur then _manacalc.amount = _manacalc.Sulfur
		end
		_manacalc.production = _manacalc.amount * _manacalc.multiplicator
		_manacalc.production = math.floor(_manacalc.amount * _manacalc.multiplicator)
		if gvAna_Ppl_ManaProdActive[_playerId] then			
			gvAna_Ppl_Mana[_playerId] = math.floor(gvAna_Ppl_Mana[_playerId] + _manacalc.production)
			Tools.GiveResouces(_playerId, nil, nil, nil, nil, nil, _manacalc.amount * -1)		
		end
	end
 
	if GUI.GetPlayerID() == _playerId and _manacalc.count > 0 then
		gvAna_Ppl_Status.LastMotivation = _statistics.Motivation * 100 / _manacalc.count
		gvAna_Ppl_Status.LastSettlersRes = _statistics.SettlersResidence
		gvAna_Ppl_Status.LastSettlersFarm = _statistics.SettlersFarm
		gvAna_Ppl_Status.LastEffectiveness = math.floor(_manacalc.multiplicator * 100)
		gvAna_Ppl_Status.NumberOfSettlers = _manacalc.count
		gvAna_Ppl_Status.LastMana = gvAna_Ppl_Mana[_playerId]
		gvAna_Ppl_Status.LastProd = _manacalc.production
	elseif GUI.GetPlayerID() == _playerId then
		gvAna_Ppl_Status.LastMotivation = "-"
		gvAna_Ppl_Status.LastSettlersRes = "-"
		gvAna_Ppl_Status.LastSettlersFarm = "-"
		gvAna_Ppl_Status.LastEffectiveness = "-"
		gvAna_Ppl_Status.NumberOfSettlers = _manacalc.count
		gvAna_Ppl_Status.LastMana = gvAna_Ppl_Mana[_playerId]
	end	
 
 end
 
 -- Moviefenster Tooltip by Noigi
 
function MovieFenster( _title, _text, _WPinternal )
	if gvWP then
		if _WPinternal then -- MovieFenster wird vom Itm-Skript aufgerufen
			gvWP.MF.internalUse = true;
			MovieFensterCore( _title, _text );
		else -- ... vom Mapper
			gvWP.MF.externalUse = true;
			gvWP.MF.BACKUPextTitle = _title;
			gvWP.MF.BACKUPextText = _text;
			if not gvWP.MF.internalUse then
				MovieFensterCore( _title, _text );
			end
		end
	else
		MovieFensterCore( _title, _text );
	end
end
 
function MovieFensterCore( _title, _text )
	XGUIEng.ShowWidget( "Movie", 1 );
	XGUIEng.ShowWidget( "Cinematic_Text", 0 );
	XGUIEng.ShowWidget( "MovieBarTop", 0 );
	XGUIEng.ShowWidget( "MovieBarBottom", 0 );
	XGUIEng.ShowWidget( "MovieInvisibleClickCatcher", 0 );
	XGUIEng.ShowWidget( "CreditsWindowLogo", 0 );
	XGUIEng.SetText( "CreditsWindowTextTitle", _title );
	XGUIEng.SetText( "CreditsWindowText", _text );
end
 
function HideMovieFenster( _WPinternal )
	if gvWP then
		if _WPinternal then -- HideMovieFenster wird vom Itm-Skript aufgerufen
			gvWP.MF.internalUse = false;
			if gvWP.MF.externalUse then
				MovieFensterCore( gvWP.MF.BACKUPextTitle, gvWP.MF.BACKUPextText );
			else
				HideMovieFensterCore();
			end
		else -- ... vom Mapper
			gvWP.MF.externalUse = false;
			if not gvWP.MF.internalUse then
				HideMovieFensterCore();
			end
		end
	else
		HideMovieFensterCore();
	end
end
 
function HideMovieFensterCore()
	XGUIEng.ShowWidget( "Movie", 0 );
end
 
function WPUpdateFeedback()
	-- Funktion aus ItM made by Noigi
	if not (IsBriefingActive() or cutsceneIsActive) then
		local sel = GUI.GetSelectedEntity();
		local str = ""
		if XGUIEng.IsModifierPressed(Keys.ModifierAlt) == 1 then
			if gvAna_Ppl_Player[GUI.GetPlayerID()] == 1 or gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 or gvAna_Ppl_Player[GUI.GetPlayerID()] == 3 then
				if gvAna_Ppl_Player[GUI.GetPlayerID()] == 1 then
					str = str..gvCol.gruen.." Kelten - Saegemuehlen @cr "
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 then
					str = str..gvCol.gruen.." Roemer - Lehmhuetten @cr "
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 3 then
					str = str..gvCol.gruen.." Germanen - Schmieden @cr "
				end
 
				str = str..gvCol.grau.." Manastand: "..gvCol.gruen.." "..gvAna_Ppl_Mana[GUI.GetPlayerID()].." @cr "
				str = str..gvCol.grau.." Produktion/5s: "..gvCol.lila.." "..gvAna_Ppl_Status.LastProd.." @cr "
				str = str..gvCol.grau.." Manaproduktion "
				if gvAna_Ppl_ManaProdActive[GUI.GetPlayerID()] then
					str = str..gvCol.gruen.." aktiv @cr "
				else
					str = str..gvCol.rot.." inaktiv @cr "
				end
				str = str.." @cr "
				str = str..gvCol.grau.." Manavolkgesamt: "..gvCol.lila.." "..gvAna_Ppl_Status.NumberOfSettlers.." @cr "
				str = str..gvCol.grau.." Wohnplaetze/Essen: "..gvCol.lila.." "..gvAna_Ppl_Status.LastSettlersRes.."/"..gvAna_Ppl_Status.LastSettlersFarm.." @cr "
				str = str..gvCol.grau.." Motivation: "..gvCol.lila.." "..gvAna_Ppl_Status.LastMotivation.."% @cr "
				str = str..gvCol.grau.." Effektivitaet: "..gvCol.lila.." "..gvAna_Ppl_Status.LastEffectiveness.."%"
				str = str.." @cr @cr "
				str = str..gvCol.rot.." Tip: "..gvCol.weiss.." Mit Alt+Ctrl kannst du die Produktion aktivieren bzw. deaktivieren"
				if XGUIEng.IsModifierPressed(Keys.ModifierControl) == 1 then
					GUI.PayTribute( GUI.GetPlayerID(), gvAna_Ppl_ManaProdSwitchTributes[GUI.GetPlayerID()])
				end		
 
				MovieFenster(gvCol.space..": ....... "..gvCol.beige.." ManaÃœbersicht",str,true);		
			elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 4 then
				str = str..gvCol.gruen.." Chinesen - Schwarzpulver @cr "
				str = str..gvCol.grau.." Kostenreduzierung: "
				if Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
					str = str..gvCol.gruen.." Ja "
				else
					str = str..gvCol.rot.." Nein "
				end
				MovieFenster(gvCol.space..": ....... "..gvCol.beige.." Volkeigenschaften",str,true);
 
			end
		else
			HideMovieFenster(true);
		end
	else
		HideMovieFenster(true);
	end
end
 
 
-- Triggeraktionen
 
function ActionOnEntityCreated()
	local _entityId = Event.GetEntityID()
	local _playerId = GetPlayer(_entityId)
	local _entityType = Logic.GetEntityType(_entityId)
	-- Chinesen Rückzahlung
	if gvAna_Ppl_Player[_playerId] == 4 then
 
		if _entityType == 616 then
			Tools.GiveResouces(_playerId, 250, nil, nil, nil, nil, nil)
		end
		if _entityType == 617 then
			if gvAna_Ppl_ChineseRifleUpDelay[_playerId] == 0 then
				Tools.GiveResouces(_playerId, 300, nil, nil, nil, nil, nil)
			else
				if gvAna_Ppl_ChineseRifleUpDelay[_playerId] < 0 then
					gvAna_Ppl_ChineseRifleUpDelay[_playerId] = 2
					if gvAna_Ppl_ChineseRifleUpDelayJobId == 0 then
						gvAna_Ppl_ChineseRifleUpDelayJobId = StartSimpleJob("gvAna_Ppl_ChineseRifleUpDelayJob")
					end
				end
			end	
		end	
	end
	-----------------------
	Ana_Comfort_TrackEntity_Created(_entityId)
	------
end
 
function ActionOnEntityDestroyed()
	local _entityId = Event.GetEntityID()
	Ana_Comfort_TrackEntity_Destroyed(_entityId)	
end
 
-- guihacks
 
function Setup_GUIHacks()
 
	GUIAction_ReserachTechnology_OrigProtected = GUIAction_ReserachTechnology
	GUIAction_ReserachTechnology = function(_tech)
		if _tech == Technologies.T_Tracking and gvAna_Ppl_PlayerAllSelected then
			if Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
				if gvAna_Ppl_Player[GUI.GetPlayerID()] == 1 then					
					GUI.PayTribute( 8, gvAna_Ppl_SpecialTributes[GUI.GetPlayerID()][gvAna_Ppl_Player[GUI.GetPlayerID()]]) 
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 then
					GUI.PayTribute( 8, gvAna_Ppl_SpecialTributes[GUI.GetPlayerID()][gvAna_Ppl_Player[GUI.GetPlayerID()]]) 				
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 3 then
					GUI.PayTribute( 8, gvAna_Ppl_SpecialTributes[GUI.GetPlayerID()][gvAna_Ppl_Player[GUI.GetPlayerID()]]) 				
				end
			else
				GUIAction_ReserachTechnology_OrigProtected(_tech)
			end
		elseif _tech == 120 and gvAna_Ppl_PlayerAllSelected then
			--if Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
				if gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 and  Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
					GUI.PayTribute( 8, gvAna_Ppl_RomanWarTributes[GUI.GetPlayerID()] ) 				
				end
			--end					
		else
			GUIAction_ReserachTechnology_OrigProtected(_tech)
		end		
	end
 
	GUITooltip_ResearchTechnologies_Orig = GUITooltip_ResearchTechnologies
	GUITooltip_ResearchTechnologies = function(_a,_b,_c)
		if _a == Technologies.T_Tracking and gvAna_Ppl_PlayerAllSelected then
			if Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
				if gvAna_Ppl_Player[GUI.GetPlayerID()] == 1 then
					local _text = gvCol.grau.." Druide anheuern @cr "..gvCol.rot.." (Kelten) @cr "..gvCol.gelb.." Aktion: "..gvCol.weiss.." Heuert einen Druiden an"
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Taler: "..gvAna_Ppl_ManaCosts[1][8].." @cr Mana: "..gvAna_Ppl_ManaCosts[1][9] );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [/]" );					
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 then
					local _text = gvCol.grau.." Baustoffe anfordern @cr "..gvCol.rot.." (Roemer) @cr "..gvCol.gelb.." Aktion: "..gvCol.weiss.." Fordert eure Buerger an Baustoffe zu spenden"
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Mana: "..gvAna_Ppl_ManaCosts[2][1] );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [/]" );						
				elseif gvAna_Ppl_Player[GUI.GetPlayerID()] == 3 then
					local _text = gvCol.grau.." Volk aufhetzen @cr "..gvCol.rot.." (Germanen) @cr "..gvCol.gelb.." Aktion: "..gvCol.weiss.." Ihr hetzt das Volk gegen eure Feinde auf."
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Mana: "..gvAna_Ppl_ManaCosts[3][1].." bis "..gvAna_Ppl_ManaCosts[3][4] );
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [/]" );					
				end
 
 
			else
				local _text = gvCol.grau.." Faehrtenlesen @cr "..gvCol.gelb.." Ermoeglicht: "..gvCol.weiss.." erhoeht die Sichtweite von Leibeigenen und macht den Einsatz von Voelkerfaehigkeiten moeglich"
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Taler: 500" );
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [Q]" );			
			end
		elseif _a == 120 and gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 then
			local _text = gvCol.grau.." Kriegsmaterialien anfordern @cr "..gvCol.rot.." (Roemer) @cr "..gvCol.gelb.." Aktion: "..gvCol.weiss.." Fordert eure Buerger an Kriegsmaterialien bereitzustellen"
			if not (Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1) then
				_text = _text.." @cr "..gvCol.rot.." benoetigt Faehrtenlesen!"
			end			
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Mana: "..gvAna_Ppl_ManaCosts[2][2] );
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [/]" );				
 
 
		else
 
		GUITooltip_ResearchTechnologies_Orig(_a,_b,_c)
		end
	end
 
	GUITooltip_BuyMilitaryUnit_Orig = GUITooltip_BuyMilitaryUnit
	GUITooltip_BuyMilitaryUnit = function(_a,_b,_c,_d,_e)
		if _a == UpgradeCategories.LeaderRifle and gvAna_Ppl_Player[GUI.GetPlayerID()] == 4 and Logic.IsTechnologyResearched(GUI.GetPlayerID(),Technologies.T_Tracking) == 1 then
			local _text = gvCol.grau.." Scharfschuetze @cr "..gvCol.weiss.." Der Scharfschuetze kaempft mit Gewehren @cr "
			_text = _text..gvCol.gelb.." stark gegen: "..gvCol.weiss.." Fernkaempfer und Nebelvolk @cr "
			_text = _text..gvCol.gelb.." schwach gegen: "..gvCol.weiss.." schwere Kavallerie und Schwertkaempfer @cr "			_text = 
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, _text );
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "Schwefel: 80 @cr Plaetze: 1" );
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "Taste: [S]" );		
		else
			GUITooltip_BuyMilitaryUnit_Orig(_a,_b,_c,_d,_e)			
		end
	end
 
	-- Druidenzauber 1
	GUIAction_Hero6ConvertSettlers_Orig = GUIAction_Hero6ConvertSettlers()
	GUIAction_Hero6ConvertSettlers = function()
		local _guiplayer = GUI.GetPlayerID()
		for i = 1,5 do
			if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
				if gvAna_Ppl_DruidsCD[_guiplayer][i][1] <= 0 then
					GUI.PayTribute( 8, gvAna_Ppl_DruidSpellTributes[_guiplayer][i][1] ) 
				end
				break
			end
			GUIAction_Hero6ConvertSettlers_Orig()
		end
		--GUI.PayTribute( 8, gvAna_Ppl_DruidSpellTributes[_guiplayer][_druidselected][1])	
	end	
 
	-- Druidenzauber 2
	GUIAction_Hero6Bless_Orig = GUIAction_Hero6Bless
	GUIAction_Hero6Bless = function()
		local _guiplayer = GUI.GetPlayerID()
		for i = 1,5 do
			if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
				if gvAna_Ppl_DruidsCD[_guiplayer][i][2] <= 0 then
					GUI.PayTribute( 8, gvAna_Ppl_DruidSpellTributes[_guiplayer][i][2] ) 
				end
				break
			end
			GUIAction_Hero6Bless_Orig()
		end
		--GUI.PayTribute( 8, gvAna_Ppl_DruidSpellTributes[_guiplayer][_druidselected][2])
	end
 
	-- Druidenzauber 3
	GUIAction_Command_Orig = GUIAction_Command
	GUIAction_Command = function(_a)	
		if _a == 5 then
			local _guiplayer = GUI.GetPlayerID()
			_druidselected = false
			for i = 1,5 do
				if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
					if gvAna_Ppl_DruidsCD[_guiplayer][i][3] <= 0 then
						GUI.PayTribute( 8, gvAna_Ppl_DruidSpellTributes[_guiplayer][i][3] ) 
					end
					_druidselected = false
					break
				end
			end			
			if not _druidselected then
				GUIAction_Command_Orig(_a)
			end
		else
			GUIAction_Command_Orig(_a)
		end	
	end
 
	GUIUpdate_HeroAbility_Orig = GUIUpdate_HeroAbility
	GUIUpdate_HeroAbility = function(_a,_b)
		--Abilities.AbilityRangedEffect,gvGUI_WidgetID.Hero6_Bless
		if _b == gvGUI_WidgetID.Hero6_ConvertSettlers then
			if gvAna_Ppl_DruidsSpellsPossible[1] then XGUIEng.DisableButton(gvGUI_WidgetID.Hero6_ConvertSettlers,0) 
			else XGUIEng.DisableButton(gvGUI_WidgetID.Hero6_ConvertSettlers,1)
			end
		elseif _b == gvGUI_WidgetID.Hero6_Bless then
			if gvAna_Ppl_DruidsSpellsPossible[2] then XGUIEng.DisableButton(gvGUI_WidgetID.Hero6_Bless,0) 
			else XGUIEng.DisableButton(gvGUI_WidgetID.Hero6_Bless,1)
			end	
		else
			GUIUpdate_HeroAbility_Orig(_a,_b)
		end
 
	end
 
	GameCallback_GUI_SelectionChanged_Orig = GameCallback_GUI_SelectionChanged;
	GameCallback_GUI_SelectionChanged = function()
		GameCallback_GUI_SelectionChanged_Orig()	
		if gvAna_Ppl_PlayerAllSelected then
			local _druidselected = false		
			local _guiplayer = GUI.GetPlayerID()
 
			for i = 1,5 do
				if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
					_druidselected = true
					break
				end
			end
			if _druidselected then
				XGUIEng.SetWidgetPosition(gvGUI_WidgetID.CommandGuard,76,40)
			else
				if gvAna_Ppl_PlayerAllSelected then
 
					if gvAna_Ppl_Player[GUI.GetPlayerID()] == 2 and Logic.GetEntityType( GUI.GetSelectedEntity() ) == Entities.PB_Brickworks2 then
						XGUIEng.ShowWidget( 1140, 1 );
					end				
				end
				XGUIEng.SetWidgetPosition(gvGUI_WidgetID.CommandGuard,148,4)
			end
		end
 
	end
 
	GUITooltip_NormalButton_Orig = GUITooltip_NormalButton
	GUITooltip_NormalButton = function(_a,_b)
		local _guiplayer = GUI.GetPlayerID()
		local _druidselected = 0
		if gvAna_Ppl_PlayerAllSelected then
			for i = 1,5 do
				if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
					_druidselected = i
					break
				end
			end
			if not (_druidselected == 0) then
 
				if _a == "MenuHero6/command_convertbuilding" then
					local _text = gvCol.grau.." Resourcen auffrischen @cr "..gvCol.gelb.." Wirkung: "..gvCol.weiss.." Erhoeht die abbaubaren Ressourcen in der Naehe des Druiden"			
					if gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][1] > 0 then _text = _text.." @cr "..gvCol.gelb.." Cooldown: "..gvCol.rot.." "..gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][1] end		
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts,"Mana: "..gvAna_Ppl_ManaCosts[1][1]); --<Hier den Text ändern
				elseif _a == "MenuHero6/command_bless" then
					local _text = gvCol.grau.." Nebelvolk beschwoeren @cr "..gvCol.gelb.." Wirkung: "..gvCol.weiss.." Eine Einheit des Nebelvolks kommt euch zuhilfe"			
					if gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][2] > 0 then _text = _text.." @cr "..gvCol.gelb.." Cooldown: "..gvCol.rot.." "..gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][2] end
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts,"Mana: "..gvAna_Ppl_ManaCosts[1][2]); --<Hier den Text ändern				
				elseif _a == "MenuCommandsGeneric/command_guard" then
					local _text = gvCol.grau.." Ueberzeugung @cr "..gvCol.gelb.." Wirkung: "..gvCol.weiss.." Eine feindliche Einheit im Umkreis des Druiden laeuft zu euch ueber"			
					if gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][3] > 0 then _text = _text.." @cr "..gvCol.gelb.." Cooldown: "..gvCol.rot.." "..gvAna_Ppl_DruidsCD[_guiplayer][_druidselected][3] end
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern
					XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts,"Mana: "..gvAna_Ppl_ManaCosts[1][3]); --<Hier den Text ändern
				else GUITooltip_NormalButton_Orig(_a,_b);
				end
			else
				GUITooltip_NormalButton_Orig(_a,_b);
			end
		end
 
	end
 
	GUITooltip_Generic_Orig = GUITooltip_Generic;
	GUITooltip_Generic = function(_var)
		if _var == "MenuHeadquarter/Tracking" then
			local _text = gvCol.grau.."Faehrtenlesen @cr "..gvCol.gelb.."Ermoeglicht: "..gvCol.weiss.." erhoeht die Sichtweite von Leibeigenen und macht den Einsatz von Voelkerfaehigkeiten moeglich"			
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern		
		else
			if gvAna_Ppl_PlayerAllSelected then
				local _guiplayer = GUI.GetPlayerID()
				local _druidselected = false
				for i = 1,5 do
					if GUI.GetSelectedEntity() == gvAna_Ppl_Druids[_guiplayer][i] then
						_druidselected = true
						break
					end
				end
				if _druidselected then
					if _var == "MenuHero6/command_bless" then
						local _text = gvCol.grau.."Resourcen auffrischen @cr "..gvCol.gelb.."Wirkung: "..gvCol.weiss.."Erhoeht die Menge naher abbaubarer Ressourcen"			
						XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern	
					elseif _var == "MenuHero6/command_convertbuilding" then
						local _text = gvCol.grau.."Nebelvolk beschwoeren @cr "..gvCol.gelb.."Wirkung: "..gvCol.weiss.."Eine Einheit des Nebelvolks kommt euch zuhilfe"			
						XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern	
					elseif _var == "MenuCommandsGeneric/command_guard" then
						local _text = gvCol.grau.."Ueberzeugung @cr "..gvCol.gelb.."Wirkung: "..gvCol.weiss.."Eine feindliche Einheit im Umkreis des Druiden laeuft zu euch ueber"			
						XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text); --<Hier den Text ändern	
					else GUITooltip_Generic_Orig(_var);
					end
				else
					GUITooltip_Generic_Orig(_var);
				end
			end
		end
	end
 
 
end
 
function Ana_Comfort_TrackEntitysIni()	
	Track_Entity_Table = {}
	for i = 1,8 do
		Track_Entity_Table[i] = {}
	end	
	Ana_Comfort_TrackEntityIni = function(_playerId,_entityType)	
		local temp = {Logic.GetPlayerEntities(_playerId, _entityType,1)}
		local count = 0
		Track_Entity_Table[_playerId][_entityType] = {}
		Track_Entity_Table[_playerId][_entityType].tracked = true
		Track_Entity_Table[_playerId][_entityType].count = 0
		if temp[1] > 0 then
			local latestEntity = temp[2]
			for u = 1, Logic.GetNumberOfEntitiesOfTypeOfPlayer(_playerId, _entityType) do
				if latestEntity ~= 0 then
					table.insert(Track_Entity_Table[_playerId][_entityType], latestEntity)
					count = count + 1
				end
				latestEntity = Logic.GetNextEntityOfPlayerOfType(latestEntity);
			end
			Track_Entity_Table[_playerId][_entityType].count = count
		end	
	end
	Ana_Comfort_TrackEntity_Created = function(_entityId)
		local _playerId = GetPlayer(_entityId)	
		local _entityType = Logic.GetEntityType(_entityId)
		if type(Track_Entity_Table[_playerId][_entityType]) == "table" then
			if Track_Entity_Table[_playerId][_entityType].tracked then
				table.insert(Track_Entity_Table[_playerId][_entityType], _entityId)	
				Track_Entity_Table[_playerId][_entityType].count = Track_Entity_Table[_playerId][_entityType].count + 1
			end
		end
	end
 
	Ana_Comfort_TrackEntity_Destroyed = function(_entityId)
		local _playerId = GetPlayer(_entityId)
		local _entityType = Logic.GetEntityType(_entityId)	
		if not (Track_Entity_Table[_playerId] == nil) then
			if not (Track_Entity_Table[_playerId][_entityType] == nil) then
				if Track_Entity_Table[_playerId][_entityType].tracked then					
					for i = 1, Track_Entity_Table[_playerId][_entityType].count do
						if _entityId == Track_Entity_Table[_playerId][_entityType][i] then
							table.remove(Track_Entity_Table[_playerId][_entityType], i)
							break
						end
					end
				end
			end
		end	
	end	
 
	Ana_Comfort_TrackEntity_IsTracked = function(_playerId, _entityTypeOrId, _TypeOrId)
		if _TypeOrId == nil then _TypeorId = true end
		if _TypeOrId then
			return Track_Entity_Table[_entityTypeOrId][_entityType].tracked
		else
			return Track_Entity_Table[_entityTypeOrId][Logic.GetEntityType(_entityTypeOrId)].tracked		
		end
	end
	Ana_Comfort_TrackEntity_RemoveTracking = function(_playerId, _entityType)
		Track_Entity_Table[_playerId][_entityType] = {}
		Track_Entity_Table[_playerId][_entityType].tracked = false
		Track_Entity_Table[_playerId][_entityType].count = -1	
	end	
 
end
 
function Globale_Hilfsvariablen()
 
gvCol = {
	weiss = "@color:255,255,255",
	schwarz = "@color:0,0,0",
	rot = "@color:255,0,0",
	gelb = "@color:255,232,0",
	gruen = "@color:0,255,0",
	dunkelgruen = "@color:0,100,0",
	blau = "@color:0,0,255",
	lila = "@color:200,0,200",
	grau = "@color:150,150,150",
	tuerkis = "@color:0,180,180",
	orange = "@color:255,130,0",
	beige = "@color:190,190,150",
	hellgrau = "@color:170,170,170",
	dunkelgrau = "@color:120,120,120",
	TTgelb = "@color:255,200,0",
	TTrot = "@color:200,60,0",
	TUTgruen = "@color:90,190,20",
	space = "@color:0,0,0,0",
}
 
end

Ein paar Bilder

Folgt noch

devscripts/voelker.txt · Zuletzt geändert: 2021/09/18 19:15 von 127.0.0.1