Category | Farming Simulator 19 |
Created | 09.05.2019 19:23 |
Patrick Freye (Unknown) | 09.05.2019 19:23 |
---|---|
Hello, how can I get the current weather (SUN, CLOUDY, RAIN) per LUA? Greetings Patrick |
Bilbo Beutlin (BBeutlin) | 09.05.2019 19:46 |
---|---|
See LUADOC -> weather -> WeatherTypeManager The game variables and functions are somewhere in "g_currentMission.environment". Examine it (list/print table) to find suitable items. |
Patrick Freye (Unknown) | 11.05.2019 09:28 |
---|---|
First, thanks for your answer. Exactly this is my problem. I canĀ“t find a variable thats represent the current weatherType or any other way to find out it. Did you have another idea for me? |
Gtx | Andy (GtX_Andy) | 14.05.2019 03:31 |
---|---|
Hey Patrick, To find the current 'weatherType' you can use the following. local environment = g_currentMission.environment local weatherType = environment.weather:getWeatherTypeAtTime(environment.currentDay, environment.dayTime) With this you can then do one of the following. If you want to know then name of the weatherType you can use this. local weatherTypeName = g_weatherTypeManager:getWeatherTypeNameByIndex(weatherType) If you want a certain operation for this weatherType then you could compair it like this. if weatherType == WeatherType.RAIN then -- Your Code Here end The Base Game weatherTypes are as follows WeatherType.CLOUDY WeatherType.RAIN WeatherType.SUN 'WeatherType' is equal to 'g_weatherTypeManager.nameToIndex' so any new types added will be available here. e.g WeatherType.SNOW (If added!) If you want to check for available weatherTypes you can use this function. local weatherTypes = g_weatherTypeManager:getWeatherTypes() I hope this helps ;-) Regards, GtX https://github.com/GtX-Andy |
Note: Log in to post. Create a new account here.