Benutzer-Werkzeuge

Webseiten-Werkzeuge


utilfunctions:groesse_von_gebaeuden

Größe von Gebäuden

Damit Mary auch mal was nützliches tut. Habe ich sie hier als Vermesser benutzt. Sie läuft an die Ecken der Entity und nachher wird Breite und Tiefe ausgegeben. Einfach in eine leere Karte. Man braucht die Delay-Funktion dazu.

Habe alle Teile, die ich zum Testen gebraucht habe auskommentiert und drin gelassen.
Move habe ich durch Laufe ersetzt, dann braucht man nicht zu warten.

Für den, ders braucht: (unten ist ein table)

function FirstMapAction()
	Tools.ExploreArea( -1, -1, 900 )
	_Pos= {X=6000,Y=6000}
	CreateEntity (1,Entities.CU_Mary_de_Mortfichet,_Pos,"Mary")
	--Vermesse()   -- hab ich gebraucht, wenn in der DelayFunc ein Fehler war. Der wird ja nicht angezeigt
StartDelayFunc(Vermesse)
end
--**********************************************************************************
function Vermesse()  -- wollte nicht Measure()
	local _Pos= {X=8000,Y=8000}
		nId=Logic.CreateEntity( Entities.PB_University1,  --- hier die Entity rein
										_Pos.X,
										_Pos.Y,
										0, 1 );	
        SetEntityName(nId,"willi")
 
	Camera.FollowEntity(GetEntityId("Mary"))
	-------------------------------------------------------------------------------------
	Laufe("Mary", ZurEntity("willi",200)) -- Die Zahl muß manchmal angepasst werden
	--Delay(15)
	_pos =GetPosition("Mary")
	--Message(_pos.X.. "_____Y=___".. _pos.Y)
	x1=_pos.X-8000
	--Message(x1)
	-------------------------------------------------------------------------------------
	Laufe("Mary", RechtsVonPos("willi",-200))
	--Delay(10)
	_pos =GetPosition("Mary")
	--Message(_pos.X.. "_____Y=___".. _pos.Y)
	y1=_pos.Y-8000
	--Message(y1)
	-------------------------------------------------------------------------------------
	Laufe("Mary", ZurEntity("willi",-200))
	--Delay(10)
	_pos =GetPosition("Mary")
	--Message(_pos.X.. "_____Y=___".. _pos.Y)
	x2=_pos.X-8000
	--Message(x2)
	-------------------------------------------------------------------------------------
	Laufe("Mary", RechtsVonPos("willi",200))
	--Delay(10)
	_pos =GetPosition("Mary")
	--Message(_pos.X.. "_____Y=___".. _pos.Y)
	y2=_pos.Y-8000
	--Message(y2)
 
	breit=math.abs(x1)+math.abs(x2)
	tief =math.abs(y1)+math.abs(y2)
 
	Message( "Die Entity ist  ".. breit.." breit und "..tief.." tief")
 
 
 
end
--***********************************************************************************************************
function ZurEntity(_entity, _range, _currPos)  -- neu geschrieben
	-- _entity  = die Entity zu deren Winkel  man sich bewegen will
	-- _currPos Die Position auf der man sich befindet
	-- _tRange= die Entfernung zur Entity (im Winkel der Entity) Weiter weg ist dann negativ
	if type (_entity) == "table" then 
		Message("Keine Position sondern Entity angeben")
		return nil
	end
	if type (_entity) == "string" then
		_entity = GetEntityId(_entity);
	end
	local tPos = GetPosition(_entity)
	if _currPos == nil then
		_currPos = tPos
	elseif type (_currPos) == "string" or type (_currPos) == "number"  then
		_currPos = GetPosition(_currPos)
	end
	local nEntityAngle=Logic.GetEntityOrientation(_entity);
	local nSin=math.sin((math.rad(nEntityAngle)));
	local nCos=math.cos((math.rad(nEntityAngle)));
	local tPos = GetPosition(_entity)
	return {X=_currPos.X-nCos*_range,Y=_currPos.Y-nSin*_range}; -- Rückgabe=neue Position
end
--***********************************************************************************************************
function RechtsVonPos(_entity,_range,_currPos)  -- neu geschrieben
	-- _entity  = die Entity zu deren Winkel man nach rechts will
	-- _currPos Die Position auf der man sich befindet
	-- _tRange= die Entfernung nach rechts (im Winkel der Entity) Nach links ist dann negativ
	if type (_entity) == "table" then 
		Message("Keine Position sondern Entity angeben")
		return nil
	end
	if type (_entity) == "string" then
		_entity = GetEntityId(_entity);
	end
	local tPos = GetPosition(_entity)
	if _currPos == nil then
		_currPos = tPos
	elseif type (_currPos) == "string" or type (_currPos) == "number"  then
		_currPos = GetPosition(_currPos)
	end
	local nEntityAngle=Logic.GetEntityOrientation(_entity);
	local nSin=math.sin((math.rad(nEntityAngle)));
	local nCos=math.cos((math.rad(nEntityAngle)));
	return {X=_currPos.X+nSin*_range,Y=_currPos.Y-nCos*_range};  -- Rückgabe=neue Position
end
--***********************************************************************************************************
function Laufe(_entity,_tPos)  -- vollte nicht RunTo schreiben
	local pEntityWarPos=GetPosition(_entity)
	if type (_tPos) == "string" or type (_tPos) == "number" then
		_tPos = GetPosition(_tPos);
	end
	Move(_entity,_tPos);
	DelayShort(2)
	local pEntityIstPos=GetPosition(_entity)
	while not (pEntityIstPos.X  == pEntityWarPos.X and pEntityIstPos.Y  == pEntityWarPos.Y) do  --er läuft noch
		pEntityWarPos=GetPosition(_entity)
		DelayShort(2)
		pEntityIstPos=GetPosition(_entity)
	end
end
--***********************************************************************************************************


FIXME Also ich habe da so meine Zweifel, dass die nachfolgenden Werte stimmen. Diese rühren u.a. daher, dass ich davon ausgehe, dass die Upgradestufe eines Gebäudes keine anderen Maße hat, als das Grundgebäude. Ferner bin ich bspw. auch der Meinung, dass ein Sägewerk wesentlich mehr Platz beansprucht, als ein Wohnhaus.

Von daher sind die Werte wohl eher „mit Vorsicht“ zu genießen. Ob das Script richtig funktioniert und nur beim Eintragen in die nachfolgende Tabelle Fehler passiert sind, habe ich nicht überprüft! — Netsurfer 2007/01/12 15:51

-- Ohne Gewähr
 
gebaeudeGroesse={ -- name, breit , tief
{"CB_Abbey03",400,400},
{"CB_Abbey04",400,400},
{"CB_BarmeciaCastle",400,400},
{"CB_Bastille1",1800,1800},
{"CB_Camp01",800,900},
{"CB_Camp02",800,600},
{"CB_Camp03",800,600},
{"CB_Camp04",1000,600},
{"CB_Camp05",600,600},
{"CB_Camp06",600,600},
{"CB_Camp07",600,600},
{"CB_Camp08",600,600},
{"CB_Camp09",800,600},
{"CB_Camp10",800,600},
{"CB_Camp11",800,600},
{"CB_Camp12",1000,600},
{"CB_Camp13",600,600},
{"CB_Camp14",600,600},
{"CB_Camp15",600,600},
{"CB_Camp16",600,600},
{"CB_Camp17",600,600},
{"CB_Camp18",800,600},
{"CB_Camp19",600,600},
{"CB_Camp20",600,600},
{"CB_Camp21",600,600},
{"CB_Camp22",600,600},
{"CB_Camp23",800,600},
{"CB_Camp24",600,600},
{"CB_Castle1",600,600},
{"CB_CrawfordCastle",1600,2000},
{"CB_DarkCastle",1300,1300},
{"CB_DestroyAbleRuinHouse1",1900,1800},
{"CB_DestroyAbleRuinMonastery1",600,600},
{"CB_DestroyAbleRuinResidence1",1000,1400},
{"CB_DestroyAbleRuinSmallTower1",600,600},
{"CB_DestroyAbleRuinSmallTower3",600,600},
{"CB_Evil_Tower1",600,600},
{"CB_FolklungCastle",400,400},
{"CB_HermitHut1",2300,1900},
{"CB_InventorsHut1",800,600},
{"CB_KaloixCastle",1400,2000},
{"CB_Lighthouse",2200,1900},
{"CB_LighthouseActivated",800,900},
{"CB_Mercenary",800,900},
{"CB_MinerCamp1",800,600},
{"CB_MinerCamp2",1000,800},
{"CB_MinerCamp3",700,700},
{"CB_MinerCamp4",700,700},
{"CB_MinerCamp5",700,600},
{"CB_MinerCamp6",700,700},
{"CB_Mint1",500,500},
{"CB_MonasteryBuildingSite1",1300,1000},
{"CB_RobberyTower1",2000,3200},
{"CB_SteamMashine",800,900},
{"CB_TechTrader",400,400},
{"PB_Alchemist1",1000,600},
{"PB_Alchemist2",1600,1000},
{"PB_Archery1",1600,1000},
{"PB_Archery2",1700,1500},
{"PB_Bank1",1700,1500},
{"PB_Bank2",1000,1100},
{"PB_Barracks1",1000,1100},
{"PB_Barracks2",1600,1600},
{"PB_Blacksmith1",1600,1600},
{"PB_Blacksmith2",900,1100},
{"PB_Blacksmith3",900,1100},
{"PB_Brickworks1",900,1100},
{"PB_Brickworks2",1300,1000},
{"PB_DarkTower1",1300,1000},
{"PB_DarkTower2",400,400},
{"PB_DarkTower3",400,400},
{"PB_DrawBridgeClosed1",400,400},
{"PB_DrawBridgeClosed2",700,200},
{"PB_Farm1",200,700},
{"PB_Farm2",1200,800},
{"PB_Farm3",1200,800},
{"PB_Foundry1",1200,800},
{"PB_GunsmithWorkshop2",1200,1200},
{"PB_Headquarters1",1200,1200},
{"PB_Headquarters2",1400,1400},
{"PB_Headquarters3",1400,1400},
{"PB_Market1",1400,1400},
{"PB_Market2",1400,1400},
{"PB_MasterBuilderWorkshop",1400,1400},
{"PB_Monastery1",1000,1100},
{"PB_Monastery2",1700,1500},
{"PB_Monastery3",1700,1500},
{"PB_Outpost1",1700,1500},
{"PB_Outpost2",1400,1400},
{"PB_Outpost3",1400,1400},
{"PB_PowerPlant1",1400,1400},
{"PB_Residence1",700,700},
{"PB_Residence2",700,600},
{"PB_Residence3",700,600},
{"PB_Sawmill1",700,600},
{"PB_Sawmill2",1800,1100},
{"PB_Stable1",1800,1100},
{"PB_Stable2",2000,1800},
{"PB_StoneMason1",2000,1800},
{"PB_StoneMason2",1200,1000},
{"PB_Tower1",1400,1100},
{"PB_Tower2",400,400},
{"PB_Tower3",400,400},
{"PB_University1",400,400},
{"PB_University2",1700,1500},
{"PB_VillageCenter1",1700,1500},
{"PB_VillageCenter2",1300,1400},
{"PB_VillageCenter3",1300,1400},
{"PB_WeatherTower1",1300,1400},
{"PB_Weathermachine",600,600}}
utilfunctions/groesse_von_gebaeuden.txt · Zuletzt geändert: 2021/09/18 19:16 (Externe Bearbeitung)