Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-20-2010, 01:21 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
weather effects emitter

Cant figure out why this isnt working. The rain will not show, fog wont come, and wind wont show the leaf particles. The only thing that works is lightning during the storm flag. Any ideas?

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(15));
  
triggerServer("gui"name"startweather"this.randomCheck);
}
function 
Rain() {
  
with (findimg(255)) {
    
player.3;
    
player.3;
    
alpha 0;
    
layer 5;
    
0;
    
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, -400}; // 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 "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.5pi*1.5 .3);
    
emitter.addLocalModifier("once"00"x""replace", -600screenwidth 20);
    if (
emitter.particle.== 0) {
     
showani(this.particle.xthis.particle.y"raindrop"NULL);
    }
  }
}

function 
Wind() {
  
with (findimg(255)) {
    
layer 3;
    
emitter.delaymin 0.2;
    
emitter.delaymax 0.4;
    
emitter.nrofparticles 1;
    
emitter.emissionoffset = {0, -910};
    
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 = {000"screenwidth""screenheight"11};
    
emitter.wraptoclippingbox true;
    
emitter.cliptoscreen true;
    
emitter.addglobalmodifier("impulse"0.20.2"zangle""multiply"0.950.95);
    
emitter.addlocalmodifier("once"00"angle""replace"02*pi);
    
emitter.addlocalmodifier("once"00"angle""replace"degtorad(200), degtorad(260));
    
emitter.addlocalmodifier("once"00"x""add", -2535);
    
emitter.addlocalmodifier("once"00"y""add"020);
    
emitter.addlocalmodifier("once"00"zoom""replace"0.61.2);
    
emitter.addlocalmodifier("once"00"green""replace"0.51);
    
emitter.addglobalmodifier("impulse"0.20.2"spin""add"00.01);
    
emitter.addlocalmodifier("range"0100000"speed""add"0.10.3);
    
with (emitter.addlocalmodifier("impulse"12"spin""add"00.01)) {
      
addmod("zangle""add"0.10.5);
    }
    if (
serverr.weather != "wind") {
      
hideimgs(255256);
    }
  }
}

function 
Lightning() {
/*  showimg(256, "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(01) >= 0.85 && random(01) >= 0.85) {
    
play("thunder-02.wav");
    
seteffect(000.31);
    
sleep(0.05);
    
seteffect(1111);
    
sleep(0.05);
    
seteffect(0000);
  }
//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 "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"03"zoom""add"0.0550.05);
    
emit();
  }
  if (
serverr.weather != "fog") {
    
hideimg(255);
  }
}

function 
onTimeout() {
  
with (findimg(255)) {
    
player.x;
    
player.y;
    
player.z;
  }
  if (
serverr.weather == "rain") {
    
Rain();
  }
  elseif (
serverr.weather == "wind") {
    
Wind();
  }
  elseif (
serverr.weather == "fog") {
    
Fog();
  }
  elseif (
serverr.weather == "storm") {
    
Rain();
    
Lightning();
  }
  else
    
hideimgs(255256);
  
setTimer(0.05);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 05-20-2010, 03:32 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
It seems to break because you're calling the weather functions every frame.
You should change the script so the emitters are defined and started only when the weather changes.
Also, calling addLocalModifier every frame is bad news and has caused major lag for me every time I've tried it.

Try something like this:
PHP Code:
function onTimeout() {
  
with (findimg(255)) {
    
player.x;
    
player.y;
    
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(255256);
  }
  
  
setTimer(0.05);


Quote:
Originally Posted by sssssssssss View Post
PHP Code:
emit(); 
Also this should be emitter.emit(). And you don't need to call it unless emitautomatically is false.
Reply With Quote
  #3  
Old 05-20-2010, 04:10 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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(15));
  
triggerServer("gui"name"startweather"this.randomCheck);
}
function 
Rain() {
  
with (findimg(255)) {
    
player.3;
    
player.3;
    
alpha 0;
    
layer 5;
    
0;
    
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, -400}; // 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.5pi*1.5 .3);
    
emitter.addlocalmodifier("once"00"x""replace", -600screenwidth 20);
    if (
emitter.particle.== 0) {
     
showani(this.particle.xthis.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, -910};
    
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 = {000"screenwidth""screenheight"11};
    
emitter.wraptoclippingbox true;
    
emitter.cliptoscreen true;
    
emitter.addglobalmodifier("impulse"0.20.2"zangle""multiply"0.950.95);
    
emitter.addlocalmodifier("once"00"angle""replace"02*pi);
    
emitter.addlocalmodifier("once"00"angle""replace"degtorad(200), degtorad(260));
    
emitter.addlocalmodifier("once"00"x""add", -2535);
    
emitter.addlocalmodifier("once"00"y""add"020);
    
emitter.addlocalmodifier("once"00"zoom""replace"0.61.2);
    
emitter.addlocalmodifier("once"00"green""replace"0.51);
    
emitter.addglobalmodifier("impulse"0.20.2"spin""add"00.01);
    
emitter.addlocalmodifier("range"0100000"speed""add"0.10.3);
    
with (emitter.addlocalmodifier("impulse"12"spin""add"00.01)) {
      
addmod("zangle""add"0.10.5);
    }
    if (
serverr.weather != "wind") {
      
hideimgs(255256);
    }
  }
}

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(01) >= 0.85 && random(01) >= 0.85) {
    
play("thunder-02.wav");
    
seteffect(000.31);
    
sleep(0.05);
    
seteffect(1111);
    
sleep(0.05);
    
seteffect(0000);
  }
//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"03"zoom""add"0.0550.05);
    
//emitter.emit();
  
}
  if (
serverr.weather != "fog") {
    
hideimg(255);
  }
}

function 
onTimeout() { 
  
with (findimg(255)) { 
    
player.x
    
player.y
    
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); 

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 05-20-2010, 01:25 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Ok, im really stumped on this one. I thought it might be the way im calling it since it works on fog and wind if i reconnect, so I put in some scheduleevents, and it changes that way randomly, but it does the same thing.

Still no rain, still no storm (which includes lightning), and only fog or wind when you connect/reconnect and it starts out with it. Please, any ideas, as my head is really starting to hurt from this script. Besides addlocalmodifier causing some lag, it should work perfectly.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #5  
Old 05-20-2010, 04:31 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
I tried simplifying it to see if I could get it to work. I changed it to use this.currentWeather instead of serverr.weather, so I could easily change the weather with the number keys.
I also put hideimg(255) on top of every weather function to make sure the emitters don't inherit attributes from each other, and I removed deprecated lines like
if (serverr.weather != "wind") hideimgs(255, 256);

Seems to work for me except for the lightning.
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
setTimer(0.05);
}

function 
onKeyPressed(keyCodekeyCharscanCode)
{
  switch (
keyChar) {
    case 
"1"this.currentWeather "rain"; break;
    case 
"2"this.currentWeather "wind"; break;
    case 
"3"this.currentWeather "fog"; break;
    case 
"4"this.currentWeather "storm"; break;
    case 
"5"this.currentWeather "calm"; break;
  }
  
  echo(
"Changed weather to " this.currentWeather);
}

function 
Rain() {
  
hideimg(255);
  
with (findimg(255)) {
    
alpha 0;
    
layer 5;
    
//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, -400}; // 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.5pi*1.5 .3);
    
emitter.addlocalmodifier("once"00"x""replace", -600screenwidth 20);
    
//if (emitter.particle.z == 0) {
    //  showani(this.particle.x, this.particle.y, "sh_raindrop", NULL);
    //}
  
}
}

function 
Wind() {
  
hideimg(255);
  
with (findimg(255)) {
    
layer 3;
    
emitter.delaymin 0.2;
    
emitter.delaymax 0.4;
    
emitter.nrofparticles 1;
    
emitter.emissionoffset = {0, -910};
    
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 = {000"screenwidth""screenheight"11};
    
emitter.wraptoclippingbox true;
    
emitter.cliptoscreen true;
    
emitter.addglobalmodifier("impulse"0.20.2"zangle""multiply"0.950.95);
    
emitter.addlocalmodifier("once"00"angle""replace"02*pi);
    
emitter.addlocalmodifier("once"00"angle""replace"degtorad(200), degtorad(260));
    
emitter.addlocalmodifier("once"00"x""add", -2535);
    
emitter.addlocalmodifier("once"00"y""add"020);
    
emitter.addlocalmodifier("once"00"zoom""replace"0.61.2);
    
emitter.addlocalmodifier("once"00"green""replace"0.51);
    
emitter.addglobalmodifier("impulse"0.20.2"spin""add"00.01);
    
emitter.addlocalmodifier("range"0100000"speed""add"0.10.3);
    
with (emitter.addlocalmodifier("impulse"12"spin""add"00.01)) {
      
addmod("zangle""add"0.10.5);
    }
  }
}

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(01) >= 0.85 && random(01) >= 0.85) {
    
play("thunder-02.wav");
    
seteffect(000.31);
    
sleep(0.05);
    
seteffect(1111);
    
sleep(0.05);
    
seteffect(0000);
  }
//seteffect(0, 0, 0, 0.7);
}

function 
Fog() {
  
hideimg(255);
  
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"03"zoom""add"0.0550.05);
  }
}

function 
onTimeout() {
  
with (findimg(255)) { 
    
player.x;
    
player.y;
    
player.z;
  }
  
  if (
this.lastWeather != this.currentWeather
  {
    
this.lastWeather this.currentWeather
    
    if (
this.currentWeather == "rain") { 
      
Rain(); 
    }
    elseif (
this.currentWeather == "wind") { 
      
Wind(); 
    }
    elseif (
this.currentWeather == "fog") { 
      
Fog(); 
    }
    elseif (
this.currentWeather == "storm") { 
      
Rain();
      
Lightning(); 
    }
    else
    {
      
//Calm
      
hideimg(255);
    }
  }
  
  
setTimer(0.05); 

You'll have to rewrite Lightning() entirely I'm afraid, since it doesn't make sense anymore.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.