Jump to content

waterFunc - GUI driven water level control


shrike

Recommended Posts

waterFunc

WaterFunc is a simple script to control the water level in MTASA. It's available on the community Resources page.

The script is configured to be restricted to the admin group. You can change this if you wish, but several people

trying to run the functions at the same time won't work.

Make the following changes to acl.xml (server cannot be runnning)

Add the following line to the admin group:

Add the following line to the admin access control list:

When the script is running, press the F6 key to access the gui menu. You can then:

Set the water level (plus or minus) for the whole map.

Surge (raise) the water level by n.

Ebb (lower) the water level by n.

Set a tide cycle. The water level is cycled up and down by the value specified. Setting the value to 0 will

stop the tide function when the water level returns to the starting point of the cycle.

Set a wave height value. I find the water movement looks more realistic with this turned on.

5 different water speeds. The "x5" speed makes the water movement a bit twitchy.

Echo to Screen creates a small window under the radar displaying the water level. You can then close

the main gui window while a function is running.

Reset water level. Kills the current water level function and restores all vars to default settings.

Using the Flood, Surge, Ebb and Tide functions, a water element is created automatically for water levels greater than 0

and destroyed for water levels less than 0.

I'll be the first to acknowledge that the script is not well written and could be improved. Everything seem to work well enough, but if there's a problem the reset button should correct any water function problems. If not, re-start the script.

Feel free to use this code as you wish. I studied many other scripts while learning to code in LUA, and have borrowed

coding styles and naming conventions.

(thanks, Remp, for the tidy coding style in your snow script and for one of the best GUI's I've seen)

This has only been tested on a small server with a couple of players. I have no idea how well it will work

in a many player, multi script environment.

I'm open to suggestions and problem reports but I can't promise the script will be maintained/updated regularly.

I may add other features to the script at a later date.

Edited by Guest
Link to comment

Thanks, Noddy for the positive comment and to DNL291 for adding the link to the resource. I meant to do that when I uploaded the script but forgot.

I hope some people will provide feedback on how it runs, especially on a server with multiple players. I have no way to test the script under load and I'm curious as to the impact on a busy server since the functions all run server-side.

Link to comment

Noddy, I'll see if I can create and upload some shots. As this is the first script I've uploaded, I'm working out the process as I go.

eAi, I don't know that it has to be admin only. It runs server side and I imagined it would be used as part of a flooded world scenario and would be run by the admin(s) only as part of the environment. I suppose if it were re-written to run client side instead individual users could run it as they wish.

It's only been tested on a private server with 1 or 2 users. I might make changes/additions based on enough feedback from people using it, or others might modify the script to suit their own purpose.

Link to comment

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.
×
×
  • Create New...