Category | Farming Simulator 19 |
Created | 30.05.2020 22:48 |
Dominik C (acert) | 30.05.2020 22:48 |
---|---|
Cheers, I added a new LUA script to my tractor. on "function screenCapacity:onUpdate(dt)", how can i get the filllevel amount of an ATTACHED trailer, filled with wheat, grass, manure etc.? greetings |
Bilbo Beutlin (BBeutlin) | 31.05.2020 03:31 |
---|---|
You need to scan all attached trailers, check for 'spec_fillUnit' and read out the fillLevels. Useful functions in https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=70&class=10546 |
Dominik C (acert) | 01.06.2020 19:17 |
---|---|
Thx, i got it for work! Everything is fine, but i also want the filllevel in percent %. but it only shows me the fill level again. where is the problem? here is the script: for _,fillLevelInformation in pairs(fillLevelInformations) do hudCapacity = fillLevelInformation.fillLevel hudPercentage = fillLevelInformation.fillLevel / fillLevelInformation.capacity if hudCapacity > 0 then VehicleHudUtils.setHudValue(self, self.capacity, hudCapacity , 100); VehicleHudUtils.setHudValue(self, self.capacityPercent, hudPercentage , 100); end end it shows me at self.capacityPercent the same value as by capacity. But i want there the percent ?! Thx |
Bilbo Beutlin (BBeutlin) | 02.06.2020 02:36 |
---|---|
From where do you get 'fillLevelInformations'? If you use the function FillUnit:getFillLevelInformation() related to a certain vehicle/trailer, you must write ---------- local fillLevelInfos = {} vehicle.spec_fillUnit:getFillLevelInformation(fillLevelInfos) for _,fillLevelInformation in pairs(fillLevelInfos) do local cap = fillLevelInformation.capacity local level = fillLevelInformation.fillLevel local percent = level/cap ... ---------- Beneath, in your above code you have assigned hudCapacity = fillLevelInformation.fillLevel That's probably not what you wanted? *g* |
Note: Log in to post. Create a new account here.