AI PLAYER, TROOP SPAWN SCRIPT AND MORE
» Siedler Map Source Forum » Siedler DEdK Script Forum » AI PLAYER, TROOP SPAWN SCRIPT AND MORE
Seiten: Zurück 1 2 3 4 5 6 Nächste Seite
polaster64
|
#76 11.03.2018 18:09 Beiträge: 184 |
Zitat von polaster64:
Zitat von mcb:
Seems your file is broken. (What is the filesize? Just out of curiosity.) There is an autosave file (Documents/The Settlers HOK/MapEditor/Autosave) maybe you can use it.
File size is normal. 3.379 KB. The autosave file doesnt work as yesterday I tried to open this map in different ways.
http://www77.zippyshare.com/v/bqzQUL2s/file.html
This is the map file, you can take a look..
polaster64
|
#78 11.03.2018 19:57 Beiträge: 184 |
Zitat von mcb:
Nothing to do there, it is just a lot of zeroes.
so it is broken? unrecoverable?
mcb
|
#79 11.03.2018 22:29 Beiträge: 1472 |
Yes, the file looks like this:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
In a hex editor.
(Of course it is longer)
Nothing anyone can do here, sorry.
(Maybe you can find something on the HDD with some recovery tool. But since the file got overrided and you most likely used that drive in the meantime, it is very unlikely)
Play4FuN
|
#80 12.03.2018 00:38 Beiträge: 704 |
Honestly, you aren't and you won't be the only one to learn the importance of backups the hard way...
____________________
LG Play4FuN
Siedler DEdK Mapping + Scripting Tutorials
polaster64
|
#81 12.03.2018 16:56 Beiträge: 184 |
Zitat von Play4FuN:
Honestly, you aren't and you won't be the only one to learn the importance of backups the hard way...
Well I have found(honestly it is a miracle huh) a text file I put the script in. It is not everything but at least a part which is really important. And I have another question since I found the part of it.
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
function FirstMapAction() CreateMilitaryGroup(4, Entities.CU_Barbarian_LeaderClub1, 4, GetPosition ("E2")) CreateMilitaryGroup(4, Entities.CU_Barbarian_LeaderClub1, 4, GetPosition ("E1")) CreateMilitaryGroup(4, Entities.CU_Barbarian_LeaderClub1, 4, GetPosition ("E4")) CreateMilitaryGroup(8, Entities.PU_LeaderPoleArm1, 4, GetPosition ("E3")) local VictoryConditionType = 1 if VictoryConditionType == 1 then MapEditor_SetupResourceVictoryCondition( 200000, 7000, 5000, 6000, 4000, 3000 ) elseif VictoryConditionType == 2 then MapEditor_SetupDestroyVictoryCondition(2) end -- Level 0 is deactivated...ignore MapEditor_SetupAI(2, 0, 0, 0, "", 0, 0) MapEditor_SetupAI(3, 0, 0, 0, "", 0, 0) MapEditor_SetupAI(4, 1, 500, 0, "nic", 0, 0) MapEditor_SetupAI(5, 0, 0, 0, "", 0, 0) MapEditor_SetupAI(6, 0, 0, 0, "", 0, 0) MapEditor_SetupAI(7, 0, 0, 0, "", 0, 0) MapEditor_SetupAI(8, 0, 4000, 0, "nic", 2, 0) -- HQ Defeat Condition MapEditor_CreateHQDefeatCondition() CreateNpcGuard() CreatePreludeBriefing() CreateNpcBurmistrz() end function CreateNpcGuard() local npc = { name = "Guard", -- name of the npc callback = BriefingGuard, -- what should be called, when the npc gets spoken with } CreateNPC(npc) end function CreateNpcBurmistrz() local npc = { name = "Burmistrz", -- name of the npc callback = BriefingBurmistrz, -- what should be called, when the npc gets spoken with } CreateNPC(npc) end function BriefingBurmistrz() -- this contains all data for the briefing local briefing = {}; -- AddPage / AddShortPage functions, used to fill the briefing local AP, ASP = AddPages(briefing); -- ASP( _name, _title, _text, _dialog); -- _name: Script name of the target entity. camera will centered at this entity -- _title: Page title -- _text: Page text -- _dialog: set to true to move the camera closer, else just leave it out ASP("Burmistrz","Burmistrz","Dziekuje wam za ratunek, nie wiem jak wyrazic swoja wdziecznosc! ", true); ASP("Dario","Dario","Pomoc wam to byl nasz obowiazek."); ASP("Burmistrz","Burmistrz","Jestescie blogostawienstwem. Ale do rzeczy. Nieznany nam przeciwnik zaatakowal nas i zniszczyl doslownie wszystko, nie udalo mu sie jednak zniszczyc naszego muru, ktory widzieliscie wchodzac do tej doliny. ", true); ASP("Dario","Dario","Co mamy robic Burmistrzu? Chetnie chcielibysmy pomoc ci zlikwidowac tego barbadzynce, ale do tego potrzebujemy ludzi oraz zaopatrzenia!"); local resolve1 = AP{ tilte = "Burmistrz", text = "Spojrzcie tam, wlasnie tam znajduja sie nasze surowce pogrzebane przez bandytow, Pielgrzymie czy moglbys je dla nas oczyscic?Jezeli wam sie to uda to wioska jest wasza, powodzenia!", position = GetPosition("Skaly1"), dialogCamera = false, explore = 1500, } ASP("Pielgrzym","Pielgrzym","Nie ma problemu, ale zasloncie uszy, wybuch bedzie glosny!", true); -- just add as many pages as you need briefing.finished = function() StartSimpleJob("UsunSkaly") ResolveBriefing(resolve1) end; StartBriefing(briefing); -- starts the briefing (dont forget this) end function UsunSkaly() if IsDestroyed("Skaly1" ) then -- jezeli objekt "Kamien" zostanie zniszczony to... StartSimpleJob("UsunSkaly1") CreateArmyOne() CreatePreludeBriefing4() return true else --jezeli nie to... Message("Go to the stones and destroy them!") -- zostanie wyswietlona informacja, ale ze jest pusta to nie zostanie wyswietlona (mialem problem bo skrypt wariowal gdy nie bylo tutaj zupelnie nic) return false -- false/true oznacza czy funkcja ma zostac zakonczona end end function UsunSkaly1() if IsDestroyed("Skaly2") then -- jezeli objekt "Skaly2" zostanie zniszczony to... ChangePlayer("b1", 1) ChangePlayer("b2", 1) ChangePlayer("b3", 1) ChangePlayer("b4", 1) ChangePlayer("b5", 1) ChangePlayer("b6", 1) ChangePlayer("b7", 1) ChangePlayer("b8", 1) ChangePlayer("b9", 1) ChangePlayer("b10", 1) ChangePlayer("b11", 1) ChangePlayer("b12", 1) ChangePlayer("b13", 1) ChangePlayer("b14", 1) ChangePlayer("b15", 1) ChangePlayer("b16", 1) ChangePlayer("b17", 1) ChangePlayer("b18", 1) ChangePlayer("b19", 1) ChangePlayer("b20", 1) ChangePlayer("b21", 1) ChangePlayer("HQ1", 1) AddGold(500) AddClay(200) AddWood(300) AddStone(400) AddIron(100) AddSulfur(300) StartSimpleJob("Zasadzka") CreatePreludeBriefing3() StartSimpleJob("ArmiaPierwszaDead") return true end end function ArmiaPierwszaDead() if IsDead("armyOne") then StartSimpleJob("ArmiaPierwszaSkarbyBriefing") return true end end function ArmiaPierwszaSkarbyBriefing() -- this contains all data for the briefing local briefing = {}; -- AddPage / AddShortPage functions, used to fill the briefing local AP, ASP = AddPages(briefing); ASP("Erek","Erek","Okay, I think we killed them all, lets search the area now.", true); local resolve4 = AP{ title = "Dario", text = "The bandits propably hid some treasures in the woods, go search for them!", position = GetPosition("woods"), explore = 2000, } -- now remove the exploration briefing.finished = function() ResolveBriefing(resolve4) -- we remove the exploration end StartBriefing(briefing); -- starts the briefing (dont forget this) end function CreatePreludeBriefing4() PreludeBriefing = {} PreludeBriefing.finished = PreludeBriefingFinished4 page = 0 -- page #1 page = page + 1 PreludeBriefing[page] = {} PreludeBriefing[page].title = "Teller" PreludeBriefing[page].text = "Be careful, villagers havent been here for months, who knows what you may find there" PreludeBriefing[page].position = GetPosition("pulapka") PreludeBriefing[page].explore = 1000 PreludeBriefingShowPulapka = PreludeBriefing[page] StartBriefing(PreludeBriefing) end function PreludeBriefingFinished4() ResolveBriefing(PreludeBriefingShowPulapka) end function CreatePreludeBriefing3() PreludeBriefing = {} PreludeBriefing.finished = PreludeBriefingFinished3 page = 0 -- page #1 page = page + 1 PreludeBriefing[page] = {} PreludeBriefing[page].title = "Burmistrz" PreludeBriefing[page].text = "Very nice, the village under your control now, good luck!" PreludeBriefing[page].position = GetPosition("Burmistrz") PreludeBriefingShowBurmistrz = PreludeBriefing[page] StartBriefing(PreludeBriefing) end function PreludeBriefingFinished3() ResolveBriefing(PreludeBriefingShowBurmistrz) end function CreateArmyOne() armyOne = {} armyOne.player = 4 armyOne.id = 4 armyOne.strength = 2 armyOne.position = GetPosition("armyOne") armyOne.rodeLength = 1000 SetupArmy(armyOne) local troopDescription = {} troopDescription.maxNumberOfSoldiers = 4 troopDescription.minNumberOfSoldiers = 0 troopDescription.experiencePoints = HIGH_EXPERIENCE troopDescription.leaderType = Entities.CU_Barbarian_LeaderClub2 for i = 1,3,1 do EnlargeArmy(armyOne,troopDescription) end local troopDescription = { maxNumberOfSoldiers = 4, minNumberOfSoldiers = 0, experiencePoints = HIGH_EXPERIENCE, leaderType = Entities.CU_BlackKnight_LeaderMace1 } for i = 1,3,1 do EnlargeArmy(armyOne,troopDescription) end end function Zasadzka() if IsDestroyed("Skaly3") then CreatePreludeBriefing2() return true end end function CreatePreludeBriefing2() PreludeBriefing = {} PreludeBriefing.finished = PreludeBriefingFinished2 page = 0 -- page #1 page = page + 1 PreludeBriefing[page] ={} PreludeBriefing[page].title = "Teller" PreludeBriefing[page].text = "Look, there are bandits out there, go get them!" PreludeBriefing[page].position = GetPosition("armyOne") PreludeBriefing[page].explore = 1000 PreludeBriefingShowarmyOne = PreludeBriefing[page] -- page #2 StartBriefing(PreludeBriefing) end function PreludeBriefingFinished2() ResolveBriefing(PreludeBriefingShowarmyOne) end function BriefingGuard() -- this contains all data for the briefing local briefing = {}; -- AddPage / AddShortPage functions, used to fill the briefing local AP, ASP = AddPages(briefing); -- ASP( _name, _title, _text, _dialog); -- _name: Script name of the target entity. camera will centered at this entity -- _title: Page title -- _text: Page text -- _dialog: set to true to move the camera closer, else just leave it out ASP("Guard","Guard","Ah,thank you! If you werent here on time they would kill me, god bless you!", true); ASP("Dario","Dario","Take a breath, tell us what happened."); ASP("Guard","Guard","Ok,im sorry but im really shocked. Lets get to the point.", true); ASP("Guard","Guard","Those barbarians attacked our village last month and they cut us out of any resources. They also burned more than a half of our village.", true); ASP("Dario","Dario","We will help you, but we need to know where is this village!"); show = AP{ tilte = "Guard", text = "Look right there, this is the problem I was talking about - the stones. We dont have any sulphur to blow them up, do you have any idea what to do?", position = GetPosition("Skaly"), dialogCamera = false, explore = 500, exploreTime = 1*12 } ASP("Pielgrzym","Pielgrzym","I think I can handle this.", true); -- just add as many pages as you need show = AP{ tilte = "Guard", text = " God bless! After you remove the stones, please go to our Mayor, he will tell you everything what we need!", position = GetPosition("Burmistrz"), dialogCamera = false, explore = 500, exploreTime = 1*12, } ASP("Dario","Dario","Allright people, lets move!", true); StartBriefing(briefing); -- starts the briefing (dont forget this) end function AddPages( _briefing ) local AP = function(_page) table.insert(_briefing, _page); return _page; end local ASP = function(_entity, _title, _text, _dialog) return AP(CreateShortPage(_entity, _title, _text, _dialog)); end return AP, ASP; end MakeInvulnerable("Guard") function CreateShortPage( _entity, _title, _text, _dialog) local page = { title = _title, text = _text, position = GetPosition( _entity ), dialogCamera = _dialog }; return page; end function CreatePreludeBriefing() PreludeBriefing = {} PreludeBriefing.finished = PreludeBriefingFinished page = 0 -- page #1 page = page + 1 PreludeBriefing[page] = {} PreludeBriefing[page].title = "Dario" PreludeBriefing[page].text = "Ah, finally here. The trip was really long, lets get some rest." PreludeBriefing[page].position = GetPosition("Dario") PreludeBriefingShowDario = PreludeBriefing[page] page = page + 1 PreludeBriefing[page] = {} PreludeBriefing[page].title = "Dario" PreludeBriefing[page].text = "Oh look, these people need help, move up, fast!!" PreludeBriefing[page].position = GetPosition("Guard") PreludeBriefing[page].explore = 1000 PreludeBriefingShowDario = PreludeBriefing[page] StartBriefing(PreludeBriefing) end function PreludeBriefingFinished() ResolveBriefing(PreludeBriefingShowDario) end -- Quest data MapEditor_QuestTitle = "" MapEditor_QuestDescription = ""
polaster64
|
#82 12.03.2018 17:27 Beiträge: 184 |
Zitat von Play4FuN:
Honestly, you aren't and you won't be the only one to learn the importance of backups the hard way...
And how do I edit resources? I want the sulphur mine to be "30000" not only "8000"
Qba331PL
|
#83 12.03.2018 18:25 Beiträge: 102 |
Mines
Zitat von polaster64:
Zitat von Play4FuN:
Honestly, you aren't and you won't be the only one to learn the importance of backups the hard way...
And how do I edit resources? I want the sulphur mine to be "30000" not only "8000"
You can change the value of the materials in mine in entity properties menu. The same menu where you change ID and script name of entity.
polaster64
|
#84 12.03.2018 18:33 Beiträge: 184 |
Zitat von Qba331PL:
Zitat von polaster64:
Zitat von Play4FuN:
Honestly, you aren't and you won't be the only one to learn the importance of backups the hard way...
And how do I edit resources? I want the sulphur mine to be "30000" not only "8000"
You can change the value of the materials in mine in entity properties menu. The same menu where you change ID and script name of entity.
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
Qba331PL
|
#85 12.03.2018 18:36 Beiträge: 102 |
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
W sumie to mozesz to po polsku napisac bo chyba nie do konca rozumiem co chcesz osiagnac
polaster64
|
#86 12.03.2018 18:48 Beiträge: 184 |
Zitat von Qba331PL:
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
W sumie to mozesz to po polsku napisac bo chyba nie do konca rozumiem co chcesz osiagnac
XD
No zeby forteca(kasztel twierdza nazywaj to jak chcesz xD) byla innym budynkiem np zamkiem folklung. Ale to nie wszystko. Chce jeszcze, zeby byla mozliwosc np zeby w tez w tym jednym zamku staly dwie wieze z armatami I np jedna wieza rozbojnikow i jeszcze jakis bajer. Nie mam pojecia jak to zrobic a strasznie mi sie to podoba.
polaster64
|
#87 12.03.2018 18:53 Beiträge: 184 |
Zitat von polaster64:
Zitat von Qba331PL:
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
W sumie to mozesz to po polsku napisac bo chyba nie do konca rozumiem co chcesz osiagnac
XD
No zeby forteca(kasztel twierdza nazywaj to jak chcesz xD) byla innym budynkiem np zamkiem folklung. Ale to nie wszystko. Chce jeszcze, zeby byla mozliwosc np zeby w tez w tym jednym zamku staly dwie wieze z armatami I np jedna wieza rozbojnikow i jeszcze jakis bajer. Nie mam pojecia jak to zrobic a strasznie mi sie to podoba.
I zapytam czy jest jakas skryptoteka do tej gry bo tak to latwiej by bylo nawet niech bedzie po niemiecku no ale.
mcb
|
#88 12.03.2018 19:41 Beiträge: 1472 |
Zitat von polaster64:
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
What exactly do you want? A PB_Headquarters1 that looks like Cleycourt castle?
Logic.SetModelAndAnimSet(GetID("hq"), Models.CB_CleycourtCastle)
changes the model of the entity hq (only works with buildings).
But upgrading it would create a new entity with its default model.
The other entities can be placed with CreateEntity. But they are still independent entities which can be destroyed without affecting others.
Qba331PL
|
#89 12.03.2018 19:54 Beiträge: 102 |
mcb napisal Ci o tej funkcji. Ona zmienia skorke podmiotu wiec mozesz sobie to w ten sposob zmienic. Z tego co wiem to to niestety podmieni ci wszystkie zamki (np. kasztele) na zamek np. folklung. Jezeli natomiast chcesz zrobic w zamku wieze to w edytorze stawiasz najpierw zamek, potem obok wieze i PPM przesuwasz juz gdzie chcesz(nw czy to o to chodzilo). Ten edytor rzeczywiscie jest czasem oporny no i nie pozwala na nakladanie rzeczy na siebie tak od razu. Trzeba najpierw postawic obok.
polaster64
|
#90 12.03.2018 21:47 Beiträge: 184 |
Zitat von Qba331PL:
mcb napisal Ci o tej funkcji. Ona zmienia skorke podmiotu wiec mozesz sobie to w ten sposob zmienic. Z tego co wiem to to niestety podmieni ci wszystkie zamki (np. kasztele) na zamek np. folklung. Jezeli natomiast chcesz zrobic w zamku wieze to w edytorze stawiasz najpierw zamek, potem obok wieze i PPM przesuwasz juz gdzie chcesz(nw czy to o to chodzilo). Ten edytor rzeczywiscie jest czasem oporny no i nie pozwala na nakladanie rzeczy na siebie tak od razu. Trzeba najpierw postawic obok.
wlasnie to tak nie dziala z tym przesuwaniem..
polaster64
|
#91 12.03.2018 21:49 Beiträge: 184 |
Zitat von mcb:
Zitat von polaster64:
How to create an entity like for example headquarters of player1 but instead of the real fortress there will be 2 robber towers and one Cleycourt castle and 2 cannor turrets. Is there a possibility to make it like that?
What exactly do you want? A PB_Headquarters1 that looks like Cleycourt castle?
Logic.SetModelAndAnimSet(GetID("hq"), Models.CB_CleycourtCastle)
changes the model of the entity hq (only works with buildings).
But upgrading it would create a new entity with its default model.
The other entities can be placed with CreateEntity. But they are still independent entities which can be destroyed without affecting others.
How does the create entity code look like?
And I've heard something about "replace" entity but I dont know anything bout this so It would be nice if you could show the example please.
mcb
|
#92 12.03.2018 23:15 Beiträge: 1472 |
CreateEntity(_playerId, _entityType, _position, _name)
and ReplaceEntity(_entity, _newEntityType)
Zedeg
|
#93 12.03.2018 23:17 Beiträge: 428 |
Please read "<shok game direction>\support\Manual\ScriptingReference.html". It contains many useful variables and funtions (such as CreateEntity and ReplaceEntity) explained in English.
____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski
polaster64
|
#94 13.03.2018 15:32 Beiträge: 184 |
Zitat von Zedeg:
Please read "<shok game direction>\support\Manual\ScriptingReference.html". It contains many useful variables and funtions (such as CreateEntity and ReplaceEntity) explained in English.
Oh my god, thanks very much!
polaster64
|
#95 14.03.2018 12:29 Beiträge: 184 |
Zitat von mcb:
CreateEntity(_playerId, _entityType, _position, _name)
and ReplaceEntity(_entity, _newEntityType)
function CreateEntity() CreateEntity(8,Entities.CB_Bastille1,GetPosition("kkk"),"") end Im not sure what should I put in the _name column, so I left it empty and I think thats why the entity does not spawn. What should I put in there?
Play4FuN
|
#96 14.03.2018 14:50 Beiträge: 704 |
You will have to leave it blank (or nil)!
"" is NOT empty, it IS something - an empty string is still a string and not nothing
Just use
CreateEntity(8,Entities.CB_Bastille1,GetPosition("kkk"))
to create the entity without a name.
____________________
LG Play4FuN
Siedler DEdK Mapping + Scripting Tutorials
polaster64
|
#97 14.03.2018 23:05 Beiträge: 184 |
Is there any way increase number of possible villagers in the village center?
I mean I upgrade the village center and the number of max villagers is doubled.
I have an idea that it might work like if is upgraded "villagecenter1"
then change player ("villagecenter4",1)
But I dont know how to call something like that.
Second problem is: Horseman.
https://imgur.com/a/FPIzE
Look here. How to enable those 4 options on the horseman? I mean both Light and Heavy Cavalry.
Play4FuN
|
#98 15.03.2018 11:15 Beiträge: 704 |
For the cavalry issue: this should be a simple task. In the selections.lua there is a function called GameCallback_GUI_SelectionChanged which is called automatically upon (de)selection a unit (and some similar triggers...)
The interesting part is this:
if Logic.IsEntityInCategory(EntityId,EntityCategories.Military) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.Cannon) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryHeavy) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryLight) == 0 and Logic.IsHero(EntityId) == 0 then XGUIEng.ShowWidget(gvGUI_WidgetID.SelectionLeader,1) end
So, if a cannon, cavalry leader or hero is selected, then the formation buttons will not be displayed.
Now the task would be to simply edit the function - in your map script of course - and leave out the condition that checks if a cavalry leader is selected. Thus, the game will display the selection leader which includes the formation buttons also when cavalry is selected. Last but not least I hope that the triggered GUIAction_ChangeFormation will also work on cavalry, but I guess so.
Hope that explanation helps
____________________
LG Play4FuN
Siedler DEdK Mapping + Scripting Tutorials
polaster64
|
#99 15.03.2018 12:36 Beiträge: 184 |
Zitat von Play4FuN:
For the cavalry issue: this should be a simple task. In the selections.lua there is a function called GameCallback_GUI_SelectionChanged which is called automatically upon (de)selection a unit (and some similar triggers...)
The interesting part is this:
if Logic.IsEntityInCategory(EntityId,EntityCategories.Military) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.Cannon) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryHeavy) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryLight) == 0 and Logic.IsHero(EntityId) == 0 then XGUIEng.ShowWidget(gvGUI_WidgetID.SelectionLeader,1) end
So, if a cannon, cavalry leader or hero is selected, then the formation buttons will not be displayed.
Now the task would be to simply edit the function - in your map script of course - and leave out the condition that checks if a cavalry leader is selected. Thus, the game will display the selection leader which includes the formation buttons also when cavalry is selected. Last but not least I hope that the triggered GUIAction_ChangeFormation will also work on cavalry, but I guess so.
Hope that explanation helps
I dont know if I understood it good but I did something like that.
if Logic.IsEntityInCategory(EntityId,EntityCategories.Military) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.Cannon) == 0 and Logic.IsHero(EntityId) == 0 then XGUIEng.ShowWidget(gvGUI_WidgetID.SelectionLeader,1) end
And I tell you that it does not work xD.
I also tried something like that
if Logic.IsEntityInCategory(EntityId,EntityCategories.Military) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryHeavy) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryLight) == 1 then XGUIEng.ShowWidget(gvGUI_WidgetID.SelectionLeader,1) end
Changed the 0-false to 1-true and it also did not work.
polaster64
|
#100 15.03.2018 12:40 Beiträge: 184 |
Zitat von Play4FuN:
For the cavalry issue: this should be a simple task. In the selections.lua there is a function called GameCallback_GUI_SelectionChanged which is called automatically upon (de)selection a unit (and some similar triggers...)
The interesting part is this:
if Logic.IsEntityInCategory(EntityId,EntityCategories.Military) == 1 and Logic.IsEntityInCategory(EntityId,EntityCategories.Cannon) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryHeavy) == 0 and Logic.IsEntityInCategory(EntityId,EntityCategories.CavalryLight) == 0 and Logic.IsHero(EntityId) == 0 then XGUIEng.ShowWidget(gvGUI_WidgetID.SelectionLeader,1) end
So, if a cannon, cavalry leader or hero is selected, then the formation buttons will not be displayed.
Now the task would be to simply edit the function - in your map script of course - and leave out the condition that checks if a cavalry leader is selected. Thus, the game will display the selection leader which includes the formation buttons also when cavalry is selected. Last but not least I hope that the triggered GUIAction_ChangeFormation will also work on cavalry, but I guess so.
Hope that explanation helps
I saw that working on the Stronghold Episode 2 map but the script is hidden from any edits - even on tinyscriptnvm.