OpenXcom Forum
Modding => Help => Topic started by: The Martian on November 16, 2017, 09:00:21 am
-
I've been trying to add a new manufacturing project via a custom Mod.
What I've done so far is create a directory called "./Test/" and place inside it a directory called "./Ruleset/".
In that directory I created two .rul files:
extraStrings_US_MR.rul <---(Holds the new STR variables and their assigned values, in this case the name of the item to be manufactured.)
manufacture_MR.rul <---(Holds the new manufacturing project.)
Contents of extraStrings_US_MR.rul:extraStrings:
- type: en-US
strings:
STR_TEST: "Test"
Contents of manufacture_MR.rul:
manufacture:
- name: STR_TEST
category: STR_HEAVY_WEAPONS_PLATFORM
space: 25
time: 1
cost: 10
listOrder: 50500
producedItems:
- STR_TANK_LASER_CANNON
When I toggled the Mod on in the OpenXcom options menu the following error was displayed:
Loading OpenXcom 1.0.132671d50 (2017-11-02 21:30) . . .
ERROR: failed to load 'test' mod disabled for next startup
/home/___/local/share/openxcom/mods/Test/Ruleset/extraStrings_US_MR.rul: error at line 4, column 4: end of sequence not found
Trying to debug my failure I've looked at the code in a few other user mods and as far as I can tell they're use of extraStrings: is basically identical in structure.
Could someone please point out the formatting mistake I'm making?
-
I changed extraStrings_US_MR.rul so that instead of 1 tab and 2 spaces it is now indented using only spaces and the error message is no longer being displayed.
(From what I've read the YAML (https://en.wikipedia.org/wiki/YAML) language which OpenXcom uses for *.rul files does not like tabs.)[/size]
However now I've encountered an additional problem.
When I load a game with the Test mod switched on and open the manufacturing menu the Test entry is there, but after selecting the project and clicking "Start Production" OpenXcom freezes.
In the openxcom.log file one of the last entries lists:
[16-11-2017_02-08-23] [FATAL] OpenXcom has crashed: Item STR_TEST not found
I though I'd defined the STR_TEST value inside the extraStrings_US_MR.rul file, do I need to also define it again elsewhere?
-
Mind uploading your rulesets? It'll help us debug it too
-
Uploaded as requested.
-
After thinking about the error message found in the openxcom.log file, I just tried creating a third *.rul file called: items_MR.rul
This file has the following code in it:
items:
- type: STR_TEST
size: 0.0
listOrder: 427500
When I combined this with the other two files the Mod no longer freezes when "Start Production" is clicked.
However instead of creating STR_TANK_LASER_CANNON (Which I'm assuming is a Laser Tank) it creates an item called "Test" instead.
I thought I was defining the manufacturing projects name with the extraStrings: not the item to be produced itself.
What I'm trying to do with this Test Mod is create a manufacturing project that builds 1 Laser Tank.
As there is already a manufacturing project to create Laser Tanks found in X-Com I'm trying to give the Test version of this manufacturing project a different name than just "Laser Tank" so they can be differentiated between easily.
-
Perhaps I'm using the producedItems: variable incorrectly so it is defaulting to building the item referenced in the name: variable instead?
Is there away to assign an amount to the produced items listed in the producedItems: variable?
For example something like:
manufacture:
- name: STR_TEST
category: STR_HEAVY_WEAPONS_PLATFORM
space: 25
time: 1
cost: 10
producedItems:
- STR_TANK_LASER_CANNON = 3
- STR_TANK_PLASMA_CANNON = 2
-
The syntax in your producedItems is wrong, so it defaults to making one of the item with the same type as the name of the manufacturing project. Try
manufacture:
- name: STR_TEST
...
producedItems:
STR_TANK_LASER_CANNON: 1
The syntax issue is that using '-' before each line makes the YAML library read it as a list, when the code for loading manufacturing projects looks for a map of a number on to an item's type.
-
Thank you! ^_^
The manufacturing project functions as intended now.