Community Forum

Egg Box

Forum Overview >> Scripting

CategoryScripting
Created13.02.2019 18:11


Paul Laverick (Unknown) 13.02.2019 18:11
Hello,
I am working on changing the chickens so they use a pallet rather than a box.

I have copied all the files, left as is, apart from the files needed (adding $data) and all works OK.

One by one I have been altering the files used. The i3d file changes ok
I get an issue when I want to change the eggbox XML

Original: filename="$data/objects/pallets/eggBox/eggBox.xml"
New: filename="eggBox/eggBox.xml"

I get "Failed to load XML file 'eggBox/eggBox.xml'"

If I go full path: filename="Z:\Paul\Documents\My Games\FarmingSimulator2019\mods\PL19_Animals\eggBox\eggBox.xml"
It loads but get the error loadVehicle can only load existing store items

I have include the XML file in the modDesc and even checked it appears by changing the <showInStore>false</showInStore> to true
I can even purchase it!

So, how can I get away from full paths for the XML file?
I know $data is for the main game. Is there a MOD dir version?

Any ideas on changing the XML location?

Many thanks,
Paul

Bilbo Beutlin (BBeutlin) 13.02.2019 19:51
The placeholder is "$moddir$myMod/.."
But this doesn't work in all cases. Try out.

Paul Laverick (Unknown) 13.02.2019 20:06
Yeah, I had found that on the net, but no go...
Looking at the format of mods in vehicles.xml and items.xml I tried
modName="PL19_Animals" filename="$moddir$PL19_Animals/eggBox/eggBox.xml"
but no go... The $moddir$ changes to "moddir$PL19....." so it isn't recognised as a command/shortcut, or whatever...
If it doesn't wok in the all cases, what is the option?
I found a thread on a forum that was doing exactly the same, but that died out with no conclusion.
Thanks for the reply

Bilbo Beutlin (BBeutlin) 13.02.2019 20:31
Try with all XMLs in your mod's root dir (adapt all paths accordingly).

Paul Laverick (Unknown) 14.02.2019 00:51
No go I'm afraid.... I wonder if there is a limitation?

Kevin I. (Ifkonator2) 20.02.2019 15:58
Known BUG by GIANTS, in Patch 1.4 should the BUG has been fixed. Currently you cant load pallets or bales(fixed in final Patch 1.3) from your Map folder.

PinchTheFarmer 21.02.2019 10:16
Best way for now is still to bring yourself the big 10 000 pallets in the zone ! :D

OR Modify in the game directory to have x10000 into the pallets but the problem is that it's only for solo and you have to save files/reset them to go back in multiplayer :D

PinchTheFarmer 05.03.2019 01:15
Hey i thought about something else you can try ! :O

Use the '$data/objects/fillablePallet/fillablePallet.xml' :O but i am not sure that EGG fillType can be considered as BULK, its pallets of 1000 ressources of BULK

PinchTheFarmer 05.03.2019 01:18
I found it ! With Script you can do it ! >> Use the fillablePallet , then with script you ADD the EGG into the BULK categorie :D (it will also make trailers able to carry EGG but well no chance they got them from a silo xD, but maybe you can abuse if you put a trailer/tipper into the pallets area :D )

To add this, i make it short for you , you just need to launch this line in onLoad() function of your mod class script.

g_fillTypeManager.categoryNameToFillTypes['BULK'][14] = true;

This line add EGG into BULK categorie > it will fill a 1000 fillable pallets of eggs normally

I have the whole fillTypeManager table saved in txt if you need, you can see what i put is nice :
Animal Species : printing FillTypeManager
2019-03-04 18:08 .indexToName :: table: 0x0abec6a8
2019-03-04 18:08 . 1 :: UNKNOWN
2019-03-04 18:08 . 2 :: WHEAT
2019-03-04 18:08 . 3 :: BARLEY
2019-03-04 18:08 . 4 :: OAT
2019-03-04 18:08 . 5 :: CANOLA
2019-03-04 18:08 . 6 :: SUNFLOWER
2019-03-04 18:08 . 7 :: SOYBEAN
2019-03-04 18:08 . 8 :: MAIZE
2019-03-04 18:08 . 9 :: POTATO
2019-03-04 18:08 . 10 :: SUGARBEET
2019-03-04 18:08 . 11 :: COTTON
2019-03-04 18:08 . 12 :: SUGARCANE
2019-03-04 18:08 . 13 :: SEEDS
2019-03-04 18:08 . 14 :: EGG
2019-03-04 18:08 . 15 :: WOOL

THEN

2019-03-04 18:08 .categoryNameToFillTypes :: table: 0x0abeca18
2019-03-04 18:08 . BULK :: table: 0x13cae120
2019-03-04 18:08 . 2 :: true
2019-03-04 18:08 . 3 :: true
2019-03-04 18:08 . 4 :: true
2019-03-04 18:08 . 5 :: true
2019-03-04 18:08 . 6 :: true
2019-03-04 18:08 . 7 :: true
2019-03-04 18:08 . 8 :: true
2019-03-04 18:08 . 9 :: true
2019-03-04 18:08 . 10 :: true
2019-03-04 18:08 . 12 :: true
2019-03-04 18:08 . 13 :: true
2019-03-04 18:08 . 19 :: true

As you can see 14->18 is not in bulk (egg/wool/milk/fuel & etc), you just add it and it can work :) even in multiplayer because its script and you use original fillablePallets

ALSO, maybe you may need to add a palletname into the filltype, they don't have the attribute (the wool too dont have) , if it dont work without, try without 1st, with this line:

g_fillTypeManager.fillTypes[14].palletFilename = 'data/objects/pallets/fillablePallet/fillablePallet.xml';

Like that, do not put '$data/....' the $ is for XML files. You are integrating things into core engine here with script :D

if you want to see the whole class :
DebugUtil.printTableRecursively( g_fillTypeManager, "-", 5, 10); --It is that i saved into a file ^^

PS : Animal Species - PIG PACK is released soon (when mod sites will add it, surely 05/03/2019 ^^), it add x8 new pigs to buy !

PinchTheFarmer 05.03.2019 02:20
Try my way first, but in fact with Scripting, maybe you can modify it in core engine i think (like animals, you cant from XML, but in script...i added 8 new type of pigs (check Animal Species : v2 and Pig Pack, both compatible) and loaded animals from XML, so maybe you can with this class )

Look here, if you want more than 1000 units pallet after my 1st way :
https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=84&class=8382#load134734

Leonardo Ravetto (Unknown) 10.07.2019 08:45
I haven't got a code for editing.

goodbye
Leonardo Ravetto



Note: Log in to post. Create a new account here.