Author Topic: Encountered an error trying to use spriteInv:  (Read 2667 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Encountered an error trying to use spriteInv:
« on: June 17, 2021, 10:51:39 am »
OXCE V6.5.5 (v2020-06-21)
Error: Sprite inventory_GUNDAM.SPK not found

Spoiler:

I've been creating a small mod as a tutorial for myself, unfortunately I've encountered an error that I can't seem to get past.

As far as I can tell the way I'm loading the inventory sprites is the same as other mods that I've looked at, could someone please take a quick look and point out my mistake?

I've attached the mod to this post for convenience. (HERE)

The openxcom.log Messages:
Code: [Select]
[17-06-2021_03-32-21] [FATAL] A fatal error has occurred: Sprite inventory_GUNDAM.SPK not found
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::CrossPlatform::stackTrace(void*)+0x36) [0x55680e101716]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::CrossPlatform::crashDump(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x477) [0x55680e1022b7]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(exceptionLogger()+0x75) [0x55680df3fb05]
[17-06-2021_03-32-21] [FATAL] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x92ae6) [0x7f80ac27cae6]
[17-06-2021_03-32-21] [FATAL] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x92b21) [0x7f80ac27cb21]
[17-06-2021_03-32-21] [FATAL] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x92d54) [0x7f80ac27cd54]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::Surface* OpenXcom::Mod::getRule<OpenXcom::Surface>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, OpenXcom::Surface*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, OpenXcom::Surface*> > > const&, bool) const+0x1a7) [0x55680e37e957]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::Mod::getSurface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)+0x76) [0x55680e34f476]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::InventoryState::init()+0x8b1) [0x55680e0a3d71]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(OpenXcom::Game::run()+0x3dc) [0x55680e121bec]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(main+0x175) [0x55680df1d795]
[17-06-2021_03-32-21] [FATAL] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f80ab864bf7]
[17-06-2021_03-32-21] [FATAL] ./OpenXcomEx(_start+0x2a) [0x55680df2428a]
[17-06-2021_03-32-46] [FATAL] OpenXcom has crashed: Sprite inventory_GUNDAM.SPK not found



Mod's Source Code:
Code: [Select]
extraSprites:
  - type: GUNDAM.PCK
    subX: 32
    subY: 40
    width: 512
    height: 720
    files:
      0: Resources/Images/Gundam/Unit_Gundam.png
  - type: ZEONGUNDAM.PCK
    subX: 32
    subY: 40
    width: 512
    height: 720
    files:
      0: Resources/Images/Zeon_Gundam/Unit_Zeon_Gundam.png
  - type: BIGOBS.PCK
    files:
      200: Resources/Images/Gundam/BigOb_Gundam_Wreck.png
  - type: FLOOROB.PCK
    files:
      200: Resources/Images/Gundam/FloorOb_Gundam_Wreck.png
  - type: HANDOB.PCK
    height: 40
    width: 256
    subX: 32
    subY: 40
    files:
      200: Resources/Images/Gundam/HandOb_Gundam_Wreck.png
  - type: inventory_GUNDAM
    singleImage: true
    files:
      0: Resources/Images/Gundam/Inventory_Gundam.png
  - type: inventory_ZEONGUNDAM
    singleImage: true
    files:
      0: Resources/Images/Zeon_Gundam/Inventory_Zeon_Gundam.png


items:
  - type: STR_CORPSE_SUIT
    name: STR_CORPSE
    weight: 26
    bigSprite: 200 # Was 44
    floorSprite: 200 # Was 41
    handSprite: 200 # Was Not Used
    invWidth: 2
    invHeight: 2 # Was 3
    armor: 40
    recover: false



armors:
  - type: STR_POWER_SUIT_UC
    spriteSheet: GUNDAM.PCK # Was XCOM_2.PCK
    spriteInv: inventory_GUNDAM
    forcedTorso: 1
  - type: STR_FLYING_SUIT_UC
    spriteSheet: ZEONGUNDAM.PCK # Was XCOM_2.PCK
    spriteInv: inventory_ZEONGUNDAM
    forcedTorso: 1 # Was 2

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Encountered an error trying to use spriteInv:
« Reply #1 on: June 17, 2021, 11:41:37 am »
Use the name that you see in the error message for extraSprites.

Or upgrade OXCE.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Encountered an error trying to use spriteInv:
« Reply #2 on: June 18, 2021, 02:04:22 am »
Thank you for the help Meridian.

I performed both of the actions you advised and the problem is solved.


One interesting thing I noticed is that when I updated to OpenXcom Extended 7.0 (v2021-03-13) and loaded the broken version of the mod it changed the error message.


In OXCE V6.5.5 the first [FATAL] message in the openxcom.log read:
Code: [Select]
[17-06-2021_03-32-21] [FATAL] A fatal error has occurred: Sprite inventory_GUNDAM.SPK not found
In OXCE V7.0 it doesn't mention the .SPK file extension:
Code: [Select]
[17-06-2021_18-12-12] [FATAL] A fatal error has occurred: Sprite inventory_GUNDAM not found

Everything is working and I will use this method from now on, however I do have one more question:

In the extraSprites_FMP.rul & armors_FMP.rul from the "Final Mod Pack V2.8e" several inventory images are used without the .SPK file extension.

What is the method being used that is allowing that inventory image to function like that in the "Final Mod Pack" mod?

I've been using "Final Mod Pack" as a guide for how OpenXcom .rul files work, so I'm very interested in understanding the difference.

For example the image variable for inventory_OBLITERATOR does not use the .SPK file extension:

Code from the extraSprites_FMP.rul file:
Code: [Select]
extraSprites:
  - type: inventory_OBLITERATOR
    singleImage: true
    files:
      0: Resources/Races_Compilation/MutonRace/inventory_OBLITERATOR.png
Code from the armors_FMP.rul file:
Code: [Select]
armors:
  - type: OBLITERATOR_ARMOR
    spriteSheet: OBLITERATOR.PCK
    spriteInv: inventory_OBLITERATOR
    allowInv: false
    corpseGeo: STR_OBLITERATOR_CORPSE
    corpseBattle:
      - OBLITERATOR_CORPSE_1
      - OBLITERATOR_CORPSE_2
      - OBLITERATOR_CORPSE_3
      - OBLITERATOR_CORPSE_4
    frontArmor: 100
    sideArmor: 100
    rearArmor: 100
    underArmor: 100
    movementType: 1
    drawingRoutine: 3
    size: 2
    damageModifier:
      - 1.0
      - 0.8
      - 0.4
      - 0.8
      - 0.6
      - 0.8
      - 0.0
      - 1.2
      - 1.2
      - 0.0
    loftempsSet: [ 92, 89, 90, 91 ]
    constantAnimation: true


I've attached the corrected version of my mod file and the Final Mod Pack (V2.8e)'s extraSprites_FMP.rul & armors_FMP.rul files to this post for convenience.





Just in case someone searches this topic in future with a similar problem here is the section of code that needed altering.

In extraSprites: & the armors: section's spriteInv: it was necessary to add the file extension .SPK to the variable for the two inventory images being loaded.
Code: [Select]
extraSprites:
  - type: inventory_GUNDAM.SPK
    singleImage: true
    files:
      0: Resources/Images/Gundam/Inventory_Gundam.png
  - type: inventory_ZEONGUNDAM.SPK
    singleImage: true
    files:
      0: Resources/Images/Zeon_Gundam/Inventory_Zeon_Gundam.png

armors:
  - type: STR_POWER_SUIT_UC
    spriteInv: inventory_GUNDAM.SPK
  - type: STR_FLYING_SUIT_UC
    spriteInv: inventory_ZEONGUNDAM.SPK

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Encountered an error trying to use spriteInv:
« Reply #3 on: June 18, 2021, 10:50:53 am »
Openxcom is sometimes looking for sprites without .SPK, sometimes with .SPK, sometimes even with M0.SPK.

Depends on the type of unit (e.g. soldier, alien, etc.)

Either use the same convention as vanilla OpenXcom; or try upgrading OXCE (I have added more supported combinations compared to OpenXcom relatively recently).

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Encountered an error trying to use spriteInv:
« Reply #4 on: June 24, 2021, 08:35:29 am »
Thank you for taking the time to explain how that functions.