Author Topic: [ITEM] Help creating my first mod?  (Read 5278 times)

Offline Mechasaurian

  • Sergeant
  • **
  • Posts: 14
  • Imperial SpecOps
    • View Profile
[ITEM] Help creating my first mod?
« on: May 29, 2018, 06:33:10 pm »
So I would like to dip my toe into the world of OpenXCom modding.

I want to start with something simple: a new kind of ammunition for the stock X-COM rocket launcher.

I need to know how to edit its variables (price, explosion radius, weight, etc).

I need to know how to insert this item into the game's data, such that it can be purchased and/or manufactured.

I have a sprite that I can use for the inventory image, but I need to know how to program the item to use it.

Anyone willing to help me out?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #1 on: May 29, 2018, 06:40:47 pm »
Easiest way is to find a small mod, which does something similar and try to understand it.

Also, this page might be your best friend: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Items

Offline Mechasaurian

  • Sergeant
  • **
  • Posts: 14
  • Imperial SpecOps
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #2 on: May 29, 2018, 07:22:42 pm »
Hmm. Yes. That looks a lot like what I was looking for.

The only problem is that it presumes focus on the weapon, not the ammunition.

From the looks of things...first I would have to create a new kind of rocket with a unique string ID number? Then I would have to modify the rocket launcher's "compatibleAmmo" list of string IDs to accept this new rocket as ammunition?
« Last Edit: May 29, 2018, 07:33:48 pm by Mechasaurian »

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #3 on: May 29, 2018, 07:31:45 pm »
Hello, Mechasaurian.

Yes to both of your last two questions.

If you want a mod to compare against (not small, but) you could try looking into the Final Mod Pack 2.0b mod.

Just search the items_FMP.rul, manufacture_FMP.rul, extraStrings_FMP.rul and extraSprites_FMP.rul files. You should find fine examples to learn from.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #4 on: May 29, 2018, 07:33:41 pm »
The "items:" ruleset doesn't presume focus on weapon or ammunition, it's just all the different parameters any item in the game can possibly have.  The handling of whether this an item is ammunition or a firearm is done by the "battleType" parameter, for example.  If you look in the standard/xcom1 directory of your installation, you'll find the ruleset for the items in the original game.  That's a good starting point for seeing how weapons and ammunition are handled.

A new item definition with a unique string ID ("type") and modifying "compatibleAmmo" is exactly what you want to do, yes.

Offline Mechasaurian

  • Sergeant
  • **
  • Posts: 14
  • Imperial SpecOps
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #5 on: May 29, 2018, 07:37:56 pm »
If you want a mod to compare against (not small, but) you could try looking into the Final Mod Pack 2.0b mod.

Just search the items_FMP.rul, manufacture_FMP.rul, extraStrings_FMP.rul and extraSprites_FMP.rul files. You should find fine examples to learn from.
Well, it just so happens that I have a copy of the Final Mod Pack on hand. I'll crack it open and take a look.

The handling of whether this an item is ammunition or a firearm is done by the "battleType" parameter, for example.

Aha! AHA!

Thanks a bunch, people.  ;D

Offline Mechasaurian

  • Sergeant
  • **
  • Posts: 14
  • Imperial SpecOps
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #6 on: May 30, 2018, 11:23:54 am »
Okay, so I now have a handle on part of the ruleset. I've created the item as ammunition for the rocket launcher, and have entered in parameters for damage, explosion radius, and buying and selling prices, inventory weight/height, and so on.

But there are still some things I am unclear on.

How do I direct the ruleset to use particular images as an inventory image and/or a battlescape image? Different rulesets seem to do it in different ways.

What should the "listOrder" number be?

And, while I think I have a handle on how to create a UFOpedia entry, I'd like to ask how to do it, just in case.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #7 on: May 30, 2018, 11:38:45 am »
https://www.ufopaedia.org/index.php/Ruleset_List_Order_(OpenXcom)

for rocket launcher ammo you'll want to set the listorder to something in the 3101-3499 range

for the inventory image, you'll want to add an ExtraSprite entry, give it a number, and reference that number in the item definition.

as for the UFOpedia entry, that's pretty straightforward, just some ExtraStrings and some copy/paste.

i'd go into more detail but i don't have the energy right now, if you haven't got it sorted by the time i wake up, i'll give you a run-down or something.
additionally: the openxcom discord server is probably your best knowledge base resource, there are people there that are fairly well versed in the specifics of modding and you can get your answers in real time.
« Last Edit: May 30, 2018, 11:46:39 pm by Warboy1982 »

Offline Mechasaurian

  • Sergeant
  • **
  • Posts: 14
  • Imperial SpecOps
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #8 on: May 30, 2018, 11:56:13 am »
additionally: the openxcom discord server is probably your best knowledge base resource, there are people there that are fairly well versed in the specifics of modding and you can get your answers in real time.
Ooh, there's a discord channel?

Sounds good. Linky?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [ITEM] Help creating my first mod?
« Reply #9 on: May 30, 2018, 12:11:41 pm »
« Last Edit: May 30, 2018, 12:18:44 pm by Warboy1982 »