Free XP or promotion level from barracks possible?

From further testing it appears the unit "Builds" in UnitPanel persist even after the unit takes all of the granted promotions, although these extra mystery builds in the Unit Panel don't seem to be reflected in actual additional builds for units like the Legion, or in being able to do anything "build-like" with a unit that has no builds associated with it in the game's database. The game may however treat the unit as being able to repair pillaged or damaged tiles but at the moment in the test game I am running I have no tiles available to test whether this last possible issue exists as a result of the promotion-granting from the lua script.

I have to wait two more turns before I can declare war on annoying Canada and pillage some tiles so I can see if this last issue is actual or merely an annoyance in the UnitPanel file.
 
Apparently there is also an exploit available built into the code where you can upgrade the unit and get additional promotions if you upgrade the unit on a city or encampment plot. So for this lua method there's some more thinking required to make the code not re-execute when a unit is upgraded.
 
LeeS, in your example script in OnUnitAddedToMap function you check if the unit is dead. Does this really happen or it's just a precaution?
 
It is mostly precaution. Game hook events fire in specific orders and it may be possible for some other "thing" in the gamecore to kill the unit as soon as it is added to the map but before UnitAddedToMap sends out data to functions assigned to it. This was a thing with certain event-hooks in civ5 so I just learned to use the precaution so the code does not otherwise attempt anything for a unit that is already dead or that the gamecore has determined is to be killed off but has not yet been killed off (which can actually happen in Civ6).

When running through for k,pUnit in Players[PlayerId]:GetUnits():Members() do you need to check whether the unit is dead or is delayed death because such units still will be listed as "Members" of "GetUnits()" and then the rest of your code will fail if you do certain unit-methods like trying to get the plot the unit is on because even though the unit is bogus it can show as a member but its XY location will be -9999,-9999 as I recall, which will give a nil value for a plot, and then cause the rest of the function to result in a runtime error.
 
Hey @LeeS ! Have you got the code to work properly?

Someone in a Thread had an Idea about giving Units a Free Promotion if that exact promotion has been promoted by a Unit. For example, if a Unit gets a Promotion via experience then the Player should have the Ability to build that exact UnitType with the Promotion earned. Because the Player already has 'discovered/earned' the Promotion, therefore, he should have that promotion for all units of the same Type avialable. Like you can't build a Unit with no promotion if you have already earned a promotion, since the player should had researched that promotion and hence should be aible to apply it to all other Units of the same Type as the one that has earned the Promotion. Otherwise, it would be just a self-handicap/sabotage to not use the Promotions earned for the following Units to be built.

And it would be better to make this happen via Encampment Buildings, and that too to certain UnitTypes only. For instance, Only a Stable can make those Promotions available for Light/Heavy Cavalery...etc.

I don't know if this would make Units too OP, but it would make Training Units more realistical, say evolving not going Backwards.
 
Top Bottom