churchill Posted August 9, 2008 Share Posted August 9, 2008 https://community.multitheftauto.com/index.php?p=resources&s=details&id=199 My first attempted resource/script - something basic, but might be useful to others. I've noticed that most weather scripts seem to be a bit basic in that they just randomly change the weather at a fixed time. Sometimes they go one step further and change it at a random time. What this resource does is attempt to mimic weather patterns by setting today's weather but also pre-defining potential weather for 2 days ahead, for both the day and night weather. When the weather updates each day it's based on these pre-defined "predictions". As with real weather, it's not 100% accurate - sometimes the weather prediction can be wrong for the days ahead when we actually get to tomorrow or the next day It is also a little random in that it won't change at a set time every day/night. Day time changes come into effect between 7am and midday. Night time weather comes into effect after 8pm, but before midnight. Included in the resource is weather report window, activated by hitting F5, but that key is defineable in an optional.xml config file, if you unzip the file into a folder. Additionally, the resource has export functions so that you can send weather descriptions (or IDs) for the days ahead to other resources. I can think of one or two examples where you might want to do that, but I'm not going to give away ideas Note: it only uses one timer at any time, but is set 3 times over the course of a 24 minute day, for the midnight update, daytime update, and evening update. Second note: I noticed while testing this that the client time seems to slowly go out of sync compared to the server time. because of this, I've added a setTime(getTime()) at the point of each update, in order to keep the server/client times in sync a bit better. Comments welcome, either here or in the resource comments. Please report bugs, or suggestions for improvements! Screenshots The Today Tab changes slightly depending on the time of day you view it. It displays overnight weather alongside the day and evening weather if you're viewing in the early hours of the morning, or just the night weather if you're viewing it after about 7pm onwwards: The Tomorrow and Day After tabs just show day and night time weather - so they both generally look like this: Link to comment
Gamesnert Posted August 9, 2008 Share Posted August 9, 2008 Looks pretty good! I'll test it soon Link to comment
churchill Posted August 10, 2008 Author Share Posted August 10, 2008 first bug reported: triggering the report made it appear on ALL connected clients, not just for the person who pressed the button. Silly n00b mistake This has now been fixed as of v1.0.1, which is now available in the resource library. Link to comment
Simbad de Zeeman Posted August 18, 2008 Share Posted August 18, 2008 When is the new release? how about adding weather zones? sandstorms? Link to comment
Ace_Gambit Posted August 18, 2008 Share Posted August 18, 2008 how about adding weather zones? This could be possible. But don't forget that weather is global. Link to comment
Mr.Hankey Posted August 18, 2008 Share Posted August 18, 2008 if you use the setWeather command client-side and add a few huge moving colshapes so the weather changes for you if you enter one of these it should be possible Link to comment
churchill Posted August 18, 2008 Author Share Posted August 18, 2008 if you use the setWeather command client-side and add a few huge moving colshapes so the weather changes for you if you enter one of these it should be possible they'd have to be pretty large colshapes, wouldn't they? but I guess you're right. Link to comment
churchill Posted August 18, 2008 Author Share Posted August 18, 2008 if you use the setWeather command client-side and add a few huge moving colshapes so the weather changes for you if you enter one of these it should be possible they'd have to be pretty large colshapes, wouldn't they? but I guess you're right. Are sandstorms predictable, or should they be random events when in the desert? Link to comment
haybail Posted August 19, 2008 Share Posted August 19, 2008 And wouldn't you have to continually place the colshape because you can't move them? Link to comment
Mr.Hankey Posted August 19, 2008 Share Posted August 19, 2008 sure but it should be ok if you move the shape every 30 seconds for about 100 units Link to comment
churchill Posted August 19, 2008 Author Share Posted August 19, 2008 So, I would keep the world weather as server side, but if you enter a colshape that randomly moves across the desert region, it sets the weather on the client side to sandstorm for that user. When they leave the colshape, the weather reverts back to the server weather? Sounds straight forward enough. I'll add it to my to-do list. Link to comment
Ace_Gambit Posted August 19, 2008 Share Posted August 19, 2008 I wouldn't use collision shapes though. Don't forget that a massive collision shape can cause script lag due to the fast amount of call backs from vehicles/players entering the shape. If you start moving the shape it can get even worse since it will start making the same call backs all over again. My advice would be to setup a pulse timer and periodically check the player position. Link to comment
CMD Posted January 27, 2011 Share Posted January 27, 2011 Is it possible to make it work with MTA v1.0.4? Or I'm too stupid for it? Link to comment
Castillo Posted January 27, 2011 Share Posted January 27, 2011 OMG, this is a topic of 2008! also it has many bugs on it. Link to comment
CMD Posted January 27, 2011 Share Posted January 27, 2011 OMG, this is a topic of 2008! also it has many bugs on it. This is why I ask Link to comment
qaisjp Posted March 7, 2011 Share Posted March 7, 2011 OMG, this is a topic of 2008! also it has many bugs on it. This is why I ask OMG SO OLD LOL LOL LOL Link to comment
qaisjp Posted March 8, 2011 Share Posted March 8, 2011 Thanks for the helpful answer. My pleasure. Link to comment
CMD Posted August 2, 2011 Share Posted August 2, 2011 Is anyone able to make the script functional? [Edit] Ok i found the bug and fixed it. Here you can download the fixed Version. betterweather-fixed.zip I hope that works^^ Link to comment
Bolt CM Posted February 10, 2018 Share Posted February 10, 2018 [05:20:59] WARNING: Script 'betterweather/BetterWeather.lua' is not encoded in UTF-8. Loading as ANSI... [05:20:59] SCRIPT ERROR: betterweather/BetterWeather.lua:1: unexpected symbol near '?' [05:20:59] ERROR: Loading script failed: betterweather/BetterWeather.lua:1: unexpected symbol near '?' Link to comment
Castillo Posted February 11, 2018 Share Posted February 11, 2018 Have you seen the topic start date and when was the last reply? Link to comment
Captain Cody Posted February 12, 2018 Share Posted February 12, 2018 Tis but 7 years. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now