Could you give a short overview of how the leach works?
In particular, is it possible to set one unit to be another ones leach point?
Leashes currently do NOT allow leashes to other units. That will be added, however, and will be used for Summons (and possibly Commander/Minions, at least for the AI). Aside from the cases where it is forced (again, Summons), it will require python to apply. Not something you can do via a promotion.
As for the rest:
There are only two leash tags, iLeashRange and iLeashChance. Both are only accessible via promotion (if done on the unit it can NEVER be removed, chose not to add that. Can accomplish it with promotions anyway)
iLeashRange is the standard tag. It is used for exact leash ranges; Ex: Mana Guardians. Tag accepts anything from 0 on up (0 imitates Held, but allows attacking!).
iLeashChance is the random tag, used to apply a variable leash range. Ex: Acheron. Currently has an issue with removing them, will be fixed. Leash will chance each turn, anything from 0 to the value listed in the tag.
The two tags cooperate nicely, as the randleash is maintained in a separate variable. When a unit gains it's first leash, the plot it is on becomes it's leash plot. This is generally also it's spawn plot, but does not need to be. If a unit has lost all it's leashes, and gains a new one, the new plot becomes it's leash plot. If it already has a leash, the ranges stack (leash 1 + leash 1 = leash 2).
Leashed units may only move within their leash range, but they may attack up to one tile past that range. If a leashed unit ends up outside it's leash (teleportation, blind, etc) it is able to move back towards it's leash, but nowhere else.
That should be it.
Something with my module is causing a CTD while loading. I have been debugging it for the last day and some more but I have no idea what it could be.
The CTD is the standard windows error message and no CIV message so it is of no help.
The CTD first appeared when I included two new units (the last ones in the PPQ_CIV4UnitInfos.xml). But when I remove said units, the CTD still appears so it can't be them.
I honestly am lost as to what could be happening. It worked fine one moment and threw up an error the next.
Here is the module, maybe some of you have an idea what is wrong.
PS. I forgot to say that removing the custom PPQ_CIV4UnitInfos.xml file altogether fixes it. But nothing inside the file it self seemed like it was causing the problem so I ignored it.
Edit: I just dug through the whole thing again I have found the XML causing it.
This:
If I remove said tag, the game works. If not I get a CTD.
But the code is way old (a week at least). And all that time it worked perfectly.
I mean, how can a peace of code that worked perfectly just a day ago suddenly bug up?
I am an idiot. Took me 24 hours to find that I had missed a >
Problem solved.
I've done that before.
For instance: Been trying to figure out for a few days now why spawngroups were not spawning for the barbs. The isSpawnGroupValid and createSpawnGroup functions both worked, tested them with python.
Finally got down into the code and stepped through the entire barb creation code, line by line, with the game running so I could see what was stored in each variable.
Noticed that it failed on isValid each time, even though I tested that. So stepped through that function too.
Noticed that it failed on the tech requirements. Suddenly realized that
every spawngroup I've defined thus far required the barbs to have a tech. There were no early spawns, so I was seeing no spawns in my tests.