Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 07:43 AM.


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