OpenXcom Forum

Modding => Help => Topic started by: Mechasaurian on May 29, 2018, 06:33:10 pm

Title: [ITEM] Help creating my first mod?
Post by: Mechasaurian 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?
Title: Re: [ITEM] Help creating my first mod?
Post by: Meridian 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
Title: Re: [ITEM] Help creating my first mod?
Post by: Mechasaurian 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?
Title: Re: [ITEM] Help creating my first mod?
Post by: Kjotleik 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.
Title: Re: [ITEM] Help creating my first mod?
Post by: ohartenstein23 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 (https://github.com/ohartenstein23/OpenXcom/blob/oxce3.5-plus-proto/bin/standard/xcom1/items.rul) 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.
Title: Re: [ITEM] Help creating my first mod?
Post by: Mechasaurian 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
Title: Re: [ITEM] Help creating my first mod?
Post by: Mechasaurian 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.
Title: Re: [ITEM] Help creating my first mod?
Post by: Warboy1982 on May 30, 2018, 11:38:45 am
https://www.ufopaedia.org/index.php/Ruleset_List_Order_(OpenXcom)
 (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.
Title: Re: [ITEM] Help creating my first mod?
Post by: Mechasaurian 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?
Title: Re: [ITEM] Help creating my first mod?
Post by: Warboy1982 on May 30, 2018, 12:11:41 pm
https://discord.gg/pqPFK5A