Gleb Bazov
Warlord
- Joined
- Feb 13, 2017
- Messages
- 176
So, I've recently posted a small mod that creates a way to exploit and move over mountains in game in a regulated manner. No free-for-all, but only certain unit types can traverse the peaks.
Here it is: Mountain Movement & Exploitation Mod.
But I need suggestions and new ideas about some future steps I'd like to take. I would very much appreciate your thoughts.
I have since compiled a LUA script that achieves the following:
With civilian units, like settlers, GPs, etc., there is no issue - because they can't earn experience or promotions. However, with any military unit (like scouts or rangers) that this mod allows to climb the mountain, I face a dilemma. I can persist their promotions and damage points in the new unit without a problem, but the way the game's experience/promotions system is coded, it produces an unfortunate hiccup.
Despite getting x number of promotions up front, the new units are still treated by the game as brand-new units that had received no promotions. That is, the promotion are active, but, instead of having to earn x++ number of experience points for the next x+1 promotion, only 6 points are required. This wouldn't be a game-ending problem in and of itself (although it is quite ugly, there are ways to circumvent the problem by delaying the unit's experience progress using LUA), but a strange bug crops up in the game, where a unit that's given too many promotions off the bat has its promotion mechanic lock up. It stops being able to apply any new promotions and experience points it earns after re-creation, but still continues to earn them. This also might be a product of conflicting LUA codes that I am running in several of my active mods, but I doubt it.
So, here is my dilemma. I'd love to be able to code a way to prevent a unit from climbing the mountain, but I see no way of doing it using in-game scripts (there are ways, it seems, of doing it in the UI context) without the create/destroy process. And the process only works in an elegant way for non-promotion-capable units.
Thus, I have a choice: (1) implement the process as I have done, and keep trying to find a solution, (2) instead of pushing the unit back, only damage it if it climbs the mountain, or destroy it (and perhaps keep the original mechanic for the civilian units); or (3) keep the original mechanic and just live with the fact that the unit will lose all of its promotions (well, I can say that... heh... the unit was so damaged, that it forgot how to be a zweihander sword-wielder and everything else it learned
)).
OR, and I just came up with this: on the first go round, the first time a unit is damaged on the mountain, give it a chance of getting a "mountainclimber" free promotion that will keep it safe from any future mountain failure (so I won't have to ever re-create it again), and make that chance a 100% if a unit has at least one promotion (and keep it on the mountain instead of re-creating it).
Actually, I might just go with this
. BUT, please let me know if anyone has any other suggestions, I'd love to hear them!
Thanks for your attention!
Here it is: Mountain Movement & Exploitation Mod.
But I need suggestions and new ideas about some future steps I'd like to take. I would very much appreciate your thoughts.
I have since compiled a LUA script that achieves the following:
- Index and track through a table a roster of each player's mountaineer (unit capable of traversing mountains) units;
- Index and track each mountaineer unit's location throughout the game;
- Listen for and identify any instance when a mountaineer unit moves onto a mountain;
- By random chance either:
- allow the mountaineer unit to remain on the mountain, or
- damage the unit and push it back to the location where it started, before it tried moving up the mountain, and
- destroy the unit if it is damaged beyond 100 points;
- all the while maintaining the unit's promotions and damage points, if any.
With civilian units, like settlers, GPs, etc., there is no issue - because they can't earn experience or promotions. However, with any military unit (like scouts or rangers) that this mod allows to climb the mountain, I face a dilemma. I can persist their promotions and damage points in the new unit without a problem, but the way the game's experience/promotions system is coded, it produces an unfortunate hiccup.
Despite getting x number of promotions up front, the new units are still treated by the game as brand-new units that had received no promotions. That is, the promotion are active, but, instead of having to earn x++ number of experience points for the next x+1 promotion, only 6 points are required. This wouldn't be a game-ending problem in and of itself (although it is quite ugly, there are ways to circumvent the problem by delaying the unit's experience progress using LUA), but a strange bug crops up in the game, where a unit that's given too many promotions off the bat has its promotion mechanic lock up. It stops being able to apply any new promotions and experience points it earns after re-creation, but still continues to earn them. This also might be a product of conflicting LUA codes that I am running in several of my active mods, but I doubt it.
So, here is my dilemma. I'd love to be able to code a way to prevent a unit from climbing the mountain, but I see no way of doing it using in-game scripts (there are ways, it seems, of doing it in the UI context) without the create/destroy process. And the process only works in an elegant way for non-promotion-capable units.
Thus, I have a choice: (1) implement the process as I have done, and keep trying to find a solution, (2) instead of pushing the unit back, only damage it if it climbs the mountain, or destroy it (and perhaps keep the original mechanic for the civilian units); or (3) keep the original mechanic and just live with the fact that the unit will lose all of its promotions (well, I can say that... heh... the unit was so damaged, that it forgot how to be a zweihander sword-wielder and everything else it learned

OR, and I just came up with this: on the first go round, the first time a unit is damaged on the mountain, give it a chance of getting a "mountainclimber" free promotion that will keep it safe from any future mountain failure (so I won't have to ever re-create it again), and make that chance a 100% if a unit has at least one promotion (and keep it on the mountain instead of re-creating it).
Actually, I might just go with this

Thanks for your attention!