Multiple upgrades for units ?

Kelem

Chieftain
Joined
Jun 29, 2012
Messages
4
Hi all,

After searching for a while, I didn't find any answer about multiple upgrades for units, like in Civ IV. Personnally, I prefer few troop trees than several troop lines, so I would like to implement this kind of feature. Anybody already worked on that here ?
It seems that I need to :
- modify sql tables to reflect multiple choices for unit evolution, Unit_ClassUpgrades, at the moment when several rows have the same UnitType, all seem ignored except the last one.
- modify UnitPanel/small.XML and UnitPanel.lua, to allow players to choose when units get enough XP, by adding items in the secondarybutton area, or adding a third section.
- modify AI files to allow the same for AIs ... later.

Any other ideas ?
 
Hmm, maybe I didn't explain correctly what I would like to implement.
AFAIK, in Civ V, there are only troops lines, like Warrior -> Swordsman -> Longswordsman -> Musketman ...
I would like to implement troops trees like in Civ IV :
Warrior -> Swordsman -> Longswordsman -> Musketman ...
...............................-> Spearman -> Pikeman ...
...........-> Archer -> Composite bowman ...
.........................-> Crossbowman ...
...........-> Horseman ...
Few steps to do this :
- adding rows in Unit_ClassUpgrades, by XML, easy.
- looping through GameInfo.Unit_ClassUpgrades to find how many upgrade types exist, easy.
- modifying the UI to allow players to choose between upgrades, I'm at this point now, adding a third stack to UnitPanel.lua/XML, I never modified UI so it's a bit confusing, any hints/tuto would be appreciated.
- adapting the AI, another big challenge, not so hard but long, later then.

Thanks in advance for any ideas about managing UI.

PS : Seems weird that nobody already works on that.
 
PS : Seems weird that nobody already works on that.

The main reason that no one's working on it is that it can't be done with the tools we have, just like a lot of other brilliant ideas people have had. The problem isn't in making it possible for the human player to do something, it's in making the AI NOT use its existing logic, and making the XML accept multiple values for something that was designed to only accept one value.

Once we have the DLL then anything will be possible, but until then I'd guess you're out of luck.
 
Hi Spatzimaus and thanks for your answer,
it's in making the AI NOT use its existing logic
Damn, it seems that modding is not as easy as in Civ IV.
But, would it be possible to "force" AI upgrade decisions using certain events, for example :
- OnActivePlayerEnd : looping thru all units, testing for each AI unit if it is able to upgrade, if yes choosing one according to flavor/strategy. Problem is when an AI discover a new tech, I don't know how AI proceeds to do it's upgrades, it doesn't seem to be automatic because we often see obsolete units. But, on the turn of the discover, AI would be able to upgrade on an undesired way.
- I saw the event PlayerPreAIUnitUpdate, in GameEvents, but I don't know how it works and when, maybe it could be interesting to investigate, hook it to manually test for upgrades.
The idea would be to bypass fixed AI behaviors for upgrades.

and making the XML accept multiple values for something that was designed to only accept one value.
I just tried to add multiple rows in Unit_ClassUpgrades with the same UnitType, looping in GameInfo using FireTuner gives correct multiple results, so it's possible to softcode multiple upgrades, for players at least, I think.

Once we have the DLL then anything will be possible, but until then I'd guess you're out of luck.
Optimism or realism ? :D

Btw, thanks a lot for your mod, really nice one, I played it few months ago and it really enjoyed me. I had found a little bug in the last era, IIRC, I launched transcendance but cities produced so much food, with building bonus, that they never decreased, so transcendance never achieved :lol:.
 
Some thoughts :
1- Though not impossible, alter AI for unit upgrades seems too much dependent on future expansions/patches that could corrupt it, just look at some mods that will not work with G&K. So, better to leave it.
2- Keep the troop lines upgrades for AI and block troop building for the player either by giving a special building requirements for all troops, except workers/settlers/conscripts, specific to AI, or with a special project requirement specific to AI.
3- Player troops build only with upgrades, managed manually, i.e. a new sql table to allow multiple upgrades, a new UI for troop upgrades. So a player can build conscripts in a City, for example, then at level 2 with a barrack in a city, he can upgrade his conscript to a warrior, then, at level 5, with other specific buildings, he can choose to upgrade his warriors to archers/swordsmen/spearmen/horsemen, ...

With the really good tutorials of Whoward69, thanks a lot to him, I think making this kind of UI should not be so difficult. About the -2-, 2 possibilities for AI :
a- having a specific building requirement for almost all troops, onCreateCity for AI automatically build it, onCityCaptured for active players destroy it and for AI build it if it doesn't exist.
b- having a specific project requirement, no need for special city management, but I don't know if loosing capital could have special side effects with projects.

Any thoughts about that ?

PS : My longterm idea is to work on a total conversion like FfH or MoM.
 
Top Bottom