![]() |
emitters
I've started working on a weather script, and I decided to use an emitter, to reduce lag. I've been reading the wiki, stefan's example, examples on here, and I can't figure out why this emitter isn't emitting:
PHP Code:
|
Quote:
|
You didn't define the emitter's red, blue, or green, so it's assuming they're all 0, which would cause it to not show.
|
hmm, I added emitter.particle.reb, blue, and green, got rid of the .emit(), and it still does nothing? :frown: srry
|
Not sure but, you have no modifiers, telling it what to do after it's emitted. I'm not all that great with the particle emitter crap and I don't have NC on any servers at the moment, so I can't test it out :[
|
Sorry, I missed this:
You have: emitter.nofparticles = 20; The proper variable is 'nrofparticles' I'm not sure if it assumes it to be 1 if it's not defined, but that may be your problem if it doesn't assume it to be 1. |
Yay, now i have 1 raindrop....that stays still x_x
I can take the movement stuff off the wiki I suppose, but what would control the number of particls? I thought that was nrofparticles, but apparently not. I've changed the x and y to random variables. Still nothing. |
To control the movement, you can:
use the zangle to make all particle movement upwards (set it to emitter.particle.zangle = 1; ) or downwards (-1). use 'speed' to control the rate the particles move in whatever dir it is (emitter.particle.speed = x; at x tiles/second). And there's other stuff too, but from what I was told Stefan made this weapon NPC so I'm sure it may help you. This code is for a falling leaves effect: PHP Code:
|
okay, I have rain! :D
But there's a few things I wonder if I can fix. First off, the rain stays in one place, it doesn't follow the player. And it seems to expance over a gmap, I'm not 100% sure if it stops, but I suppose it would :\ PHP Code:
|
you'd want to set attachtoowner=true, and/or attachposition=true to make it follow the player. And yeah, those are the modifiers I was refering to in the earlier post.
|
Or you could put it on the screen (layer >= 4)
|
Docu Emitters
First off, Particle Emitters, or 'emitters' for short, are an extra segment of GraalScript2 added to v4. An emitter is an object within the TShowImg, or an image shown by a showimg() function. To understand emitters, one must understand first off what parts of an image we would need to alter, as well as some of the functions and commands one should know beforehand. Please note that one should not try to create an emitter without at least having some previous knowledge of basic GraalScript2
Primarily, the function 'findimg()' is used very, very often when creating emitters. This function works just like 'findplayer()' or 'findnpc()', as in, it returns the reference to an object. 'Findimg()' is used clientside with the emitters. Here is an example of code using 'findimg()': NPC Code: This script would show 'block.png' at the player's location, then change the image to 'light2.png', move the image three tiles up and left, and change the alpha to .9. 'Findimg()' is very, very handy. Secondly, an image not shown has an x and y value identical to the player's. For example: NPC Code: Would set the player's chat to the x value of the current player, as image 1 was not defined in that script. Also, for an undefined image, the 'image' attribute is "", or an empty string. And third, you do not need to define the image with 'showimg()' in order to cast an emitter on it. Most emitters I make are targeting images that have not been defined with script, unless, for instance, I'm making a cauldron NPC, which then would need the cauldron image to show. Now, I will teach the emitters from start to finish, minus a small handful of details which I, myself, still don't understand. A particle emitter is an object. Just like 'player.' or 'this.', it is an object. It's parent is the TShowImg, which is the showimg object. First off, you do not need to define an image to cast an emitter on it. in fact, I did not and I made some pretty nice and simple emitters. Now, the 'emitter.' object is how we access and create an emitter. First off, the basics: PHP Code:
PHP Code:
PHP Code:
Now, emitters have something called 'modifiers' that, well, modify the emitter, basically. This is where my knowledge is slightly vague, as there are three types of modifiers, and I only understand one of them, so I will only teach one of them. The syntax for a modifier is as follows: PHP Code:
For example, if I set the 'lifetime' to 3, and do this NPC Code: Then the particles will start out with an 'alpha' value of 1, then fade to 0, arriving at 0 just as their lifetime ends. If you use "add" or "multiply" for the 'process', then the attribute you have for 'modified_attrib' will either be added to or multiplied by a random number between 'new_min' and 'new_max'. There are two more modifiers that exist PHP Code:
Just fiddle around with emitters, and you should get the hang of it. There's one last function I'd like to teach first PHP Code:
Now, if you understood all that, you should know as much about emitters as I do. So, go off onto your local GS2 server with your new, shiny VIP account and script up a storm! Note, you can put emitters in a weapon NPC (NPCw) or a level NPC. It doesn't matter, as long as it's clientside. So now, I hope you can use emitters for effects, ranging from weather systems to pick axes, crafting hammers, warp rings, fun effects scripts, and about anything else you can imagine. In my private hangout level, I have emitters to mimic the burning of incence, which looks rather nice. |
Ugh at message limit.
That post is at the exact message limit x_x
Anyway, I wrote that docu a long while back, and it should help. It gives an entire tutorial about emitters. Stefan's official docu about emitters was, in part, taken from my docu, so I think this should help. Contact me on aim at TheOneGC is you have any questions. |
| All times are GMT +2. The time now is 12:07 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.