Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Emitter scripting problems. (https://forums.graalonline.com/forums/showthread.php?t=134260958)

darkcloud667 10-31-2010 12:27 AM

Emitter scripting problems.
 
alright.
so basically heres my problem, i have an effect, and it works fine.
until i move from one area to the other.
basically, im standing in npulse's level2, i see the stuff that the effect emits.
then i move to level3, and the lighting works, but the fog n stuff doesnt.
so i come here to you, my fellow graalians.

wat do.

EDIT: btw, ive tried setting a var to it to stay on and emit along the player, ive used attachtoowner, etc.
ive also tried to have it use a timeout to move it to the players x and y.

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
say2("Say '/hallo on' to turn on,
Say '/hallo off' to turn off."
);
  }
function 
onPlayerChats() {
 if(
player.chat == "/hallo on") {
with(findimg(200)) {
  
attachtoowner = true;
  
this.x = this.dx;
  
this.y = this.dy;
  
layer = 3;
  
emitter.particle.speed = 0;
  
emitter.particle.green = .9;
  
emitter.particle.blue = .9;
  
emitter.particle.red = .9;
  
emitter.particle.image = "g4_particle_smoke.png";
  
emitter.particle.lifetime = 5;
  
emitter.delaymin = .5;
  
emitter.delaymax = 1;
  
emitter.maxparticles = 20;
  
emitter.nrofparticles = 5;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 1;
  
emitter.particle.alpha = .2;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = 0;
  
emitter.particle.stretchx = 5;
  
emitter.particle.stretchy = .6;
  
emitter.continueafterdestroy = false;
  
emitter.addlocalmodifier("once", 0, 0, "speed", "replace", 1, 4.5);
  
emitter.addlocalmodifier("once", 0, 0, "stretchx", "replace", 2.5, 10);
  
emitter.addlocalmodifier("once", 0, 0, "zoom", "replace", 1, 2.5);
  
emitter.addlocalmodifier("range", 0, 2.5, "alpha", "replace", 0, .35);
  
emitter.addlocalmodifier("range", 2.5, 5, "alpha", "replace", .35, 0);
  
emitter.addlocalmodifier("once", 0, 0, "y", "replace", player.y-30, player.y+30);
  
emitter.addlocalmodifier("once", 0, 0, "x", "replace", player.x-30, player.x+30);
}
with(findimg(201)) {
  
attachtoowner = true;
  
this.x = this.dx;
  
this.y = this.dy;
  
layer = 3;
  
emitter.particle.speed = 5;
  
emitter.particle.green = 1;
  
emitter.particle.blue = 1;
  
emitter.particle.red = 1;
  
emitter.particle.image = "npulse-ghosteffect.png";
  
emitter.particle.lifetime = 3;
  
emitter.delaymin = .05;
  
emitter.delaymax = 1;
  
emitter.maxparticles = 10;
  
emitter.nrofparticles = 1;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 4.5;
  
emitter.particle.alpha = .25;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = degtorad(90);
  
emitter.continueafterdestroy = false;
  
emitter.addlocalmodifier("range", 0, 1.5, "alpha", "replace", 0, 1);
  
emitter.addlocalmodifier("range", 1.5, 3, "alpha", "replace", 1, 0);
  
emitter.addlocalmodifier("range", 0, 2.5, "zoom", "replace", 0, 3.5);
  
emitter.addlocalmodifier("once", 0, 0, "y", "replace", player.y-30, player.y+30);
  
emitter.addlocalmodifier("once", 0, 0, "x", "replace", player.x-30, player.x+30);
}
with(findimg(202)) {
  
attachtoowner = true;
  
this.x = this.dx;
  
this.y = this.dy;
  
layer = 3;
  
emitter.particle.speed = 0;
  
emitter.particle.green = 0;
  
emitter.particle.blue = 0;
  
emitter.particle.red = 0;
  
emitter.particle.image = "light4.png";
  
emitter.particle.lifetime = .15;
  
emitter.delaymin = .15;
  
emitter.delaymax = .15;
  
emitter.maxparticles = 1;
  
emitter.nrofparticles = 1;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 10;
  
emitter.particle.alpha = .5;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = degtorad(90);
  
emitter.continueafterdestroy = false;
}
}
  if(
player.chat == "/hallo off") {
with(findimg(200)) {
  
this.x = this.dx;
  
this.y = this.dy;
  
emitter.particle.speed = 0;
  
emitter.particle.green = 0;
  
emitter.particle.blue = 0;
  
emitter.particle.red = 0;
  
emitter.particle.image = "";
  
emitter.particle.lifetime = 0;
  
emitter.delaymin = 0;
  
emitter.delaymax = 0;
  
emitter.maxparticles = 0;
  
emitter.nrofparticles = 0;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 0;
  
emitter.particle.alpha = 0;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = 0;
  
emitter.particle.stretchx = 0;
  
emitter.particle.stretchy = 0;
}
with(findimg(201)) {
  
this.x = this.dx;
  
this.y = this.dy;
  
emitter.particle.speed = 0;
  
emitter.particle.green = 0;
  
emitter.particle.blue = 0;
  
emitter.particle.red = 0;
  
emitter.particle.image = "";
  
emitter.particle.lifetime = 0;
  
emitter.delaymin = 0;
  
emitter.delaymax = 0;
  
emitter.maxparticles = 0;
  
emitter.nrofparticles = 0;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 0;
  
emitter.particle.alpha = 0;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = 0;
  
emitter.particle.stretchx = 0;
  
emitter.particle.stretchy = 0;
  }
with(findimg(202)) {
  
this.x = this.dx;
  
this.y = this.dy;
  
emitter.particle.speed = 0;
  
emitter.particle.green = 0;
  
emitter.particle.blue = 0;
  
emitter.particle.red = 0;
  
emitter.particle.image = "";
  
emitter.particle.lifetime = 0;
  
emitter.delaymin = 0;
  
emitter.delaymax = 0;
  
emitter.maxparticles = 0;
  
emitter.nrofparticles = 0;
  
emitter.particle.mode = 0;
  
emitter.particle.zoom = 0;
  
emitter.particle.alpha = 0;
  
emitter.particle.spin = 0;
  
emitter.particle.angle = 0;
  
emitter.particle.stretchx = 0;
  
emitter.particle.stretchy = 0;
  }
  }
} 


DrakilorP2P 10-31-2010 02:08 AM

I think this is the problem:
PHP Code:

emitter.addlocalmodifier("once", 0, 0, "y", "replace", player.y-30, player.y+30);
emitter.addlocalmodifier("once", 0, 0, "x", "replace", player.x-30, player.x+30); 

It forces the particles to spawn around the place where the player last said "/hallo on". If he's at (32, 32), they'll spawn in the range 32-30 to 32+30 or 2 to 62, which will break when you're on a gmap.

Try this instead:
PHP Code:

emitter.addlocalmodifier("once", 0, 0, "y", "add", -30, +30);
emitter.addlocalmodifier("once", 0, 0, "x", "add", -30, +30); 


And unrelated to the problem, you can remove this:
PHP Code:

this.x = this.dx;
this.y = this.dy; 

And a good way to turn on/off particle effects is to toggle the emitter.emitautomatically flag.

darkcloud667 10-31-2010 02:18 AM

thanks bro, saved my ass.

xXziroXx 11-01-2010 11:40 PM

I certainly hope you plan on adding particleeffectsenabled and lighteffectsenabled checks for this. :mad:

fowlplay4 11-01-2010 11:55 PM

Quote:

Originally Posted by xXziroXx (Post 1609614)
I certainly hope you plan on adding particleeffectsenabled and lighteffectsenabled checks for this. :mad:

Yeah he should probably add things like..

PHP Code:

if (!particleeffectsenabled) {
  
emitter.delaymin = emitter.delaymax = 0.05;
  
emitter.maxparticles = 1000;
} 

:)

Fulg0reSama 11-02-2010 12:23 AM

Nope, He never does lol (take it from someone who has witnessed and seen him in process of making an effect)


All times are GMT +2. The time now is 01:15 AM.

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