aliens

Author Topic: making a submod for TWoTS  (Read 4773 times)

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
making a submod for TWoTS
« on: June 02, 2020, 03:01:00 pm »
So I want to make a submod for TWoTS, to restore the ranges for the rifles and cannon weapons. I figure out how to edit the ruleset. But I know this is not the "proper way" to do it. I want to make a mod I can turn on and off. What is the proper way? Is there a guide somewhere?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #1 on: June 02, 2020, 03:08:37 pm »
1. create a new folder for your mod (in the "mods" directory)
2. create a metadata.yml file in the root folder of your mod with ID and name attributes identifying your mod
3. add a Ruleset folder
4. in the Ruleset folder, create a new *.rul file
5. put the changes in this *.rul file

When activating your mod on the GUI, make sure it is BELOW the twots mod in the list.

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #2 on: June 03, 2020, 11:19:24 am »
so I tried to make my mod by removing a bunch of ranges, but now TWOTS crashes. Can somebody take a look and tell me what I did wrong? Thanks!

https://www.dropbox.com/s/pvh8j322b856idv/twots_morevanilla.rar?dl=0

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #3 on: June 03, 2020, 11:44:03 am »
Mods don't share sprites, you can't just use the same numbers let's say for bigobs in your mod as in twots... those number don't exist in your mod.

For example:

Code: [Select]
  - type: STR_HARP
    categories: [STR_DUALENV_WEAPONS]
    size: 0.1
    costBuy: 2000
    costSell: 1700
    weight: 4
    bigSprite: 130             # <------------- this sprite doesn't exist in your mod
    floorSprite: 132
    handSprite: 1119

Options you have:

1. don't override twots sprites in your mod, just leave them be... only override what needs to be overridden

2. copy all the sprites from twots to your mod too

3. reference the sprites across mods, see: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Negative_indices_and_cross-referencing_other_mods

All three options work, I'd recommend option 1.

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #4 on: June 03, 2020, 11:51:54 am »
But all I did was remove a bunch of maxrange and other range statements, why would this affect the sprites?

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #5 on: June 03, 2020, 11:55:47 am »
Difference is linked below

https://www.diffchecker.com/kJm4FC6r

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #6 on: June 03, 2020, 12:07:31 pm »
But all I did was remove a bunch of maxrange and other range statements, why would this affect the sprites?

1/ As I said, (for example) sprite 130 exists in TWOTS, but doesn't exist in your mod.

If you specify "bigSprite: 130" in your mod, you are telling the game to use a sprite that doesn't exist.... and the game will crash.


2/ Also, removing the ranges from the file will NOT work... the ranges from TWoTS will still be used. If you want the vanilla ranges back, you NEED to explicitly override those ranges back to whatever numbers you need.

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #7 on: June 03, 2020, 12:10:44 pm »
Got it. So If I want unlimited ranges (same as the vanilla game), I should set the number to 200?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #8 on: June 03, 2020, 12:12:33 pm »
yes

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #9 on: June 03, 2020, 01:12:20 pm »
I think my problem lies in my metadata file, because If I straight up replaced the files in TWOTS, it works

This is what I currently have

https://www.dropbox.com/s/4mcwi9lprk0anua/metadata.rar?dl=0

How do I properly tell my mod to use TWOTS as a master?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #10 on: June 03, 2020, 01:35:34 pm »
I think my problem lies in my metadata file, because If I straight up replaced the files in TWOTS, it works

If you replace the files directly in twots, then you are not making a submod of twots, you're simply just changing twots.
It's same as if author of twots made the changes himself.

How do I properly tell my mod to use TWOTS as a master?

Twots is not a master mod, so you can't use it as master mod.
And even if twots was a master mod, it would still not change anything for you... the sprites would still NOT be shared.


Proper way of doing a submod is changing only what you need to change, and leave everything else unchanged.

WRONG example:

Code: [Select]
items:
  - type: STR_HARP
    categories: [STR_DUALENV_WEAPONS]
    size: 0.1
    costBuy: 2000
    costSell: 1700
    weight: 4
    bigSprite: 130
    floorSprite: 132
    handSprite: 1119
    fireSound: 84
    accuracySnap: 65
    accuracyAimed: 85
    tuSnap: 35
    tuAimed: 75
    compatibleAmmo:
      - STR_HARP_CLIP
      - STR_HARP_CLIP_E
      - STR_HARP_CLIP_ST
    bulletSprite: 12
    bulletSpeed: -1
    battleType: 1
    twoHanded: true
    invWidth: 1
    invHeight: 3
    armor: 30
    listOrder: 1906
    recover: true

CORRECT example:

Code: [Select]
items:
  - type: STR_HARP
    maxRange: 200   # was 20
    aimRange: 200   # was 18
    snapRange: 15   # was 10

Offline yhe1

  • Sergeant
  • **
  • Posts: 48
    • View Profile
Re: making a submod for TWoTS
« Reply #11 on: June 03, 2020, 01:52:05 pm »
got it, does the file name of the ruleset matter? Or will it be read regardless?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: making a submod for TWoTS
« Reply #12 on: June 03, 2020, 01:56:34 pm »
got it, does the file name of the ruleset matter? Or will it be read regardless?

the file name doesn't matter