Quote:Version 1.5.4, I try to use GETCITYDATA to record farmer pop number or food number from ecofood.cas to use in ecogold.cas. For some reason, the function is not working properly. Number transfer from one script to another is not correct, and it also not update too. It keeps report number 2 except when I set it with integer or command, it could not report proper value set as factor reference.
I think there must be something wrong with SetCityData and GetCityData function, it could not retrieve accurate value. I have tried it several times and pattern of error seem like random for me, or it recalls wrong city ID.
I don't remember the exact order of dependencies but Unrest, Minimal Farmers, Farmers, Food and Gold do depend on each other as the game rules require it and the functions that calculate them call each other, some of them even more than once. So you might be reading and storing data through these scripts in an order different from intended.
I don't see any specific problem with the script functions themselves. Try logging the data you read/write and you might find where it goes wrong and which calculating function calls which other(s).
Thank you. Although I barely understand what to do for logging data, I will try.
Quote:It looks like Zypher found a rare bug in COM4Win: If an AI wizard gets banished while casting “Summon Champion”, the hero may end up among the player's units causing some weird game behavior and a small risk for crashing to desktop.
That does sounds pretty rare yes, as it would require a banished wizard to get a turn and successfully cast a spell other than the Spell of Return somehow.
I can confirm the hero offer for hire code immediately exits for banished wizards, so that can't be the origin of the problem, however wizards immediately have their "currently cast" spell to Spell of Return as well.
If the spell already cast but not resolved for the current wizard would be the culprit, that would mean the wizard somehow manages to get banished during their own turn which is also impossible.
It also shouldn't be possible to fail casting the Spell of Return unless the mod somehow affects spellcasting (not sure if that's even possible to do though did I ever implement effects to counter spells?).
I'm going to need to test this, please post a download link to the correct mod version and save file (the turn when the summoning spell is being cast), also to save time, please confirm the banished wizard really is casting a summon champion spell (by using Detect Magic).
I dug up the used mod version and attached the link here and two save files from Zypher:
Turn76 it is possible to start casting “Detect Magic” to see that Tlaloc is casting "Summon Champion". He is already banished Turn78 and a common hero with Tlaloc's color appears in or near Trier on the other plane.
Copied from the other post:
“For me, the foreign hero from Myrror did not always appear within the city of Trier. One time he was inside a nearby stack. Like this it was not possible to read the hero stats. I checked and Tlaloc was already banished Turn78, but he had no heroes and I could not find his Summoning Circle. It would not be visible when sitting in an Outpost, but maybe he just didn't have one. Next turn, Tlalocs Circle appears in the Hamlet of Cemetery. Did he get banished Turn77? If so, maybe there's something wrong with the order in which things are done in the base game? What else could it be?”
Another bug or oversight:
Hadriex recently noticed during a stream that the turn countdown for "Spell of Return" was not working for the player. In Vanilla, when you press the Spell button, text with a red background shows how many turns it is expected to take. In COM4Win only the first number is displayed throughout the entire period, so the player has to calculate for himself. It is kind of odd that no one seems to have noticed it until now. ;P
Quote:Do you mean that it is a bug you don’t understand why it happens?
No, I mean it should be working as intended as the data in the file is correct, unless there is a global bug that affects unrest calculation globally which would be extremely unlikely. If you can find such a bug, I'll investigate.
Quote:Hadriex recently noticed during a stream that the turn countdown for "Spell of Return" was not working for the player. In Vanilla, when you press the Spell button, text with a red background shows how many turns it is expected to take. In COM4Win only the first number is displayed throughout the entire period, so the player has to calculate for himself. It is kind of odd that no one seems to have noticed it until now. ;P
Confirmed, it used the spell's base cost instead of the remaining cost. Fixed for the next update.
Quote:Turn76 it is possible to start casting “Detect Magic” to see that Tlaloc is casting "Summon Champion". He is already banished Turn78 and a common hero with Tlaloc's color appears in or near Trier on the other plane.
He is being hit by a rampaging monster stack on turn 77.
He is banished by them as expected. He starts casting Spell of Return as expected.
Nothing abnormal happened that turn or the turn after and he was not casting a summoning spell for heroes. This was the turn76 save file.
Trying again with the 77 one.
He is casting Sprites that turn. No Summon Champion. Considering it's this early in the game, I doubt he has the spell unless the cost or rarity was modded.
This time her didn't get banished and defended his city. Trying to run the last turn again.
Now he was banished. No abnormal unit in my fortress nor Trier still.
Most importantly, Tlaloc has no heroes. He did have one Beastmaster but that hero should have died while defending his fortress city.
If I had to guess, this might be caused by the hero somehow getting turned to undead and raised by the monsters (but the code explicitly says heroes can't do that, I just checked)...
Except that's also not possible as the hero in the bug report that appears is the Amazon.
I checked just in case, Tlaloc does not know neither the Summon Hero nor the Summon Champion spell.
Which is good news as it means there is no bug that makes banished wizards cast spells (which would imply a global turn order or equally severe problem) however it also means I have absolutely no idea where the hero came from as it doesn't appear when I replay the turn on those files.
...oh post below said the hero appears on turn 78. Downloading turn 78 save file then, I guess trying 76 and 77 was wrong.
Tlaloc should be already banished this turn.
Replying this turn, still no enemy hero in Trier.
Did you use the "Everyone gets every spell" debug code to access detect Magic? If so, that's how Tlaloc got Summon Champion but as he wouldn't have had the spell otherwise, it can't be the source of the bug.
Might need a different approach for this.
Loading the turn 79 save file. Look through the unit data array. The buggy hero is unit 1193, near the end of the array implying it's likely a newly created unit. Yep, previous turn the game only had 1188 units.
So we at least know it's a unit being created that turn, but where it's coming from I have no idea.
...hmm okay so next attempt the hero showed up but it's a Magician this time, same tile though. In slot 1188. Same location, owner is Tlaloc again.
I'll try placing a breakpoint in the new unit function and run the turn that way. Oh and add a condition that the unit must be Tlaloc's.
Bowmen...
Swordsmen...
unit 18, that's a hero, there we go!
What called this?
CombatEnd, AwardLairTreasure.
So it's a hero as a prisoner.
How does it end up on that tile...this should be unrelated to summoning circles.
Creation position : plane 1, x 33, y 45
Combat location is plane 2, x 22, y 10 though.
Oh... AI players receive their prisoner heroes at their fortress...and he has none. There we have the bug. I guess that was set up this way because the AI doesn't know how to "return" their found heroes to the fortress and the AI heavily relying on the best heroes guarding the fortress at all time. Allocates items based on the assumption the good heroes stay there and don't end up unprotected without armies, too.
idk if we really want to keep this "feature" though, it's kinda cheating, especially now when the game no longer has Recall Hero or equivalent.
On the other hand, a trivial AI stack suddenly getting a top tier hero out of nowhere, which immediately gets equipped by the best items that were in the fortress garrison originally, in the middle of the player's territory, might not be the healthiest for the game either. Next turn that "doomstack" hero will likely attack the player's nearest city and either succeed or "bleed" the items into the player's treasury instead, both pretty awful and unfair outcomes.
No, I think the AI shouldn't cheat. A powerful AI hero spawning is fair punishment if the player didn't clear their lairs. Ideally the army that cleared the lair should also be there so the hero won't be too defenseless. Champions don't appear in lairs either so it's not that likely the AI brings their best items over for that hero, Beastmaster being the main exception I guess.
Quote:Do you mean that it is a bug you don’t understand why it happens?
No, I mean it should be working as intended as the data in the file is correct, unless there is a global bug that affects unrest calculation globally which would be extremely unlikely. If you can find such a bug, I'll investigate.
As I said, I think I found such a bug. HM rebel at +2. For example, HM under HM rebel at same rate as KL under Orc. Both at +2. I tested for POP 1 through 12. Perfect match. Do you need a pair of save files to show you?
Ok, if you insist, I'll check the unrest calculation with debug just in case.
The race unrest table in memory contains +1 for [8,8].
The script variable Raceun is set to +1 in memory.
The only line that uses this value in the unrest script is this one :
UNPERC=UNPERC+(RACEUN*10)
which adds 10% for each +1 in the variable.
I believe that's enough proof of there being no such bugs.
If you don't believe it, add some Debuglog lines to your unrest script and check directly.
Did you change your EcoUnrest.CAS file? That's the only possible reason I can think of why your result is different.
Edit : Also looked at the city data just in case. The pop 5 starting city with 0 garrison units has 0 rebels at 19% total unrest (10 from race and 9 from taxes), raising the tax rate by one (28% total) creates one rebel. Raising it to 2 gold for a total of 46% unrest generates 2 rebels.
All of these data match the base unrest value of 10%.
Quote:Hereby I request an option to turn it off. I had a situation I wanted that to happen so I can raise it as undead.
I considered the possibility to implement this but realized quickly why it's not in the game : it's impossible to implement.
The owner of unit enchantments is not stored anywhere in the data. On the overland map, there are no unit curses so any spell on your unit is yours and you can cancel it. However in combat, units can change control, which makes it impossible to determine which spells are yours and which were cast by the enemy.
I found bug with city event flag "Plague". City event flag of "Plague" does not remove after "Plague" had gone from the city. I found this after one of my players send me save game about how Plague debuff trigger even after plague event has gone already.
In this save that must be loaded on Warlord mod version 1.5.4.2, raiders attack city of Stavenger in this save and garrison suffer from plague debuff that should not be there anymore due to Plague event has already ended.
I detect plague in the city with this script "((EVENTVAL(EvPlague))=C)"