|Olivier Beauchemin (obeauchemin)||26.11.2021 09:46|
I'm a beginner here, and I'm trying to learn how to make good scripts in Farming Simulator.
I want to make a script to increase the unloading time of all trailers (empty speed value in the XML).
I successfully found the correct function to overwrite. I think it is:
Dischargeable:loadDischargeNode(xmlFile, key, entry)
I take my inspiration from a script named "Increased Fuel Consumption" by Realism Modding.
So yeah, I'm a little lost. I just passed the three last hours to dump variables and data but I think I need a tip/advice to continue my work.
function IncreasedUnloadingTime.inj_loadDischargeNode(vehicle, superFunc, xmlFile, key, entry)
superFunc(vehicle, xmlFile, xmlFile, key, entry)
Dischargeable:loadDischargeNode = Utils.overwrittenFunction(Dischargeable:loadDischargeNode, IncreasedUnloadingTime.inj_loadDischargeNode)
TypeManager.validateTypes = Utils.prependedFunction(TypeManager.validateTypes, IncreasedUnloadingTime.installSpecializations)
I don't think my function has the correct arguments. Here is the error I receive:
IncreasedUnloadingTime.lua:61: function arguments expected near '='
Honestly, I'm a little lost, and any help can be appreciated
|Bilbo Beutlin (BBeutlin)||26.11.2021 13:00|
|1. your superFunc() call has the argument 'xmlFile' twice
2. "Dischargeable:loadDischargeNode = .." is wrong. It must be a dot '.' instead colon ':'.
|Olivier Beauchemin (obeauchemin)||26.11.2021 22:22|
|Oh right, thanks. This fixed the error.
Do you think that overwriting Dischargeable.loadDischargeNode is a good way to modify the "emptySpeed" value?
Maybe I should load all the trailers instead, then load the dischargeableConfiguration ...
|Bilbo Beutlin (BBeutlin)||26.11.2021 22:52|
|Many roads lead to Rome, but IMO it's always better to change possible vehicle values directly in the vehicle.xml instead by a global script.
|Olivier Beauchemin (obeauchemin)||27.11.2021 01:49|
|I can understand that, but I need to change every trailer. Modifying a mod like that means that you need to send the mod to every player on your server. It also means that you will not take advantage of the new feature that FS22 offers (Downloading all mods of a server automatically). Only the mods on the Modhub are supported...
I want to modify the emptySpeed value by a percent, so all futures mods and all vanilla trailers in the base game will be affected.
Note: Log in to post. Create a new account here.