churchill

[REL] Churchill's BetterWeather system v1.0

Recommended Posts

http://community.mtasa.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:

342.png

The Tomorrow and Day After tabs just show day and night time weather - so they both generally look like this:

343.png

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post

And wouldn't you have to continually place the colshape because you can't move them?

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

Is it possible to make it work with MTA v1.0.4?

Or I'm too stupid for it?

Share this post


Link to post
OMG, this is a topic of 2008! also it has many bugs on it.

This is why I ask :D

Share this post


Link to post
OMG, this is a topic of 2008! also it has many bugs on it.

This is why I ask :D

OMG SO OLD LOL LOL LOL :lol:

Share this post


Link to post
Thanks for the helpful answer.

My pleasure.

Share this post


Link to post

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^^

Share this post


Link to post

[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 '?'

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.