Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Emitter not working (https://forums.graalonline.com/forums/showthread.php?t=76978)

Switch 09-29-2007 11:52 PM

Emitter not working
 
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with (findimg(1)) {
    
layer 2;
    
player.x;
    
player.y;

    
emitter.attachposition false;
    
emitter.delaymin 10;
    
emitter.delaymax 15;
    
emitter.emissionoffset = { 202020 };
    
emitter.firstinfront false;
    
emitter.nrofparticles 3;
    
emitter.maxparticles 60;
    
    
emitter.particle.lifetime 12;
    
emitter.particle.image "g4_particle_whitespot.png";
    
emitter.particle.mode 0;
    
emitter.particle.alpha .99;
    
emitter.particle.red .89;
    
emitter.particle.green .76;
    
emitter.particle.blue .49;
    
emitter.particle.zoom 0;
    
emitter.particle.zangle 2;
    
emitter.particle.angle 1;
    
emitter.particle.speed random(2,6);
    
emitter.particle.spin 3;
    
emitter.particle.stretchx 0;
    
emitter.particle.strechy 0;

    
emitter.addLocalModifier("range",9,12,"alpha","replace",1,0);

    
emitter.emit();
  }


Suggestions?

Inverness 09-29-2007 11:58 PM

This is just a guess but I think the Particle Emitter is supposed to be used with image indexes that are clientside-only, meaning the image index needs to be 200 or greater.

PrinceOfKenshin 09-30-2007 12:19 AM

Quote:

Originally Posted by Inverness (Post 1350131)
This is just a guess but I think the Particle Emitter is supposed to be used with image indexes that are clientside-only, meaning the image index needs to be 200 or greater.

yeap that's correct = )
so it would be:
PHP Code:

with (findimg(201)) { 

:D

Crow 09-30-2007 12:29 AM

Or 200. I actually prefer to start at 200 ;P

Admins 09-30-2007 12:34 AM

I would say that zoom, stretchx and stretchy should be greater than zero otherwise you will not see anything (try with 1...)
Also the emission offset (20 tiles) is a little bit high, try {0,0,0} first

Switch 09-30-2007 12:53 AM

Okay thanks :)

BTW It wasn't that it needed to be img number 200 or higher...

Edit:
LOL I don't like this emitter system :[

PHP Code:

//#CLIENTSIDE 
function onCreated() {
  
CreateEmitter();
}
function 
CreateEmitter() {
  
with (findimg(1)) { 
    
layer 2
    
with (emitter) {
      
attachposition true
      
delaymin 10
      
delaymax 15
      
emissionoffset = {0,0,0}; 
      
firstinfront false
      
nrofparticles 1
      
maxparticles 60
     
      
particle.lifetime 12
      
particle.image "g4_particle_whitespot.png"
      
particle.mode 0
      
particle.alpha .99
      
particle.red .89
      
particle.green .76
      
particle.blue .49
      
particle.zoom 2
      
particle.angle pi/165
      
particle.speed 2
      
particle.spin 2
      
particle.stretchx 1
      
particle.strechy 1

      
addLocalModifier("range",0,12,"alpha","replace",1,0);
      
addLocalModifier("range",0,12,"zoom","replace",2,0);
    }
  }
}

function 
onWeaponFired() {
  
this.on this.on;
  if (
this.on == 1) {
    
setTimer(0.05);
  }
  if (
this.on == 0) {
    
setTimer(0);
  }
}

function 
onTimeOut() {
  
with (findimg(1)) {
    
layer 2;
    
random(0,60);
    
random(0,60);
    
emitter.emit();
  }
  
setTimer(0.05);


NPC Code:
GraalScript: Function addLocalModifier not found at line 31 in script of Switch/Test
GraalScript: Function addLocalModifier not found at line 32 in script of Switch/Test



Suggestions??

Admins 09-30-2007 01:58 AM

Try with (this.emitter), there might be some global "emitter" variable

Switch 09-30-2007 02:04 AM

No that didn't work :[

Quote:

Originally Posted by RC
GraalScript: Function addLocalModifier not found at line 31 in script of Switch/Test
GraalScript: Function addLocalModifier not found at line 32 in script of Switch/Test

Edit:
Ok, even wierder...
PHP Code:

//#CLIENTSIDE 
function onCreated() {
  
CreateEmitter();
}
function 
CreateEmitter() {
  
with (findimg(1)) { 
    
layer 2
    
    
emitter.attachposition true
    
emitter.delaymin 6
    
emitter.delaymax 12
    
emitter.emissionoffset = {0,0,0}; 
    
emitter.firstinfront false
    
emitter.nrofparticles 1
    
emitter.maxparticles 60
     
    
emitter.particle.lifetime 12
    
emitter.particle.image "g4_particle_whitespot.png"
    
emitter.particle.mode 0
    
emitter.particle.alpha .99
    
emitter.particle.red .89
    
emitter.particle.green .76
    
emitter.particle.blue .49
    
emitter.particle.zoom 2
    
emitter.particle.angle pi/165
    
emitter.particle.speed 2
    
emitter.particle.spin 2
    
emitter.particle.stretchx 1
    
emitter.particle.strechy 1

    
emitter.addLocalModifier("range",0,12,"alpha","replace",1,0);
    
emitter.addLocalModifier("range",0,12,"zoom","replace",2,0);
  }
}

function 
onWeaponFired() {
  
this.on this.on;
  if (
this.on == 1) {
    
setTimer(0.05);
  }
  if (
this.on == 0) {
    
setTimer(0);
  }
}

function 
onTimeOut() {
  
with (findimg(1)) {
    
layer 2;
    
random(0,60);
    
random(0,60);
    
emitter.emit();
  }
  
setTimer(0.05);


NPC Code:
GraalScript: Function emitter.addLocalModifier not found at line 31 in script of Switch/Test
GraalScript: Function emitter.addLocalModifier not found at line 32 in script of Switch/Test


Admins 09-30-2007 02:15 AM

Yes try what I said

Switch 09-30-2007 02:25 AM

Quote:

Originally Posted by Stefan (Post 1350154)
Yes try what I said

Yes I tried it with "with(this.emitter)" and it didnt work either.

It's working for my friend's though use "with(emitter)" and jsut writing it all out like my last post.

PrinceOfKenshin 09-30-2007 02:39 AM

don't put
PHP Code:

emitter.addLocalModifier 

put
PHP Code:

emitter.addlocalModifier 

lower case l = )

Switch 09-30-2007 03:00 AM

Nope :[

PrinceOfKenshin 09-30-2007 03:03 AM

Quote:

Originally Posted by Switch (Post 1350167)
Nope :[

Ok try this put your script into a class make sure you have
PHP Code:

with(findimg(201)) { 

and then just put in the npc for the level
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
join("classname");


that should work or you are doing something wrong

Switch 09-30-2007 03:18 AM

Nope.

It keeps saying the same thing in RC

GraalScript: function emitter.addLocalModifier not found at line ___ of switch-test of script Switch/Test

PrinceOfKenshin 09-30-2007 03:26 AM

duh because you have addLocalModifier don't use the capital L use the little l
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with (findimg(201)) {
    
layer 2;
    
player.x;
    
player.y;

    
emitter.attachposition false;
    
emitter.delaymin 10;
    
emitter.delaymax 15;
    
emitter.emissionoffset = { 202020 };
    
emitter.firstinfront false;
    
emitter.nrofparticles 3;
    
emitter.maxparticles 60;
    
    
emitter.particle.lifetime 12;
    
emitter.particle.image "g4_particle_whitespot.png";
    
emitter.particle.mode 0;
    
emitter.particle.alpha .99;
    
emitter.particle.red .89;
    
emitter.particle.green .76;
    
emitter.particle.blue .49;
    
emitter.particle.zoom 0;
    
emitter.particle.zangle 2;
    
emitter.particle.angle 1;
    
emitter.particle.speed random(2,6);
    
emitter.particle.spin 3;
    
emitter.particle.stretchx 0;
    
emitter.particle.strechy 0;

    
emitter.addlocalModifier("range",9,12,"alpha","replace",1,0);

    
emitter.emit();
  }


copy and paste that, i tested it on my server and i didn't get any errors

Switch 09-30-2007 03:43 AM

I had it correct then it wouldn't work as class so I copied and pasted into the actual Weapon and it returned:

GraalScript: Function emitter.addlocalModifier not found at line 31 in script of Switch/Test
GraalScript: Function emitter.addlocalModifier not found at line 32 in script of Switch/Test

Inverness 09-30-2007 03:43 AM

Dude, static variables are not case-sensitive, only dynamic variables are.

And I think you might have a global emitter variable like you said. Do echo(emitter.objecttype()) and see what it says? I believe it would be TParticleEmitter if its the correct object.

Switch 09-30-2007 03:48 AM

No it's "TGraalVar"

Kyranki 09-30-2007 04:03 AM

Quote:

Originally Posted by Switch (Post 1350174)
No it's "TGraalVar"

Then it's the wrong graal object.

Switch 09-30-2007 04:06 AM

Then what am I supposed to use? It says to use emitter. commands in TGC's guide...

Inverness 09-30-2007 04:31 AM

Try this.emitter inside the with part.

Switch 09-30-2007 04:34 AM

That still didnt work..

Inverness 09-30-2007 04:43 AM

this.emitter.addlocalmodifier() does not work?

lol, I have no idea then.

Switch 09-30-2007 04:53 AM

Earlier today Skyld said he doesn't know much about particles, an Stefans stuff worked but then it got screwy so I cahnged and then it came up with the errors, so I think I need Stefan to actually look at this on RC.

Go on Graal Legacy and look at "Switch/Test" @ Stefan

Or someone can look at it and toy around with it on their server.

PHP Code:

//#CLIENTSIDE 
function onCreated() {
  
CreateEmitters();
}
function 
CreateEmitters() {
  
with (findImg200)) {
    
layer 2;
    
with (emitter) {
    
      
delaymin 5;
      
delaymax 5;
      
nrofparticles 1;
      
maxparticles 75;
      
emissionoffset = {0,0,0};
      
firstinfront false;
      
attachposition true;  
 
      
particle.speed 2;
      
particle.lifetime 5;
      
particle.image "g4_particle_whitespot.png";
      
particle.alpha .99;
      
particle.zoom 2;
      
particle.red .92;
      
particle.green .26;
      
particle.blue .52;
      
particle.stretchx 1;
      
particle.stretchy 1;

      
addlocalmodifier("range",0,12,"alpha","replace",1,0);
      
addlocalmodifier("range",0,12,"zoom","replace",2,0);
    }
  }
}

function 
onWeaponFired() {
  
this.on this.on;
  if (
this.on == 1) {
    
setTimer(0.05);
  }
  if (
this.on == 0){
    
setTimer(0);
  }
}

function 
onTimeOut() {
  
with (findimg(200)) {
    
layer 2;
    
random(0,60);
    
random(0,60);
    
emitter.emit();
  }
  
setTimer(0.05);



Switch 10-02-2007 12:49 AM

please I really need to know why it wont work :frown:

zokemon 10-02-2007 12:56 AM

I'm very proficient with particles but I'll probably need to look at it personally. Send me a message in one of my contacts.

Admins 10-02-2007 01:35 AM

Ok fixed the problems:
- there were a few spaces behind //#CLIENTSIDE so it compiled it as serverside script
- on gmap something like player.x + random(-30,30) works better because random(0,60) is just upper left corner of the gmap
- also added emitter.cliptoscreen = true to have the particles on the screen even when emitted or moving outside and changed attachposition to false

zokemon 10-02-2007 02:07 AM

I could have fixed it :frown:

Inverness 10-02-2007 02:14 AM

Never knew the spaces could make a difference:oo:

Switch 10-02-2007 04:35 PM

Yeah @ Iverness :o

Inverness 10-02-2007 06:19 PM

Ugh, so many people leave out the N when they spell my name :whatever:

Switch 10-02-2007 06:55 PM

Iverness sounds better. Inverness is too original for my mental capacity :o
I'll try to remember ;)

Tigairius 10-04-2007 10:11 PM

Quote:

Originally Posted by Switch (Post 1350593)
Iverness sounds better.

Disagreed.

xXziroXx 10-04-2007 10:25 PM

Quote:

Originally Posted by Tigairius (Post 1350996)
Disagreed.

Agreed.

Codein 10-04-2007 10:42 PM

Quote:

Originally Posted by Switch (Post 1350593)
Iverness sounds better. Inverness is too original for my mental capacity :o
I'll try to remember ;)

Completely disregarding the fact that there's a city in the highlands of Scotland called Inverness.

Completely disregarding the fact that Macbeth, in the famous Shakespeare play of the same name, resided in a castle in Inverness.

Completely disregarding:

http://en.wikipedia.org/wiki/Inverne...ambiguation%29

Switch 10-05-2007 01:31 AM

Quote:

Originally Posted by Codein (Post 1351003)
Completely disregarding the fact that there's a city in the highlands of Scotland called Inverness.

Completely disregarding the fact that Macbeth, in the famous Shakespeare play of the same name, resided in a castle in Inverness.

Completely disregarding:

http://en.wikipedia.org/wiki/Inverne...ambiguation%29

SHUSH !pissed!

It's easier for me to pronounce :frown:

Codein 10-06-2007 12:03 PM

Quote:

Originally Posted by Switch (Post 1351027)
SHUSH !pissed!

It's easier for me to pronounce :frown:

Inverness is certainly more easier to pronounce than Iverness, if you're pronouncing it right.

It's In-ver-ness not Aye-n-ver-ness


All times are GMT +2. The time now is 04:53 AM.

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