miniMAXIme: Character scaler and selector

by Pi-C

The player stands like a giant near the vehicles. Now you can adjust the size of your character -- and you can change your appearance at any time if you've other mods that provide extra characters!

Tweaks
6 months ago
0.16 - 2.0
36.2K

b [Fixed?] Error

8 months ago

Error loading mod: Error while loading entity prototype "_f42f38fb_b84e_4b34_8fd8_70cce8873d5b" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse._f42f38fb_b84e_4b34_8fd8_70cce8873d5b
Modifications: Des, the Wickerbeast (Lexxy's 2.0 fork) › miniMAXIme: Character scaler and selector

8 months ago

I can't reproduce that. Are you using SA? Can't test with that as I haven't bought it.

By the way, it seems Lexxy's fork is now obsolete as the original mod has been updated for Factorio 2.0. Does the error occur with that mod as well?

8 months ago

Hi. Yes. I'm using SA.

I replaced Lexxy's fork with the original as suggested, but I got a different error now:

Error loading mod: Error while loading entity prototype "character-corpse" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse.character-corpse
Modifications: Mod base › Space Age › Tidy Menus › Metal and Stars › Des, the Wickerbeast

8 months ago

Could you enable the debug setting of the character mod helper and post factorio-current.log? If you're on the forum, you could PM me and attach the file.

8 months ago
(updated 8 months ago)

My version isn't necessarily "obsolete" exactly... it's just designed for my friend group :P

I believe this error is actually caused by the metal-and-stars mod ("Metal and Stars" in English). In the file prototypes/entity/prototype-mech-armor-animations.lua on line(s) 136 or 137 maybe, the mod adds a new character corpse picture to the base character corpse prototype, which breaks all CharacterModHelper skin mods that have their own corpse - including the Protogen skins(s) (and others) - because the CharacterModHelper characters are missing a picture for the new corpse state. minime ("miniMAXIme") partially obfuscates the error when installed but doesn't cause it.

For my version of the mod ("Lexxy's Fork"), this is something I probably won't fix.

Related:

8 months ago

My version isn't necessarily "obsolete" exactly... it's just designed for my friend group :P

Sorry if I was mistaken about this. I noticed that you didn't deprecate your mod, but it didn't show up when I searched the mod portal. Not sure whether I turned off mods with the tag "Internal" myself or whether that is the default setting, but I thought you'd have used that tag to hide the mod. Also, you redirect people to the original mod on your info page, so that let me assume your mod was obsolete. But as it isn't, do you want me to add a dependency on it to miniMAXIme?

I believe this error is actually caused by the metal-and-stars mod ("Metal and Stars" in English). In the file prototypes/entity/prototype-mech-armor-animations.lua on line(s) 136 or 137 maybe, the mod adds a new character corpse picture to the base character corpse prototype, which breaks all CharacterModHelper skin mods that have their own corpse - including the Protogen skins(s) (and others) - because the CharacterModHelper characters are missing a picture for the new corpse state. minime ("miniMAXIme") partially obfuscates the error when installed but doesn't cause it.

Thanks for figuring this out! One question: What happens when you remove those lines from prototypes/entity/prototype-mech-armor-animations.lua? Do you get an error regarding the character graphics as well?

For my version of the mod ("Lexxy's Fork"), this is something I probably won't fix.

I think the problem should be addressed in the character-mod helper. Your mod already calls its function check_my_prototypes, so if I'd adjust that function you wouldn't have to do anything at all on your end.

I suppose the thing to do is to check whether the new corpse has as many pictures as the default corpse (before things are copied). If the new corpse has less pictures, copy the last one as many times as necessary.

8 months ago
(updated 8 months ago)

Quick note: I don't have a lot of free time due to the ongoing war(s) so I may not be quick to respond, but I really love your mod, and all the other character mods that you've made possible/easier :3

Also I'm not super good with words so the following may not be organized super well or make a lot of sense, sorry...

Disabling either line 136 (table.insert) OR line 137 (setting .mech-armor to the length of .pictures) allows the game to load without erroring, and even allows starting a new game. I haven't tested all/any of metal-and-stars's gameplay, but dying also functions normally. I believe this is due to the fact that the value of .armor_picture_mapping.mech-armor that CMH copied to its characters' corpses no longer exceeds the length of the new character corpses' .pictures array.

So I made a small change to your CharModHelper.create_prototypes function:

    local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"])
    CharModHelper.apply_properties(corpse, prototype_data.corpse)
+   prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping)
    data:extend({corpse})

This stopped the error and allowed me to use mini-me, the Protogen character, and the Wickerbeast character, but will break any characters that define their own .armor_picture_mapping arrays (currently, only the imaginary one I just made as far as I know). I'm not necessarily a huge fan of the idea of inserting extra entries into the corpes' pictures array just to match the length of the character corpse generated outside of CMH characters, because semantically that doesn't make a lot of sense. The .armor_picture_mapping for each character probably needs to be stored when they call CharModHelper.create_prototypes...

To ease my concern with the currently-hypothetical case where a character defines their own .armor_picture_mapping, I think an if might help...

    local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"])
    CharModHelper.apply_properties(corpse, prototype_data.corpse)
    if prototype_data.corpse.armor_picture_mapping == nil then
        prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping)
    end
    data:extend({corpse})
    CMH.created_msg(corpse)

Seems to work for me! Dying with mech-armor equiped also functions without errors.

7 months ago

Quick note: I don't have a lot of free time due to the ongoing war(s) so I may not be quick to respond, but I really love your mod, and all the other character mods that you've made possible/easier :3

Thanks for the compliment! :-)

So I made a small change to your CharModHelper.create_prototypes function:

diff local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"]) CharModHelper.apply_properties(corpse, prototype_data.corpse) + prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping) data:extend({corpse})

This stopped the error and allowed me to use mini-me, the Protogen character, and the Wickerbeast character, but will break any characters that define their own .armor_picture_mapping arrays (currently, only the imaginary one I just made as far as I know).

Makes sense.

I'm not necessarily a huge fan of the idea of inserting extra entries into the corpes' pictures array just to match the length of the character corpse generated outside of CMH characters, because semantically that doesn't make a lot of sense.

Also, it's not as simple as I thought because pictures can be an array of pictures, or be hidden behind sheet/sheets. In IRobot, I think I even used pictures = { layers = {…} } (one picture consisting of different layers, living directly in the root of pictures). So counting pictures is complex and error prone.

The .armor_picture_mapping for each character probably needs to be stored when they call CharModHelper.create_prototypes...

Yes, using armor_picture_mapping is much easier!

To ease my concern with the currently-hypothetical case where a character defines their own .armor_picture_mapping, I think an if might help...

lua local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"]) CharModHelper.apply_properties(corpse, prototype_data.corpse) if prototype_data.corpse.armor_picture_mapping == nil then prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping) end data:extend({corpse}) CMH.created_msg(corpse)

Seems to work for me! Dying with mech-armor equiped also functions without errors.

I've done this in a slightly different way:

  • Do nothing if the new corpse doesn't have armor_picture_mapping. I assume that character mods will set this if they use pictures. If picture is used instead, armor_picture_mapping should be ignored.
  • Store the highest value found in prototype_data.corpse.armor_picture_mapping as last_pic.
  • Loop over data.raw["character-corpse"]["character-corpse"].armor_picture_mapping. If we find an armor that is not listed in prototype_data.corpse.armor_picture_mapping, add it with the value of last_pic.

Please check out version 2.0.3 of CharacterModHelper! If you find new bugs, please report them there.

7 months ago

Error is no more, thank you!

3 months ago

This error seems to still be around after 2.0.4. Testing a couple mod combos I get

Failed to load mods: Error while loading entity prototype "_f42f38fb_b84e_4b34_8fd8_70cce8873d5b" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse._f42f38fb_b84e_4b34_8fd8_70cce8873d5b
Modifications: Des, the Wickerbeast (Lexxy's 2.0 fork)

Failed to load mods: Error while loading entity prototype "protogen-skin-corpse" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse.protogen-skin-corpse
Modifications: Protogen Character › miniMAXIme: Character scaler and selector

Disabling Metal and Stars does fix it, but a real bummer to choose between a cool character or a cool new system

2 months ago

Sorry for the late reply! Could you try commenting/removing the lines before

CharModHelper.check_my_prototypes(_3aecca88_5f97_447e_b7dd_46f834ad3c03)

in data-final-fixes.lua of Lexy's mod? I'm not sure why they are there, but I suspect they might cause the error.

2 months ago

Commenting out the lines before that didn't seem to have any effect, it still had the error

Commenting out that line itself though
CharModHelper.check_my_prototypes(_3aecca88_5f97_447e_b7dd_46f834ad3c03)
did get through to the game without errors, and it seems to work fine

If I comment out both the lines before it and that line, I get in but the armor on the Wickerbeast doesn't work right so it seems those lines before it are required for the armor to work

The Protogen Character mod has no such lines before the check_my_prototypes function, and in fact calling that function is the only line in its data-final-fixes.lua, and commenting that out worked just the same as far as getting into the game fine

I tried downloading a handful of other character mods, and the only ones that caused that error were the two Wickerbeast mods, and the Protogen mod:

https://mods.factorio.com/mod/wickerbeast
https://mods.factorio.com/mod/lexxy-wickerbeast
https://mods.factorio.com/mod/ProtogenCharacterUpdated/downloads

New response