Community Forum

FS13: Bga silos, function priority

Forum Overview >> Scripting

Created23.03.2015 15:42

Bilbo Beutlin (BBeutlin) 23.03.2015 15:42
Unluckily the standard Bga silos can't be filled with a frontloader shovel. In my eyes a bug ;)

Now I want to add this feature. What's to do? Is there an easy way with a few additional entries in i3d or xml?
I tried already a few things like eg. adding a 'shovelTarget', but didn't work.

Else I plan to improve the script "objects/BunkerSilo.lua", where a support for shovel with silage already exists.
If I put the new "BunkerSilo.lua" into same folder as the map.i3d, will this have priority against the default script?

Or can I add a script "BunkerSilo.lua" in user mod folder to overwrite the default?

In general the question: where does the engine lookup for certain scripts and in which order/priority?

Emil Drefers (Unknown) 23.03.2015 17:15

to get to work you would have to write a new script.

You should never put any modifications into the default folder of FS, becaus ethis can break the MP!
Also you would need to reinstall the game if you don't make a backup of the file you overwrite.
So put all modfications into the mod folder.

The order gets important if two mods overwrite the same basic functionality.
Otherwise you can just place the new script in a mod in your mod folder.
Overwriting default functions is pretty common ... well, at least for some mods ;)

Nontheless it might make sense to create a new "BunkerSilo script" so that the default functionality stays the same.


Bilbo Beutlin (BBeutlin) 23.03.2015 18:15
No - I didn't intend to write directly into FS13 installation folder. Though I'm playing with a copy of install. on SSD - the main install. remains as backup ;)

I found already mods, which add another, new script and overwrite default functions like eg.
BunkerSilo.update = myBunkerSilo.update; -- etc.
However that's stuff, which has to be loaded additionally to the default script.
Where I meant directly replacing the default.

The question is: does FS13 accept scripts (same name, but other path) instead the defaults, if I put them
a) into the map folder together with the map, eg. "myModMap.i3d" and "BunkerSilo.lua"
b) into user mod folder, eg. "BunkerSilo/BunkerSilo.lua"
since the default scripts have a path like "dataS/scripts/objects/..", whereas the i3d user attributes have no path, eg. merely "BunkerSilo.onCreate".

Means, has FS13 a 'search path' (similiar to an OS), where and in which order scripts are searched.

Emil Drefers (Unknown) 24.03.2015 08:11

now i got you ;)

Yes, both approaches a) and b) should work.

For case b) you can do something like "MyMod.onCreate."
The default (overwritten) name won't work in this case.
Here is an example.

For case a) I'm not 100% sure, because I never used that.
I think it's way more convenient to have scripts independent of the map, because this makes updates and patches much simpler (few kB VS. hundreds of MB ;) )


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