Author Topic: Trying to make my first mod - need help  (Read 4995 times)

Offline the_third_curry

  • Colonel
  • ****
  • Posts: 147
    • View Profile
Trying to make my first mod - need help
« on: August 01, 2014, 06:38:46 am »
With all the other mods getting made, I decided I would finally try to make one of my own. The problem is that I have no idea what I'm doing. I read on the Ruleset Reference section of UFOpaedia that damage types other than 0-9 will only affect terrain and not units, so I got the idea to make a Terrain Vaporizer that destroys terrain without damaging humans or aliens.

Here's the code I've got so far:

Spoiler:
item:
  - type: STR_TERRAIN_VAPORIZER
    name: STR_TERRAIN_VAPORIZER
    size: 0.2
    costBuy: 5000
    costSell: 2400
    weight: 5
    bigSprite: 400
    floorSprite: 400
    power: 200
    damageType: 10
    battleType: 4
    blastRadius: 5
    listOrder: 4050
ufopaedia:
 - id: STR_TERRAIN_VAPORIZER
   type_id: 4
   section: STR_WEAPONS_AND_EQUIPMENT
   listOrder: 4050
   text: STR_TERRAIN_VAPORIZER_UFOPAEDIA
extraSprites:
  - type: BIGOBS.PCK
    files:
      400: Resources/Terrain_Vaporizer.gif
  - type: FLOOROB.PCK
    files:
      400: Resources/Terrain_Vaporizer.gif
extraStrings:
  - type: en-US
    strings:
      STR_TERRAIN_VAPORIZER: Terrain Vaporizer
      STR_TERRAIN_VAPORIZER_UFOPAEDIA: The Xcom Terrain Vaporizer effectively removes a wide range of environmental obstacles by utilizing a chemical explosion that is non-harmful to organic lifeforms.

I'm using the attached sprite for the weapon (yes it's just a TftD rip for now.)

The problem is that, when I enable the ruleset, the weapon doesn't function at all. It doesn't appear for purchase or in New Battle. It does appear in the in-game UFOpaedia, but trying to access it just causes the game to crash.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Trying to make my first mod - need help
« Reply #1 on: August 01, 2014, 09:58:57 am »
Hi!

Welcome to the modding community!

I only took a quick look at your code, but it looks to me like there is a lot missing from the weapon entry. I guess for a grenade-type weapon (that's what it is, right?) that might be ok, I'm not sure.

Any ways, one thing that did stick out was the lack of any hand objects. In the extra sprites, you need to provide a picture that tells the game what a soldier holding this weapon will look like. They're called "HANDOBS" in the code, if I remember well. Try to provide one, maybe flesh out the definition a bit, and if it doesn't work, someone here can probably fix it!

Offline LeBashar

  • Colonel
  • ****
  • Posts: 119
    • View Profile
Re: Trying to make my first mod - need help
« Reply #2 on: August 01, 2014, 10:46:08 am »
For a first attemp it could me easier to not try to modifi everything :
- try to change the stats of an existing grenade, with same graphics. When it will work, then modify graphics.
- or, try to make news graphism for o copy of existing weapon but don't change any stat. When it will work, then modify stats.

You have more step to see where you make mistake in this way.  :)

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: Trying to make my first mod - need help
« Reply #3 on: August 01, 2014, 03:15:33 pm »
With all the other mods getting made, I decided I would finally try to make one of my own. The problem is that I have no idea what I'm doing. I read on the Ruleset Reference section of UFOpaedia that damage types other than 0-9 will only affect terrain and not units, so I got the idea to make a Terrain Vaporizer that destroys terrain without damaging humans or aliens.

Here's the code I've got so far:

Spoiler:
item:
  - type: STR_TERRAIN_VAPORIZER
    name: STR_TERRAIN_VAPORIZER
    size: 0.2
    costBuy: 5000
    costSell: 2400
    weight: 5
    bigSprite: 400
    floorSprite: 400
    power: 200
    damageType: 10
    battleType: 4
    blastRadius: 5
    listOrder: 4050
ufopaedia:
 - id: STR_TERRAIN_VAPORIZER
   type_id: 4
   section: STR_WEAPONS_AND_EQUIPMENT
   listOrder: 4050
   text: STR_TERRAIN_VAPORIZER_UFOPAEDIA
extraSprites:
  - type: BIGOBS.PCK
    files:
      400: Resources/Terrain_Vaporizer.gif
  - type: FLOOROB.PCK
    files:
      400: Resources/Terrain_Vaporizer.gif
extraStrings:
  - type: en-US
    strings:
      STR_TERRAIN_VAPORIZER: Terrain Vaporizer
      STR_TERRAIN_VAPORIZER_UFOPAEDIA: The Xcom Terrain Vaporizer effectively removes a wide range of environmental obstacles by utilizing a chemical explosion that is non-harmful to organic lifeforms.

I'm using the attached sprite for the weapon (yes it's just a TftD rip for now.)

The problem is that, when I enable the ruleset, the weapon doesn't function at all. It doesn't appear for purchase or in New Battle. It does appear in the in-game UFOpaedia, but trying to access it just causes the game to crash.
Beware that BIGOBS has to be a 32x48 whereas a FLOOROB has to be a 32x40, and this could make game crash
So you have to create a second GIF

Take example of some created grenades somewhere on this site and check if you filled in all needed sections

Better to not place your gif directly under Resources, but create some folder and update your path also (not mandatory but a best practice)

About damage types, I have not enough experienced it to help you more...
« Last Edit: August 01, 2014, 03:19:15 pm by Aldorn »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Trying to make my first mod - need help
« Reply #4 on: August 01, 2014, 04:59:40 pm »
Ufopaedia crash is usally a telltale sign of missing/wrong graphic file(s); even if you could use the same file for bigob and floorob, which you shouldn't try, I wouldn't reccomend it (either the floorob will be huge, or the bigob tiny). Handob is not needed for a grenade (the default handob is grenade handob). The code looks legit.

Offline the_third_curry

  • Colonel
  • ****
  • Posts: 147
    • View Profile
Re: Trying to make my first mod - need help
« Reply #5 on: August 01, 2014, 09:23:00 pm »
Beware that BIGOBS has to be a 32x48 whereas a FLOOROB has to be a 32x40, and this could make game crash
So you have to create a second GIF

Quote
Ufopaedia crash is usally a telltale sign of missing/wrong graphic file(s); even if you could use the same file for bigob and floorob, which you shouldn't try, I wouldn't reccomend it (either the floorob will be huge, or the bigob tiny). Handob is not needed for a grenade (the default handob is grenade handob). The code looks legit.

I created a separate GIF for the FLOOROB at the 32x40 size, but nothing changed. The item is non-appering on the purchase menu and looking it up crashes the game. I have a clean install of 1.0 in a folder labeled "OpenXcom2" for the purposes of testing the mod, so I don't see anyway that there could be another mod or code conflicting with it.

Quote
I only took a quick look at your code, but it looks to me like there is a lot missing from the weapon entry. I guess for a grenade-type weapon (that's what it is, right?) that might be ok, I'm not sure.

My entry for the grenade type weapon is based off of a copy-and-paste of the entry for the standard grenade; I just edited the values for that part. Most of the work for the grenade seems to be done by just setting it as a grenade object.

Quote
For a first attemp it could me easier to not try to modifi everything :
- try to change the stats of an existing grenade, with same graphics. When it will work, then modify graphics.
- or, try to make news graphism for o copy of existing weapon but don't change any stat. When it will work, then modify stats.

In retrospect, just editing something in game would probably have been the better starting idea, but I did scan over some other mods for how the sprites work and, as far as I can tell, the issue with the FLOOROB is the only thing I messed up. I'll try to edit the in game grenade and see how that goes though.

Offline the_third_curry

  • Colonel
  • ****
  • Posts: 147
    • View Profile
Re: Trying to make my first mod - need help
« Reply #6 on: August 01, 2014, 09:46:26 pm »
I followed LeBashar's advice and just edited the standard grenade. I changed it to damage type 10 and the item continued to work; UFOpaedia listed its damage type as "unknown." I threw the primed grenade in battle and... it did absolutely nothing. It didn't damage the terrain or units at all. I then took the high explosive, changed it to type 10 and moved its power and blast radius to something ridiculously high. I lobbed one in a terror mission and it made a big explosive, but, once more, it did nothing. Changed it to damage type 11, still nothing.

The message on the UFOpaedia wiki Ruleset Reference page that reads "NOTE: A damage type other than 0-9 will only affect terrain, units will ignore it" needs to be changed. Any damage type outside of those 10 does nothing.
« Last Edit: August 01, 2014, 09:48:47 pm by the_third_curry »

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Trying to make my first mod - need help
« Reply #7 on: August 01, 2014, 10:25:17 pm »
The message on the UFOpaedia wiki Ruleset Reference page that reads "NOTE: A damage type other than 0-9 will only affect terrain, units will ignore it" needs to be changed. Any damage type outside of those 10 does nothing.
done