OpenXcom Forum

Modding => Work In Progress => Topic started by: guille1434 on August 27, 2014, 03:04:07 am

Title: Help modding a craft weapon
Post by: guille1434 on August 27, 2014, 03:04:07 am
Hello: Here I found one problem that I cannot solve, and I would like that some kind person here give me some advice.

The problem is that I am making a small air combat rebalance mod, part of it is the adition of some new craft weapons. I did mod in a new craft cannon, which was researched and manufatured without a problem, but while in the "Equip Craft" screen, the very moment I choose one of this weapons the game crashes...

Can anyone give me some suggestion about what to do to solve this problem?

Thanks!  :(
Title: Re: Help modding a craft weapon
Post by: Falko on August 27, 2014, 03:31:44 am
first step in problemsolving is showing your ruleset
likely your sprites are wrongly assigned
Title: Re: Help modding a craft weapon
Post by: guille1434 on August 27, 2014, 03:51:53 am
I checked that aspect of the problem, and I think it is Ok, but... In any case I upload here my .rul file, the problematic craftWeapon is designated STR_CRAFT_MDRIVER_UC

I suspect that the problem has to do with the basebit and Initicon files... Anyone can tell me if those files have to be in any special format (file extension, colors palette, etc)?

I attach them also for someone to check, if possible, if they are  the source of the problems. About this files, if they are faulty, do someone have some "vanilla" files to use as models for my custom ones?

Thanks Falko for your prompt answer!
Title: Re: Help modding a craft weapon
Post by: Falko on August 27, 2014, 04:09:13 am
see
https://www.ufopaedia.org/index.php?title=BASEBITS.PCK
https://www.ufopaedia.org/index.php?title=INTICON.PCK
oxc example:
Code: [Select]
craftWeapons:
  - type: STR_STINGRAY
    sprite: 0
the stingray is in position 5 in inticon and in position 48 in basebits
(i count starting with 0 so position 0 ist the first position)
if you add a weapon with sprite 12
oxc expects file ids in position 5+12 in inticon and in position 48+12 in basebits
so what do we have?
Code: [Select]
  - type: STR_CRAFT_MDRIVER_UC
    sprite: 12
.......
  - type: BASEBITS.PCK
    files:
      56: Resources/FmpAddon/Retaliator/retaliator_base.gif
      #133=100+33
      133: Resources/FmpAddon/Skytrooper/Skytrooper_BASEBITS.PNG
  - type: INTICON.PCK
    files:
      23: Resources/FmpAddon/Retaliator/retaliator_minimised.gif
      34: Resources/FmpAddon/Retaliator/retaliator_dogfight.gif
      100: Resources/FmpAddon/Skytrooper/SkytrooperMinimized_INTICON.PNG
      #111=100+11
      111: Resources/FmpAddon/Skytrooper/SkytrooperDogfight_INTICON.PNG

file ids do not match

Edit:
also your images are in RGBA mode
oxc needs indexed images

one way:
save them as gif
use https://falkooxc.pythonanywhere.com/palconvert# (
upload gif, seelct from base/geo to base/geo palette , more details -> [ x] try to fix palette colors )->that resulting image should work
Title: Re: Help modding a craft weapon
Post by: guille1434 on August 27, 2014, 04:40:21 am
So, If I assign sprite number 13 to this weapon (I saw number 12 is already taken), the initicon file has to be number 23 (5 + 13) and basebits 61 (48 + 13)? I will test it....

Here is the modified .rul file.

Also, thanks very much for the tips for the graphic files!!

--- posts merge ---

About the graphic files: I used the palette converter, used the options from ufo-bsescape to ufo-bsescape (did not see base/geo palette), but the resulting files could not be opened in Aseprite... Am I doing something wrong?

--- posts merge ---

Ok, the resulting files were png, not gifs... I changed thier exyensions, but the Initicon one is not looking good... I will try to hand make one new file with the base of a vanille file...

Thanks!!!  8)

--- posts merge, honestly ---

Ok, a partial success... All seems to fine (equip craft, interception launching, the icon showed in the small interceptor radar screen, but now the games crash when the weapon is starting to fire... I think this has to do with the small blob which represents the projectiles while in flight to target... Am I roght? How is this corrected? Or may be the problem is about the sound file? Any special numeration rule for the sound file id number? Thanks again!

--- posts merge, I can do it all day but do I have to? ---

Indeed, the problem seems to be about the sound, as I assigned another sound file number (the same as anothe good-working weapon) and everything was all right... But I would really like to assign this weapon its own characteristic sound... How do I accomplish this? Thanks again!!
Title: Re: Help modding a craft weapon
Post by: ivandogovich on August 27, 2014, 07:02:40 am
Indeed, the problem seems to be about the sound, as I assigned another sound file number (the same as anothe good-working weapon) and everything was all right... But I would really like to assign this weapon its own characteristic sound... How do I accomplish this? Thanks again!!

add your sound to the resources folder and specify it.

i.e.
Code: [Select]
items:
  - type: STR_DART_PISTOL
#<lines of code cut out here>
    fireSound: 65
extraSounds:
  - type: BATTLE.CAT
    files:
      65: Resources/DartPistol/Sounds/Fire2.wav
Title: Re: Help modding a craft weapon
Post by: Falko on August 27, 2014, 08:47:40 am
Ok, the resulting files were png, not gifs... I changed thier exyensions, but the Initicon one is not looking good... I will try to hand make one new file with the base of a vanille file...

Thanks!!!  8)
inticon needs the geoscape palette called ufo-geo in the webtool
regarding sound no idea what the problem is i never modded sound
Title: Re: Help modding a craft weapon
Post by: guille1434 on August 28, 2014, 01:17:30 am
I managed to mod in the custom graphics without a problem now, but I cannot assign a custom sound file to this weapon without making the game crash... If I assign a vanilal sound everything seems to be Ok.
Title: Re: Help modding a craft weapon
Post by: ivandogovich on August 28, 2014, 01:27:44 am
looks like you will want to use geo.cat.


GEO.CAT - Geoscape sound

Code: [Select]
Example:
- type: GEO.CAT
  files:
    55: Resources/Sounds/sample.wav

can you post your ruleset?

Edit: Sorry>>> its SAMPLE.CAT


--- posts merge ---

this is what I found in the last ruleset you posted

Code: [Select]
extraSounds:
  - type: BATTLE.CAT
    files:
      155: Resources/FmpAddon/MassDriverCraft/Sound/MassDriver_Fire1.wav

This should be type: SAMPLE.CAT

https://www.ufopaedia.org/index.php?title=Ruleset_Reference_(OpenXcom)#Craft_Weapons
Title: Re: Help modding a craft weapon
Post by: Warboy1982 on August 28, 2014, 12:42:49 pm
GEO.CAT

we use GEO.CAT and BATTLE.CAT internally.
there are multiple different sound files out there, some called SOUNDx.CAT some called SAMPLEx.CAT, but only the internal names we use are of any relevance to modders.
Title: Re: Help modding a craft weapon
Post by: guille1434 on August 29, 2014, 07:22:57 pm
Ivan: Thanks for the advice, but that one does not seem to be the problem... the game is still crashing at the moment of firing the weapon against an Ufo... I will stick with a vanilla sound effect for now...  ::)
Title: Re: Help modding a craft weapon
Post by: ivandogovich on August 29, 2014, 08:23:50 pm
Ok, sorry we didn't get it sorted out. Thanks for the feedback.
Title: Re: Help modding a craft weapon
Post by: Falko on August 29, 2014, 08:31:24 pm
can you upload your wave file?
Title: Re: Help modding a craft weapon
Post by: guille1434 on August 30, 2014, 06:12:25 am
Yes, here is the last version of the .rul file and the .wav file... Thanks for your interest, guys! :-)
Title: Re: Help modding a craft weapon
Post by: Falko on September 01, 2014, 05:37:04 am
found the time to test it
Code: [Select]
craftWeapons:
  - type: STR_STINGRAY
    sound: 66
extraSounds:
  - type: GEO.CAT
    files:
      66: Resources/MassDriver_Fire1.wav
worked fine
Title: Re: Help modding a craft weapon
Post by: guille1434 on September 02, 2014, 12:52:19 am
Falko: Thanks! It worked all right with the file type GEO.CAT

Now I can fire and hear very well my new weapons!

I am finishing my first play test, then I will upload the mod files!

Thanks again!
Title: Re: Help modding a craft weapon
Post by: Falko on September 02, 2014, 10:47:53 am
thank warboy he told you (and me) the problem already :)
i changed the wiki to make the sound description less confusing
Title: Re: Help modding a craft weapon
Post by: guille1434 on September 08, 2014, 01:37:12 am
Ok, here I am again testing the patience of this community!
I wish to change the walking sound of the X-Com made Sectopods, I wanted to replace the original sound by a .wav file taken form a mod that had the sounds from the PSX version of the X-Com game... After making the necessary changes, when trying to load the game it will show the following message: Mix_loadWAV_RW with NULL src... Anyone can give me an idea about what is wrong?

I also attach the .wav file and the related parts of the ruleset...


  - type: STR_SECTOPOD_PLASMA
    race: STR_SECTOPOD_PLASMA
    stats:
      tu: 80
      stamina: 100
      health: 100
      bravery: 110
      reactions: 30
      firing: 60
      throwing: 0
      strength: 60
      psiStrength: 100
      psiSkill: 0
      melee: 0
    armor: SECTOPOD_ARMOR3
    standHeight: 15
    kneelHeight: 15
    loftemps: 4
    value: 20
    deathSound: 23
    moveSound: 23

#extraSounds:
#  - type: BATTLE.CAT
#    files:
#      23: Resources/FmpAddon/Sectopod/Sound/SectopodWalk.wav

Any help will be much appreciated!  :-)
Title: Re: Help modding a craft weapon
Post by: ivandogovich on September 08, 2014, 05:15:14 am
Why are your death and move sounds the same, and why do you have the extra sounds commented out?
Title: Re: Help modding a craft weapon
Post by: guille1434 on September 08, 2014, 06:06:28 am
Well, the number 23 refering to the move and death sounds were not modded by me, this is the original data from the FMP mod, and the extra sound commented out is because if I do not comment out that lines, the program gives me the error message I described in the previous post when loading and the game will not start...
Title: Re: Help modding a craft weapon
Post by: smexyvami on September 08, 2014, 06:38:51 am
have  you pointed the game to the new sound file ? and checkd all spots where it refures to the sound ?
Title: Re: Help modding a craft weapon
Post by: guille1434 on September 08, 2014, 07:26:13 am
Yes, I think that I had all the references correct, but the strange thing for me is that the game is not crashing when this files is about to get played (i.e. when a Sectopod is going to move), but instead it gives me an error message before completing the program load. That is, the game does not even start when I point to that file (see some posts above for the error message I obtained).

Thanks guys for your assistance! :-)