Category | Farming Simulator 17 |
Created | 04.10.2017 14:20 |
Derk Schooltink (Unknown) | 04.10.2017 14:20 |
---|---|
How do I get the current fill level of a trailer in a LUA script? The use-case is being able to animate certain things based on the fill level. I've looked through the API and I've found getAttachedTrailersFillLevelAndCapacity(), but I'm not quite sure how to access this? I'm currently relying on updating the value in the Vehicle#update() method, how do I get the fill level from there? |
Emil Drefers (Unknown) | 04.10.2017 15:06 |
---|---|
Hi, please take a look at the Fillable.lua https://gdn.giants-software.com/documentation_scripting.php?version=script&category=70&class=3476#getUnitFillLevel46900 Fillable adds the table self.fillUnits to the vehicle's table. Every fillUnit can have a fillLevel and a fillType ... To get the overall fillLevel you could do something like: local fillLevel = 0; for fillUnitIndex,fillUnit in pairs(self.fillUnits) do fillLevel = fillLevel + self:getUnitFillLevel(fillUnitIndex); end renderText(0.5, 0.5, 0.02, string.format("overall fillLevel = %.2f", fillLevel)); But that's only for one vehicle ;) Cheers, Emil |
Note: Log in to post. Create a new account here.