Unit type limit? Invisible units causing crash upon scenario load

rhettrongun

Prince
Joined
Mar 19, 2011
Messages
341
Location
TX
This is a long explanation of a strange issue, so bear with me please.

I am working on a scenario mod that has a very large number (~20-30 range) of unique units (unit class overrides). This method of adding in units seems to work great for me, as it appears to be easier than adding in actual new units. Adding completely new units has given me trouble, so I gave up on it for now.

Anyways, I recently added an override for the missile cruiser that frontloaded in 11 new units to my units.xml sheet. It seems like a dumb/inefficient way to have gone about adding in the cruiser units I wanted, but that's besides the point. This effectively moved down 11 old units that I had already added in and verified to be working in game.

So, I added the cruiser units I wanted into the scenario via Worldbuilder and went to load up the scenario for a test run. The game crashes a few seconds after starting the game. ie. it has just enough time to show the DOM screen before crapping out.

I went back to mod buddy to check for errors/etc and didn't see anything wrong. I then went into worldbuilder to check for errors on the map, and found the first sign of the cause. 9 of the old units that were moved down from the missile cruiser add no longer appear as unit icons on the map. They're basically invisible.
Coincidentally these same 9 units are all in order at the bottom of my "<Units>" section in my unit.xml sheet.

I'm fed up with this at the moment:mad:, and will take a break from it until sometime this weekend. For now I am wondering if anyone else has encountered a similar problem, whether there is some hard limit on number of unit types, or something along those lines.

My thought is to take all the missile cruiser uniques and compress them down into a single update on the vanilla cruiser. If that doesn't work then I'll just see if axing the missile cruiser changes completely fixes things.

Any help/advice is welcome.
 
I can be wrong, but if you're adding new units in WB, then add more new units to your mod, add them in last position.

My guess is that the unit IDs has changed when you moved them down adding the new ones first, and then the WB/map loading didn't handle that change.
 
I can be wrong, but if you're adding new units in WB, then add more new units to your mod, add them in last position.

My guess is that the unit IDs has changed when you moved them down adding the new ones first, and then the WB/map loading didn't handle that change.

That sounds like it could be the culprit, as I have seen this happen on a small test map I made earlier. Once again it was after I tried to front load new units into the sheet. I never really figured out the cause for that 1 and ended up just junking the map.

But upon further review, I found the new units I had tried to add had become invisible and causing a crash. I eventually swapped them out for other units, which perhaps unwittingly solved any problems they were causing on my main map.

So, I'll probably just go ahead and compress the 11 units into a single updated cruiser. This should make for less clutter and fix the unit ID issue too.

Thanks for pointing me in the right direction.
 
A word of caution to everyone else to avoid making this same mistake. Apparently this can ruin a map beyond repair. At least that is what I'm finding.

The mod runs fine on test maps, but attempts at loading it with the scenario map are met with the same old crash. This is after I must have spent a good 30 minutes or so scouring the map for some stupid invisible unit somewhere.

Fortunately I have another incomplete map I was planning to convert the scenario to anyways, so it's not a complete kick in the face.
 
The best advice would just be to always add new units to the mod after the existing ones. This means you can't control the UI order of the units as much as would be good, but then using ID for that is mad in the first place (criticism of game's UI coding).
 
The best advice would just be to always add new units to the mod after the existing ones. This means you can't control the UI order of the units as much as would be good, but then using ID for that is mad in the first place (criticism of game's UI coding).

Agreed. I did find a way to get a botched map back to working order at least. It comes down to simply locating every last invisible unit on the map. Obviously it helps if you have a general idea of where they might be. If you have no clue then it might be almost impossible to find them.
What I ended up doing was switching the cursor to the edit unit option and then continuously clicking while moving the cursor over areas I suspected. I found about a dozen or so units that were causing the scenario to crash this way. It wasn't exactly fun to do, but I managed to get it back to working. This really made me wish World Builder had a feature like "clear all units", or perhaps a find unit feature.

So, things to take from this are:
-Never front load new units into a mod you're building
-If you know a mod works & you get a scenario CTD seconds after trying to launch it, you could have invisible units on your map.
 
Another problem may be an incorrect unit art define - this caused a crash when I added a new unit.
 
Top Bottom