Registered User
|
 |
Join Date: Sep 2004
Posts: 5,260
|
|
Quote:
Originally Posted by TSAdmin
I made a weather system that was not even noticeable to cause local or server lag but the whole thing is compiled on my dev server which has no time and I have no backups of it sadly. I didn't touch it for a while but I was tempted to take it further and make the weather locally on the client reflect the client's actual location weather. EG: Contacting a weather site via script, retrieve the current weather in the client's location, and they'd see that weather on their screen. But that's another story.
Point is, it's entirely possible to have a fully functioning weather system that works for all seasons and definitely possible to split up into sections on the gmap. It'd work even better for gmaps that have say different style islands such as an Amazonian style island to the east that's rainy often and a desert island to the west that is constantly dry but has dust storms, etc etc.
|
HTML Code:
//#CLIENTSIDE
function onCreated() {
this.w_drizzle.particles = 30;
this.w_drizzle.image = "weather_raindrop.gif";
this.w_drizzle.control = 1;
this.w_rain.particles = 130;
this.w_rain.image = "weather_raindrop.gif";
this.w_rain.control = 2;
this.w_snow.particles = 10;
this.w_snow.image = "era_snowflake.png";
this.w_snow.control = 3;
this.w_hail.particles = 10;
this.w_hail.image = "era_snowball.png";
this.w_hail.control = 4;
this.w_hail.zoom = 0.5;
this.w_clear.control = 0;
onTimeOut();
}
function onTimeOut() {
temp.newmode = serverr.weather;
if (temp.newmode != this.mode) {
this.mode = temp.newmode;
this.onChangeEffect(this.mode);
//Invoke function
cancelevents("onDrawEffect");
scheduleevent(2, "onDrawEffect", this.mode);
}
if (this.mode == "rain") {
scheduleevent(random(0, 10), "Thunder", "");
}
setTimer(10);
}
function onChangeEffect(mode) {
with (findimg(200)) {
with (emitter) {
addlocalmodifier("range", 0,0.2, "alpha", "replace", 0.3,0.5);
addlocalmodifier("range", 0.2,1, "alpha", "replace", 0.5,0);
addlocalmodifier("range", 0 ,1, "zoom", "replace", 1,0.3);
}
}
}
function onDrawEffect(mode) {
hideimg(200);
if (temp.mode == "clear" || !player.level.name.starts("tsa_")) {
return;
}
temp.modes = this.("w_" @ mode).getdynamicvarnames();
for (temp.i: temp.modes) {
temp.val = this.("w_" @ mode).(@ i);
if (temp.i == "particles") {
temp.pcles = val;
}
else {
temp.("c_" @ i) = val;
}
}
with (findimg(200)) {
// Emitter attributes
layer = 2;
x = player.x;
y = player.y;
with (emitter) {
delaymin = 0.25;
delaymax = 0.4;
nrofparticles = temp.pcles;
emissionoffset = {0, -8, 1};
attachtoowner = true;
with(particle) {
lifetime = int(random(5, 15));
for (temp.i: temp.modes) {
(@ i) = temp.("c_" @ i);
}
alpha = random(.6, .7);
mode = 1;
}
addlocalmodifier("once", 0, 0, "angle", "replace", degtorad(210), degtorad(300));
addlocalmodifier("once", 0, 0, "x", "add", - int(screenwidth / 16 / 2), int(screenwidth / 16 / 2));
addlocalmodifier("once", 0, 0, "y", "add", - int(screenheight / 16 / 2), int(screenheight / 16 / 2));
addlocalmodifier("once", 0, 0, "speed", "replace", 30, 40);
}
}
}
function onThunder() {
cancelevents("Thunder");
if (this.mode != "rain" || !player.level.name.starts("tsa_")) {
return;
}
for (temp.i = 0; temp.i < 5; temp.i++) {
seteffect(0.5, 0.5, 0.5, ("0." @ i));
if (random(0, 10) > 7) {
play("era_thunder.wav");
}
sleep(0.1);
}
seteffect(0, 0, 0, 0);
onTimeOut();
}
This one? ;p |
|