Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   What do you think of my particle? (https://forums.graalonline.com/forums/showthread.php?t=134264612)

pig132 09-22-2011 07:15 AM

What do you think of my particle?
 
Looking for some feedback on my particle I recently finished. Looks a lot better in the actual level than in the video. If you'd like to see it you can go to Testbed and warp to "bad.nw".


http://www.youtube.com/watch?v=IqT-pmSAC5E


edit: youtube embed won't work for some reason

fowlplay4 09-22-2011 07:26 AM

I think it would look better if you used particletypes and set specific colors (I.e: Red, Green, Blue, Yellow) instead of relying on "random" to generate a color.

PHP Code:

// Often generates odd/mainly white colors
red random(0,1);
green random(0,1);
blue random(0,1); 

I believe it would work something like this:

PHP Code:

with (findimg(200)) {
  
temp.colorz = {
    {
100},
    {
010},
    {
001},
    {
110}
  };
  
emitter.particletypes temp.colorz.size();
  for (
temp.0temp.emitter.particletypestemp.i++) {
     
emitter.particle[temp.i].red temp.colorz[temp.i][0];
     
emitter.particle[temp.i].green temp.colorz[temp.i][1];
     
emitter.particle[temp.i].blue temp.colorz[temp.i][2];
  }


I'm sure you can apply this to other particle ideas as well. Nice work none the less.

pig132 09-22-2011 07:40 AM

What exactly is 'particletypes'? I understand the colors and it produces some really nice colors that mine didn't, but also what that does is create a big white orb in the middle and then for some reason changes the angles of which they are shot out at.

Also, what are the 3 variables for in 'this.colorz' on each line?

oralgnome 09-22-2011 01:32 PM

Quote:

Originally Posted by pig132 (Post 1668836)
...also, what are the 3 variables for in 'this.colorz' on each line?

rgb?

fowlplay4 09-22-2011 03:44 PM

Well by default there's only 1 particle type, setting it to 4 allows you have to your particle emitter emit 4 different types of particles.

The only difference is that you would have to use particle[index] instead of just particle.

Post your code so we can try and debug the white orb.

The array of colorz just stores multiple red, green, and blue values. I.e:

PHP Code:

temp.colorz = {
  {
redgreenblue},
}; 


pig132 09-23-2011 04:33 AM

Ah, I assumed that was it.

PHP Code:

function onPlayerChats()
{
  if (
player.account "pig132")
  {
    if (
player.chat "/d")
    {
      
destroy();
    }
  }
}
//#CLIENTSIDE
function onPlayerEnters()
{
with (findimg(1)) {
  
  
temp.colors = {
  {
001},
  {
010},
  {
010},
  {
010}
  };
  
  
layer 2;
  
emitter.delaymin 0.01;
  
emitter.delaymax 0.01;
  
emitter.nrofparticles 1;

  
emitter.particle.lifetime 6;
  
emitter.particle.image "g4_particle_sun.png";
  
emitter.particle.mode 0;
  
emitter.particle.alpha 1;
  
emitter.particle.zoom 1;
  
  
emitter.particletypes temp.colors.size();
  
  for (
temp.0temp.emitter.particletypestemp.i++)
  {
    
emitter.particle[temp.i].red temp.colors[temp.i][0];
    
emitter.particle[temp.i].green temp.colors[temp.i][1];
    
emitter.particle[temp.i].blue temp.colors[temp.i][2];
    
sleep(0.05);
  }
  
  
emitter.particle.red 0;
  
emitter.particle.green 0;
  
emitter.particle.blue 0;

  
emitter.particle.angle pi 2;
  
emitter.particle.speed 4;
  
  
emitter.addlocalmodifier("once"00"angle""add"3030);
  
emitter.addemitmodifier("impulse".115.115"angle""add"degtorad(45), degtorad(45)); 
  
  
emitter.addlocalmodifier("range"24"alpha""replace"0.990);
  
emitter.addlocalmodifier("range"24"zoom""add"13);
  }



fowlplay4 09-23-2011 04:44 AM

Try..

PHP Code:

function onPlayerEnters()
{
with (findimg(1)) {
  
  
temp.colors = {
  {
001},
  {
010},
  {
010},
  {
010}
  };
  
  
layer 2;
  
emitter.delaymin 0.05;
  
emitter.delaymax 0.05;
  
emitter.nrofparticles 1;
  
  
emitter.particletypes temp.colors.size();
  
  for (
temp.0temp.emitter.particletypestemp.i++)
  {
    
emitter.particle[temp.i].red temp.colors[temp.i][0];
    
emitter.particle[temp.i].green temp.colors[temp.i][1];
    
emitter.particle[temp.i].blue temp.colors[temp.i][2];
    
emitter.particle[temp.i].angle pi 2;
    
emitter.particle[temp.i].speed 4;
    
emitter.particle[temp.i].lifetime 6;
    
emitter.particle[temp.i].image "g4_particle_sun.png";
    
emitter.particle[temp.i].mode 0;
    
emitter.particle[temp.i].alpha 1;
    
emitter.particle[temp.i].zoom 1;
    
//sleep(0.05); // not even needed...
  
}
  
  
emitter.addlocalmodifier("once"00"angle""add"3030);
  
emitter.addemitmodifier("impulse".115.115"angle""add"degtorad(45), degtorad(45)); 
  
  
emitter.addlocalmodifier("range"24"alpha""replace"0.990);
  
emitter.addlocalmodifier("range"24"zoom""add"13);
  }



pig132 09-23-2011 04:54 AM

Cool, thank you. That removed the odd white orb, but for some reason its like it is skipping certain parts where it should be emitting. Like in the video, it emits in a complete circle. I'm not sure why though. It also seems to be changing the time between emits for some reason...All of those settings haven't been changed

Tricxta 09-23-2011 06:36 AM

Looks like a pretty cool effect, neat work :)

Crow 09-23-2011 12:11 PM

Quote:

Originally Posted by pig132 (Post 1668899)
Cool, thank you. That removed the odd white orb, but for some reason its like it is skipping certain parts where it should be emitting. Like in the video, it emits in a complete circle. I'm not sure why though. It also seems to be changing the time between emits for some reason...All of those settings haven't been changed

That kind of stuff can heavily depend on emitter.maxparticles. Can't see it in your code, and I'm not even sure if it has a default value, but try setting that to something higher.

pig132 09-23-2011 08:15 PM

I always thought that if you didn't specify how many max particles, it just didn't have a max. Also, I set it to 100, and immediately it started skipping.

Crow 09-23-2011 08:30 PM

Quote:

Originally Posted by pig132 (Post 1668929)
I always thought that if you didn't specify how many max particles, it just didn't have a max.

To be honest, I never tried it. I don't know what the default behavior is, it was just an assumption.

fowlplay4 09-23-2011 08:32 PM

Quote:

Originally Posted by pig132 (Post 1668929)
I always thought that if you didn't specify how many max particles, it just didn't have a max. Also, I set it to 100, and immediately it started skipping.

Because your delay is set to 0.05 and your particle lifetime is 6 seconds.

You would need at least a maximum of 120 (6/0.05) particles to keep a steady stream.

How to calc it:
emitter.maxparticles = (particle.lifetime / particle.delaymin) * emitter.nrofparticles

pig132 09-24-2011 03:31 AM

Quote:

Originally Posted by fowlplay4 (Post 1668932)
Because your delay is set to 0.05 and your particle lifetime is 6 seconds.

You would need at least a maximum of 120 (6/0.05) particles to keep a steady stream.

How to calc it:
emitter.maxparticles = (particle.lifetime / particle.delaymin) * emitter.nrofparticles

Well yeah, I even messed with the delaymin and max, lifetime, etc but still for some reason skips.


All times are GMT +2. The time now is 08:06 PM.

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