Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   particle effects... (https://forums.graalonline.com/forums/showthread.php?t=85862)

Nyght 05-28-2009 07:35 AM

particle effects...
 
So i'm trying to get this working on delteria dev and i'm needing some help with this code.

Initially this code did exactly what I needed to, than everytime I modify it one way or another it ends up giving me a single image rather than the flame effect i'm shooting for.


NPC Code:

//#CLIENTSIDE
function onTimeout()
{
findImg(200).x = player.x;
findImg(200).y = player.y;
this.setTimer(0.05);
}
function onCreated()
{
findImg(200).x = player.x;
findImg(200).y = player.y;
this.setTimer(0.05);
layer = 3;
with (emitter)
{
delaymin = 0.05;
delaymax = 0.05;
nrofparticles = 6;
maxparticles = 260;

with (particle)
{
angle = pi / 2;
lifetime = 4;
image = "light2s.png";
red = 0.85;
green = 0.09;
blue = 0.03;
alpha = 0.99;
speed = 0.35;
}

addlocalmodifier("impulse", 0, 0, "angle", "add", -0.04, 0.04);
addlocalmodifier("once", 0, 0, "x", "add", 0, 0.65);
addlocalmodifier("range", 0.5, 4, "alpha", "replace", 0.99, 0);
addlocalmodifier("range", 0.4, 4, "zoom", "replace", 0.6, 0);
addlocalmodifier("range", 0.2, 4, "speed", "replace", 0.5, 4);
}
}


Tigairius 05-28-2009 07:03 PM

Could be due to using "add" .. try this:
PHP Code:

//#CLIENTSIDE

function onTimeout() 

{

 
findImg(200).player.x;

 
findImg(200).player.y;

 
this.setTimer(0.05);

}

function 
onCreated() 

{

 
findImg(200).player.x;

 
findImg(200).player.y;

 
this.setTimer(0.05);

 
layer 3;

 
with (emitter

 {

  
delaymin 0.05;

  
delaymax 0.05;

  
nrofparticles 6;

  
maxparticles 260;



  
with (particle)

  {

   
angle pi 2;

   
lifetime 4;

   
image "light2s.png";

   
red 0.85;

   
green 0.09;

   
blue 0.03;

   
alpha 0.99;

   
speed 0.35;

  }

  
removeModifiers();
  
removeParticles();

  
addlocalmodifier("impulse"00"angle""add", -0.040.04);

  
addlocalmodifier("once"00"x""add"00.65);

  
addlocalmodifier("range"0.54"alpha""replace"0.990);

  
addlocalmodifier("range"0.44"zoom""replace"0.60);

  
addlocalmodifier("range"0.24"speed""replace"0.54);

 }




Codein 05-28-2009 08:22 PM

Could be because you're editting the emitter object outside of the image object's scope.

As an edit to Tig's suggestion:

PHP Code:

//#CLIENTSIDE

function onTimeout() 

{

 
findImg(200).player.x;

 
findImg(200).player.y;

 
this.setTimer(0.05);

}

function 
onCreated() 

{

 
findImg(200).player.x;

 
findImg(200).player.y;

 
this.setTimer(0.05);

 
layer 3;
    
  
with(findimg(200)) 
  {
     
with (emitter

     {

      
delaymin 0.05;

      
delaymax 0.05;

      
nrofparticles 6;

      
maxparticles 260;



      
with (particle)

      {

       
angle pi 2;

       
lifetime 4;

       
image "light2s.png";

       
red 0.85;

       
green 0.09;

       
blue 0.03;

       
alpha 0.99;

       
speed 0.35;

      }

      
removeModifiers();
      
removeParticles();

      
addlocalmodifier("impulse"00"angle""add", -0.040.04);

      
addlocalmodifier("once"00"x""add"00.65);

      
addlocalmodifier("range"0.54"alpha""replace"0.990);

      
addlocalmodifier("range"0.44"zoom""replace"0.60);

      
addlocalmodifier("range"0.24"speed""replace"0.54);

     }
  }



Nyght 05-31-2009 01:26 AM

Thanks guys...that helped tons!

http://img.apecentral.org/up/55d06ef...3461dd3eb9.PNG

Pelikano 05-31-2009 10:26 AM

looks awesome!


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

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