Community Forum

high pressure washer

Forum Overview >> Scripting

CategoryScripting
Created30.05.2015 03:14


Bilbo Beutlin (BBeutlin) 30.05.2015 03:14
I want to implement the Kaercher high pressure washer from FS13 on a service car and trailer in FS15.
Models and animations are working already, but the washing doesn't.
Due to lack of FS15 documentation I'm still using the original FS13 script "PressureWasher.lua".
The script uses "washable:decreaseDirt(dt)" and since there's no LUA error, the function seems to exist but most probably the arguments are wrong.
What is the right method to get the washing to work?

Emil Drefers (Unknown) 15.06.2015 07:45
Hi,

as the script documentation is online now:
http://ls-mods.de/scriptDocumentation.php

I assume your question is obsolete.
Nonetheless ... Washable:setDirtamount(dirtAmount, force) would be thee function to call.

Cheers
Emil

Bilbo Beutlin (BBeutlin) 17.06.2015 13:54
I see :)
Unluckily the new script istn't compatible with the old FS13 (mod) method. *sigh* I'll have to write my own script based on "HighPressureWasherPlaceable.lua".

What I don't understand: the new "Washable.lua" doesn't have a function 'decreaseDirt()' - shouldn't I get a LUA error when calling like above "washable:decreaseDirt(dt)"?

Emil Drefers (Unknown) 17.06.2015 15:08
Hi,

depending on which object you call "decreaseDirt" on you will get an error, yes.

You can use "getDirtAmount()" to get the current "dirtAmount".
Afterwards you just call "setDirtAMount(dirtAmount, dt)" to apply the new value ... however you have calculated/changed it ;)

Cheers,
Emil

Bilbo Beutlin (BBeutlin) 17.06.2015 15:45
Well, after I've read the new script, it won't work together with the LS13 script if slightly modified. There are too many changes to be considered.
Would be much easier to use "HighPressureWasherPlaceable.lua" as template, adapted on vehicle types.

Just another idea: if I take the original LS15 placeable washer, put it on pallet, mod'it to dynamic instead static, etc. - would this work? Means: having a placeable object that is 'dynamic', can be moved/transported?

Emil Drefers (Unknown) 18.06.2015 07:38
Hi,

you can't use the script directly because it is derived from Placeable.
But you could reuse a lot of the script for your own custom script.

If a placeable can be dynamic ... hmmmmm.
Maybe in SP, but in MP it won't work correctly because the synchronisation of the object's position is missing.


Cheers,
Emil

Bilbo Beutlin (BBeutlin) 18.06.2015 13:30
Yet another problem:
I wanted to modify the original kaercherHDS918-4M, so copied the required files and created a modDesc.xml with
<extraSourceFiles>
<sourceFile filename="$data/scripts/placeables/HPWPlaceableStateEvent.lua" />
<sourceFile filename="$data/scripts/placeables/HPWPlaceableTurnOnEvent.lua" />
<sourceFile filename="$data/scripts/placeables/HighPressureWasherPlaceable.lua" />
</extraSourceFiles>

Appears in store, but all I get if I want to buy:
Error loadVehicle: invalid vehicle config file '../kaercherHDS918-4M.xml', no type specified
Why that? It is the original kaercherHDS918-4M.xml with
<placeableType>highPressureWasher</placeableType> .. tried also with uppercase HighPressureWasher
The HighPressureWasherPlaceable.lua should it register with "HighPressureWasher".

PS
Reason: the scripts couldn't be loaded. Tried also "$dataS/..." etc.
Must I really copy these scripts into mod folder? No way to access these in program directory?

Emil Drefers (Unknown) 19.06.2015 07:40
Hi,

please have a look at a placeable mod to see which entries are required:
http://www.landwirtschafts-simulator.de/mod.php?lang=de&mod_id=11055&title=fs2015

Cheers,
Emil

Bilbo Beutlin (BBeutlin) 19.06.2015 11:52
Yes, I'm aware what is necessary for a placeable object.
The problem is, that
<sourceFile filename="$dataS/scripts/placeables/HighPressureWasherPlaceable.lua" />
probably doesn't work, where the class "HighPressureWasher" is defined.

So I get always the
Error loadVehicle: invalid vehicle config file '../kaercherHDS918-4M.xml', no type specified
The orig. kaercherHDS918-4M.xml defines <placeableType>highPressureWasher, though the original LUA defines it as uppercase. So I'm a little confused, because I found the class name case sensitive, isn't it?

I first tried without the extra source file/s, assuming <placeableType>highPressureWasher does automatically load the appropriate LUA, but gives the same error.
Also tried with an extraSourceFile scriptLoad.lua, where the orig. LUAs are loaded with source("dataS/scripts/placeables/HighPressureWasherPlaceable.lua") etc.

Meanwhile I got my service car with the washer to work, using the HighPressureWasherPlaceable.lua as template. However I had to overwork the code massively. ;)
I think, I could use it also for a placeable with minor changes.

Nevertheless I'm very interested in knowing what goes wrong with the above placeable mod. ;)

Emil Drefers (Unknown) 19.06.2015 13:54
Hi,

if the placeableType is unknown an apropriate error message will be printed.

The message
Error loadVehicle: invalid vehicle config file '../kaercherHDS918-4M.xml', no type specified
indicates that the game tries to actually load a vehicle not a placeable.

So there must be an error somewhere ;)

Cheers,
Emil


Bilbo Beutlin (BBeutlin) 19.06.2015 14:44
It's similiar to this thread: http://gdn.giants-software.com/thread.php?categoryId=20&threadId=2191
If I change in the XML <placeableType>highPressureWasher to placeable, I can buy the thing and no error occurs. But the washing doesn't work and like described above, I can't force loading the script:
Error: Can't load resource 'G:/LwSim2015_Mods//KaercherHDS918/$dataS/scripts/placeables/HighPressureWasherPlaceable.lua'

Ugly - in all other XML tags the $dataS/.. will load from program directory, but here it doesn't. Look like a bug for me. ;)
That means, _all_ lua stuff has to be inside the mod's folder, even if using default/standard scripts.
Unluckily there's no simple method for placeables like the vehicles' <vehicleTypes> specializations.

Bilbo Beutlin (BBeutlin) 19.06.2015 15:39
Update:
Since I found in several mods the tag <species>, I tried with
modDesc.xml: <species>highPressureWasher</species>
kaercherHDS918-4M.xml: <placeableType>highPressureWasher</placeableType>

With this I get no error .. now the game simply crashes/freezes *lol*

Bilbo Beutlin (BBeutlin) 20.06.2015 22:19
Problem solved (after various experiments).
The modDesc.xml must merely have the tag <species>placeable</species>
Then it works with the washer.xml tag <placeableType>highPressureWasher</placeableType>

That's quite confusing when you're used from vehicle XMLs to apply the same types in modDesc and vehicle.


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