Cyril Rain
|
 |
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
|
|
Progress, somewhat ...
Now if you have it set for wind or fog, and then reconnect, it works, but if you leave the level it doesnt. Rain still doesnt work, but not the lightning/thunder doesnt work either. :/
PHP Code:
function onActionServerSide() {
if (params[0] == "startweather") {
if (params[1] == 1) {
player.chat="rain";
serverr.weather="rain";
} elseif (params[1] == 2) {
player.chat="wind";
serverr.weather="wind";
} elseif (params[1] == 3) {
player.chat="fog";
serverr.weather="fog";
} elseif (params[1] == 4) {
player.chat="storm";
serverr.weather="storm";
} elseif (params[1] == 5) {
player.chat="calm";
serverr.weather="calm";
}
}
}
//#CLIENTSIDE
function onPlayerEnters() {
onTimeout();
this.randomCheck = int(random(1, 5));
triggerServer("gui", name, "startweather", this.randomCheck);
}
function Rain() {
with (findimg(255)) {
x = player.x - 3;
y = player.y - 3;
alpha = 0;
layer = 5;
x = 0;
y = 0;
//play("rain.wav");
this.shootAngle2 = pi * 1.5;
emitter.checkbelowterrain = true;
this.shootAngle = this.shootAngle2 + this.angle;
emitter.autorotation = false;
emitter.attachposition = false; // If the image's x and y move, would the entire emitter, every single particle at once, move along with the image? If true, every sprite moves when the image movies. If false, then only the point of origin, where the particles are created, move when the image is moved.
emitter.delaymin = 0; // This is the minimum delay between emissions.
emitter.delaymax = 0; // This is the maximum delay between emissions, both of these are in seconds.
emitter.emissionoffset = {0, -40, 0}; // In format of "{float, float, float}", it's the offset from the x, y, and z that an emission will show. It's the delta variables for the location, basically.
emitter.firstinfront = 1; // Should the first emitted particle be in front of every other particle?
emitter.nrofparticles = 10; // The number of particles to be released at the same exact time when the emitter emits. For example, set this to two, and you'll have two particles released every time instead of the default 1.
emitter.maxparticles = 80; // The maximum number of particles that can exist at one time. If this limit is reached, the script will wait until one of the particles runs out before emitting another one.
emitter.particle.lifetime = 1; // How long, in seconds, the emitter lasts.
emitter.particle.image = "sh_particle_rain.png"; // The imagename of the emitter
emitter.particle.mode = 0; // Either 0, 1, or 2, the same as changeimgmode. 0 = add, 1 = trans, 2 = subtract. Use this for a blacklight effect if you wish.
emitter.particle.alpha = .8; // Between 0 and 1, the alpha colour for transparancy
emitter.particle.zoom = 1; // The zoom effect of the particle
emitter.particle.red = 1;
emitter.particle.green = 1;
emitter.particle.blue = 1; // These three are between 0 and 1, and they're the colours of the individual particles
emitter.particle.zangle = 0; // Between 0 and pi*2, it's the upward angle of the particles. Remember zangle from the shoot() function? Same basic idea.
emitter.particle.angle = this.shootAngle; // Again, between 0 and pi*2, it's the angle that the particle should flow.
emitter.particle.speed = 1000; // I'm not sure if this is measured in Tiles per second or what, but it's the speed. Higher = faster, obviously
// emitter.particle.spin = 10; // The number of times each particle rotates while it's being shown. Ex, 1 will make the particle rotate just once before it hides.
emitter.particle.stretchx = 1; // This is how 'stretched' each particle will be, relative to width.
emitter.particle.stretchy = 1; // This is how 'stretched' each particle will be, relative to height.
emitter.addlocalmodifier("once", 0, .1, "angle", "replace", pi*1.5, pi*1.5 + .3);
emitter.addlocalmodifier("once", 0, 0, "x", "replace", -600, screenwidth + 20);
if (emitter.particle.z == 0) {
showani(this.particle.x, this.particle.y, "sh_raindrop", NULL);
}
}
}
function Wind() {
with (findimg(255)) {
layer = 3;
emitter.delaymin = 0.2;
emitter.delaymax = 0.4;
emitter.nrofparticles = 1;
emitter.emissionoffset = {0, -9, 10};
emitter.autorotation = false;
emitter.checkbelowterrain = false;
emitter.particle.lifetime = 25;
emitter.particle.image = "g4_particle_leaf.png";
emitter.particle.zangle = -1;
emitter.particle.speed = 0.1;
emitter.particle.alpha = 0.99;
emitter.particle.mode = 1;
emitter.clippingbox = {0, 0, 0, "screenwidth", "screenheight", 11};
emitter.wraptoclippingbox = true;
emitter.cliptoscreen = true;
emitter.addglobalmodifier("impulse", 0.2, 0.2, "zangle", "multiply", 0.95, 0.95);
emitter.addlocalmodifier("once", 0, 0, "angle", "replace", 0, 2*pi);
emitter.addlocalmodifier("once", 0, 0, "angle", "replace", degtorad(200), degtorad(260));
emitter.addlocalmodifier("once", 0, 0, "x", "add", -25, 35);
emitter.addlocalmodifier("once", 0, 0, "y", "add", 0, 20);
emitter.addlocalmodifier("once", 0, 0, "zoom", "replace", 0.6, 1.2);
emitter.addlocalmodifier("once", 0, 0, "green", "replace", 0.5, 1);
emitter.addglobalmodifier("impulse", 0.2, 0.2, "spin", "add", 0, 0.01);
emitter.addlocalmodifier("range", 0, 100000, "speed", "add", 0.1, 0.3);
with (emitter.addlocalmodifier("impulse", 1, 2, "spin", "add", 0, 0.01)) {
addmod("zangle", "add", 0.1, 0.5);
}
if (serverr.weather != "wind") {
hideimgs(255, 256);
}
}
}
function Lightning() {
/* showimg(256, "sh_particle_lightning.png", x, 0);
with (findimg(256)) {
x = random( -30, screenwidth);
layer = 3;
emitter.delaymin = 0.2;
emitter.delaymax = 0.4;
emitter.nrofparticles = 3;
emitter.particle.lifetime = 5;
emitter.particle.mode = 1;
emitter.particle.alpha = 0.99;
emitter.particle.zoom = 5;
emitter.particle.red = 1;
emitter.particle.green = 1;
emitter.particle.blue = 1;
emitter.addlocalmodifier("range", 0, 3, "zoom", "add", 5, 1);
}*/
if (random(0, 1) >= 0.85 && random(0, 1) >= 0.85) {
play("thunder-02.wav");
seteffect(0, 0, 0.3, 1);
sleep(0.05);
seteffect(1, 1, 1, 1);
sleep(0.05);
seteffect(0, 0, 0, 0);
}
//seteffect(0, 0, 0, 0.7);
}
function Fog() {
with (findimg(255)) {
layer = 4;
emitter.delaymin = 0.2;
emitter.delaymax = 0.4;
emitter.nrofparticles = 1;
emitter.autorotation = false;
emitter.maxparticles = 1;
emitter.checkbelowterrain = false;
emitter.particle.lifetime = 25;
emitter.particle.image = "sh_particle_fog.png";
emitter.particle.zangle = 0;
emitter.particle.speed = 0;
emitter.particle.alpha = 1;
emitter.particle.zoom = 1;
emitter.particle.mode = 1;
emitter.addlocalmodifier("range", 0, 3, "zoom", "add", 0.055, 0.05);
//emitter.emit();
}
if (serverr.weather != "fog") {
hideimg(255);
}
}
function onTimeout() {
with (findimg(255)) {
x = player.x;
y = player.y;
z = player.z;
}
if (this.lastWeather != serverr.weather)
{
this.lastWeather = serverr.weather;
if (serverr.weather == "rain") {
Rain();
}
elseif (serverr.weather == "wind") {
Wind();
}
elseif (serverr.weather == "fog") {
Fog();
}
elseif (serverr.weather == "storm") {
Rain();
Lightning();
}
// else
// hideimgs(255, 256);
}
setTimer(0.05);
}
|
|