Author Topic: Comment Out A Avariable  (Read 1724 times)

Offline Sammy

  • Squaddie
  • *
  • Posts: 1
    • View Profile
Comment Out A Avariable
« on: December 10, 2022, 03:21:33 am »
What would be the way to override a line? I am trying to make a weapon mod, just startin out, and so I started with the thermal tazar cause I wanted it to work one handed. SHould be easy. I did not add a line for twohanded as I thought the new lines in the mod file would override the entire thermal tazer lines in the vanilla file. Did not, so I went back and added the twohanded: false line and now it works one handed. But how do I do this for something that is not a true false choice? Like I don't want a line to apply, but there isn't an opposite term like true vs. false, so I can't just add something opposite. I just want the original line gone withjout deleting it in the vanilla file. Web search said I could use [] for an empty set. But when I cheked in game that did not work. Obviously must be a simple way.

Only other option I see is to use something liek  "- delete: STR_LIVING_QUARTERS". I am not trying to remove living quarters, thats just the example given.
« Last Edit: December 10, 2022, 03:43:50 am by Sammy »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Comment Out A Avariable
« Reply #1 on: December 20, 2022, 03:21:06 am »
In the case of variables that have a numerical value you could try returning them to their default value.

The default values can be found here: Ruleset Reference





I may have misunderstood what you meant by overriding a line but judging from your post topic you tried doing something like this?

Code: [Select]
  - type: STR_THERMAL_TAZER
    size: 0.1
    costBuy: 1260
    costSell: 945
    weight: 6
    bigSprite: 26
    floorSprite: 26
    handSprite: 152
    meleeSound: 60
    power: 80
    damageType: 6
    accuracyMelee: 100
    skillApplied: false
    tuMelee: 40
    battleType: 3
#    twoHanded: true
    invWidth: 1
    invHeight: 3
    clipSize: -1

Although commenting out twoHanded: true would remove it from your mod, the base games value for that variable would remain.

When you create a mod all of the values from the base game's .rul files are imported, and then the changes your mod causes overwrite those values afterward.

For example the item STR_STUN_ROD has the variable bigSprite: set with a value of 26 in the base game's files.

If you create a mod that has an entry in items: with the same name as STR_STUN_ROD it will modify the existing STR_STUN_ROD from the base game with any changes you make. (All non-changed variables remain.)

For example if the bigSprite: was changed to 263 by a mod:

Code: [Select]
  - type: STR_STUN_ROD
    bigSprite: 263


The rest of the values would still be present for STR_STUN_ROD even though they are not added by the mod as they are already loaded from the base game's .rul files.

Also note that if you created a new entry in your mod that does not use the same name as any found in the base game's .rul files not all of the values will be blank. Instead they will have their default values loaded.

For example if you made a mod and created a new entry in items: and did not define transferTime: and this new entry was not already present in the base game's .rul files the default value of transferTime: would be already configured to 24.


I suggest taking a look at the Ruleset Reference for OpenXcom found on the ufopaedia.org site.


It lists the default values for the variables found in OpenXcom's .rul files along with a lot of other useful information.


In my opinion it is a must have resource if you are creating a mod.


And as you said you can also "- delete:" any entry from the base game and then make a new one with that name if you wanted.
« Last Edit: December 20, 2022, 08:12:53 am by The Martian »

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Comment Out A Avariable
« Reply #2 on: December 23, 2022, 02:56:30 am »
All fields must have some meaningful value. But usually you only need to set values for fields that actually matter in your ruleset.
If it’s a changed object, whatever was not redefined in your mod will retain values from the master ruleset where the object was first defined.
If a field was not assigned values in any ruleset, it will have default (hardcoded) value. Most of them are not set anywhere, indeed. I mean, just look at the huge list The Martian linked. With 4 ammunition slot per weapon, customized damage types, etc. With vanilla ruleset it just works on defaults.