Author Topic: Trying to create 2x2 Unit with a custom corpse sprite.  (Read 5625 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Trying to create 2x2 Unit with a custom corpse sprite.
« on: November 21, 2017, 06:57:20 am »
(Version of OpenXcom used is: "Nightlies 2017-11-02" Linux release.)



I've been trying to build a mod that introduces a 2x2 unit with a custom corpse sprite.
(I'll try tackling altering the 2x2's living sprites later.)

However I keep getting an error when I load the four sprites for the 2x2 corpse.


Here's the code I've added that appears to be creating the error.
Code: [Select]
extraSprites:
  - type: FLOOROB.PCK
    singleImage: true
    width: 32
    height: 40
    files:
      500: /Resources/Test_Tanks/FloorOb_TestTank_Corpse_1.png
      501: /Resources/Test_Tanks/FloorOb_TestTank_Corpse_2.png
      502: /Resources/Test_Tanks/FloorOb_TestTank_Corpse_3.png
      503: /Resources/Test_Tanks/FloorOb_TestTank_Corpse_4.png

I've made the new images load to the high values of "files: 500-503" so as not to overlap with anything used in the other mods I have installed. (Like the excellent Final Mod Pack.)

Code: [Select]
items:
  - type: TEST_TANK_CORPSE_1
    floorSprite: 500
    invWidth: 0
    invHeight: 0
    recover: false
  - type: TEST_TANK_CORPSE_2
    floorSprite: 501
    invWidth: 0
    invHeight: 0
    recover: false
  - type: TEST_TANK_CORPSE_3
    floorSprite: 502
    invWidth: 0
    invHeight: 0
    recover: false
  - type: TEST_TANK_CORPSE_4
    floorSprite: 503
    invWidth: 0
    invHeight: 0
    recover: false


Code: [Select]
armors:
  - type: TEST_TANK_ARMOR
    spriteSheet: NEWTANKS.PCK
    allowInv: false
    corpseBattle:
      - TEST_TANK_CORPSE_1
      - TEST_TANK_CORPSE_2
      - TEST_TANK_CORPSE_3
      - TEST_TANK_CORPSE_4
    frontArmor: 100
    sideArmor: 100
    rearArmor: 90
    underArmor: 90
    drawingRoutine: 2
    size: 2
    loftempsSet: [92, 89, 90, 91]
    damageModifier:
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 0.0




In the openxcom.log file the following error was recorded:
Code: [Select]
[20-11-2017_22-54-34] [INFO] Loading extra resources from ruleset...
[20-11-2017_22-54-35] [INFO] requested file not found: /Resources/Test_Tanks/FloorOb_TestTank_Corpse_1.png
[20-11-2017_22-54-35] [ERROR] /Resources/Test_Tanks/FloorOb_TestTank_Corpse_1.png:Couldn't open /Resources/Test_Tanks/FloorOb_TestTank_Corpse_1.png



The mods file directory structure looks like this:
Code: [Select]
- openxcom
-- mods
--- Test_Tanks
---- Resources
----- Test_Tanks
------ FloorOb_TestTank_Corpse_1.png
------ FloorOb_TestTank_Corpse_2.png
------ FloorOb_TestTank_Corpse_3.png
------ FloorOb_TestTank_Corpse_4.png
---- Ruleset
----- *.rul (All the *.rul files belonging to this mod.)


As far as I can tell the four corpse *.png images are in the correct location.

I'd appreciate it if someone could point out what I'm doing wrong or link me to a tutorial on the subject.
« Last Edit: November 21, 2017, 06:59:06 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #1 on: November 22, 2017, 07:24:27 am »
I tried changing out the test FloorOb_TestTank_Corpse_#.png sprites for the ones used in the Final Mod Pack's MiB tank and a different error was produced.

It is not my plan to use the MiB sprites from the
Final Mod Pack, but I figured that since they are already known to work I'd check if it was something specifically about the *.png that were being used in my customized test mod.

Here's the code as it looks now:
Code: [Select]
extraSprites:
  - type: FLOOROB.PCK
    singleImage: true
    width: 32
    height: 40
    files:
      500: /Resources/Test_Tanks/floorob_MIBTANK_CORPSE_1.gif
      501: /Resources/Test_Tanks/floorob_MIBTANK_CORPSE_2.gif
      502: /Resources/Test_Tanks/floorob_MIBTANK_CORPSE_3.gif
      503: /Resources/Test_Tanks/floorob_MIBTANK_CORPSE_4.gif

Here's the new error in the openxcom.log file:
Code: [Select]
[21-11-2017_23-52-01] [INFO] Loading extra resources from ruleset...
[21-11-2017_23-52-02] [INFO] requested file not found:
[21-11-2017_23-52-02] [ERROR] :SDL_RWFromFile(): No file or no mode specified


I've also been going over the UFOpaedia Ruleset Reference's extraSprite: section and Warboy1982's tutorial post on adding new custom graphics.

As far as I can tell all the necessary fields are present and have the correct variables assigned to them.
 
« Last Edit: November 22, 2017, 07:49:30 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #2 on: November 22, 2017, 07:48:17 am »
I also tried instead to make a directory into a sprite sheet as instructed by the UFOpaedia Ruleset Reference.


This is the attempted code:

Code: [Select]
extraSprites:
  - type: GIANTBUNNY.PCK
    singleImage: true
    width: 32
    height: 40
    files:
      0: /Resources/Test_Tanks/Corpse/

GIANTBUNNY.PCK was used in the tutorial example so I gave it a try. Using FLOOROB.PCK also produces the same error message.

Here is the openxcom.log error:

Code: [Select]
[22-11-2017_00-39-45] [INFO] Loading extra resources from ruleset...
[22-11-2017_00-39-46] [INFO] requested file not found: /Resources/Test_Tanks/Corpse/
[22-11-2017_00-39-46] [ERROR] /Resources/Test_Tanks/Corpse/:Couldn't open /Resources/Test_Tanks/Corpse/

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 683
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #3 on: November 22, 2017, 12:22:57 pm »
i will try to help you make a 2x2 unit

what you need in resources (images):
- 1 spritesheet
- 4 floor objs

what you need in ruleset :

units:
  - type: STR_A
    race: STR_A
    stats: ...
 armor: A_ARMOR
    ..... etc ...etc

armors:
  - type: A_ARMOR
    spriteSheet: A.PCK
    allowInv: false
    corpseGeo: STR_A_CORPSE
    corpseBattle:
      - A_CORPSE1
      - A_CORPSE2
      - A_CORPSE3
      - a_CORPSE4
    frontArmor: ....

items:
  - type: STR_A
    size: 6
    costSell: ....
 - type: A_CORPSE1
    floorSprite: ......
 - type: A_CORPSE2
    floorSprite: ......
 - type: A_CORPSE3
    floorSprite: ......
 - type: A_CORPSE4
    floorSprite: ......

extraSprites:
  - type: FLOOROB.PCK
    files:
      82: Resources/A/A_CORPSE1.gif
      83: Resources/A/A_CORPSE2.gif   
      84: Resources/A/A_CORPSE3.gif         
      85: Resources/A/A_CORPSE4.gif
  - type: A.PCK
    subX:...
    subY:..
    width: ...
    height: ...
    files:
      0: Resources/A/A.png

so if you have this all well made there is no issue

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #4 on: November 22, 2017, 03:29:25 pm »
Also:  When posting for help, the code as you have posted it is excellent.  Along with that, please upload a .zip of the whole mod.  That way resources can be compared with what is in the ruleset, etc.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #5 on: November 22, 2017, 03:43:51 pm »
Just looked at your code, and I think the issue is that you put a '/' before 'Resources.' Try replacing /Resources/Test_Tanks/filename.png with Resources/Test_Tanks/filename.png.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #6 on: November 23, 2017, 07:00:52 am »
i will try to help you make a 2x2 unit
In this case I was modifying an existing mod as kind of a tutorial project so fortunately those variables already had been assigned. Thank you for posting your template having it will make creating a new 2x2 unit much easier.

I think the issue is that you put a '/' before 'Resources.' Try replacing /Resources/Test_Tanks/filename.png with Resources/Test_Tanks/filename.png.
Thank you for spotting that, the extra "/" does indeed appear to have been the problem. Everything is now working correctly when the aliens cause the tanks to stop working correctly. -_^

please upload a .zip of the whole mod.
Sorry about that. I was modifying someone else's mod as a training exercise and I wasn't sure about what the forum etiquette was for uploading a mod based on another's work.

Which I see now was redundant as the original author mentioned on the mods forum thread: "As always, feel free to use whatever for whatever."

So I'll upload it there in case anyone is curious.

Basically I was just modifying the Alloy Ground Tanks mod by CryptoCactus to use Hellrazor's Alloy Tank Corpse sprites.
^_^

Link:
[HWP/Resource] Alloy Ground Tanks v1.4 by CryptoCactus

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Trying to create 2x2 Unit with a custom corpse sprite.
« Reply #7 on: December 10, 2017, 05:06:27 am »
Thanks for this topic! It helped me to finish my own corpses project.