Disband Troop Crash

正在查看此主题的用户

Seven Devils

Regular
That bug some of you are getting where the game crashes when you try to disband the last troop...


..is caused by you having too many troop types.

I'm not sure if its hero types or not, but I had to get rid of horse merchants and a bunch of other junk to make room for new troops in my mod.

Oh and all the villages you add as a troop need merchants too that was another time I hit the maximum number of hero inventories allowed or something hehe

I always know if I hit the limit 'cause the first thing I do is go into the game and disband all my troops and make sure I don't crash if I change how many different kinds of guys there are in there or how they upgrade (I'm not sure if its how many entries it is in there or what, its some index that can't go high enough, there might be more tricks and loopholes in there that I don't know about, heck there might be some way to fix it that I don't know about, but that's how I keep it from happening, I cut down on how many kinds of troops I got in troops.py).

If you play the game with that messed up (by ignoring the error) I think mebbe you'll find you have other problems later on I'm not sure I'm sure I've tried it and then I went back and fixed it but that was a long time ago heh.

Its the one limit I gotta worry about, if I wanted to add a seventh kingdom, I'd have to add too many villages with merchant inventories and be over the limit.

I could rearrange how many villages everybody started out with and cut a seventh piece of the pie, but I can't make the pie any bigger or add any cherries to it heh.

I dunno if non-hero troop types count toward the limit too I'm not really sure if there's some subset of the troop file that is exempt from that limit but it seems that hero inventory troops definitely count towards fixing it.
 
Seven Devils 说:
That bug some of you are getting where the game crashes when you try to disband the last troop...


..is caused by you having too many troop types.

Are you sure? Well, I haven't had that bug. And I don't have a lots of new troops (only 32 new entries).

I don't think that there is a limit for the number of troops you can define in module_troops. However, any troop that is linked to an upgrade tree must be among the first 256. The header_troops defines the upgrade limit to be 256. I try to up the limit to 512. I have not have any problem so far.
 
I hit the limit after adding about 4 new cities (with the three kinds of merchants), eight more or so villages (well, village merchants), and 10 knights and a new king, and maybe 20 or so other things (with the new troop trees and bandits I add).

So its well below the 512 limit heh.

My game was crashing whenever I disbanded all my troops right after making a character and I thought I had a typo somewhere in my troops file so I started commenting out whole sections to narrow down the search area for the typo and that how I figured out that it was actually the number of troops that was making that crash happen.

I was turning off merchants to make room and that worked I dunno if its really specific to merchants in the troops file though.
 
If you have a code that can cause / uncause the crash reliably then you should forward a download link to Armagan, they'll fix it.
 
I have added probably about 30-40 troops, 4-6 kingdom heroes but took about 4-6 away(took them out of 1 faction and added new ones to different factions), about 6-10 new companions, and 3 new quest npcs, and I have not run into this problem.  Strange.  I haven't added a merchant for my new village either but I havent tested to see if I can buy from that village yet.
 
It looks to me like the first guy was saying, where there's a pointer that can't go high enough, but its above 256 and below 512 so I dunno mebbe its a positive negative thing or the mazimum size of the merchant inventory array or something.

My source is up on mbrepository I think you can pretty easily reproduce the bug just by uncommenting all the horse merchants (which are all well after the 256 upgrade tree guys) and loading my mod and disbanding the troops I give you, it should crash as you disband the last troop.

I don't actually have a problem with this anymore because I know I'm right at the limit so if I add something new I get rid of something else (and then I load up the game and make sure I can disband without crashing), there was somebody else who had this bug so I figured Id write up my experience with it.
 
My 256th troop is "kingdom_3_lord_daughter".  I still have to go through all the kingdom ladies, seneschals, arena masters, armorers, weaponsmiths, tavern keepers, merchants, horse merchants, village merchants, the chests, the temp arrays, and my 3 quest npcs.  The amount of troops I added was a guess.  When counting my troops, I noticed that I had added over 10 companions and I dont really have an idea on the amount of troops I added, but I redid the troop tree for 4 factions and I kept all of the original ones in.

Edit: I have 433 troop entries.
 
Sunhawken 说:
So what is the limit?

The limit is 512 (I am guessing since the max upgrades for troops is 256).  I added 120 troops so I had 553 and the game crashed after disbanding about 4 troops.
 
fisheye 说:
We need to petition to get it increased. 512 troops fills up so fast.

That or may be split into 2 files:

- Troops: including all soldier, heroes, lord.
- Agents: all merchants, tourney master, town walkers,...
 
Ok it's NOTHING to do with the 512 limit (of course).

Currently for my mod:

429 troops: crash
424 troops: ok

Can't be bothered to pin down the exact number.

I guess what's happening is that when the last stack is disbanded the "current stack" pointer is not removed so it's pointing to some random memory location. Somehow having more than 428 troops causes a whitescreen. This is obviously not as designed.


EDIT: ... it's the number of hero troops that's causing this. I just got 424 troops but it still crashed.

EDIT: ...nope not heroes either. seems random.
 
Hmmm.  I had 433.  Maybe it is random for each computer?  Maybe it is dependent on something else like Hellequin stated here: http://mbx.streetofeyes.com/index.php/topic,848.0.html
Or maybe I miscounted.  I knew I should have gone through to try find the exact number, but I didn't want to take the time.  It would be something though if I have the max amount of troops for me and didn't know it lol  :shock:.  If had gone over I would never have figured it out (except there is this post here so now I know what the problem is if I run in to this problem).
 
I just tried a bunch of various combinations of troops and heroes and it seems completely random.

Basically adding any number of troops may cause the error.

It just screams MEMORY LEAK to me which means there's no point trying to work around it because it's basically random. We have to wait for .895, there is no choice.
 
Suggestion for those people modifying Native:

Get rid of the kingdom ladies. Those guys starting from kingdom_2_lord_wife onwards. Frees up about 10 or so slots which really helps if you're on the edge. You'll have to comment out some initialization code which refers to them too.

I made my mod work by doing this.
 
后退
顶部 底部