Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-26-2005, 06:31 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Talking TGC's School of Script: Emitters

Okay. About time I shared my newfound and dearly loved knowledge on emitters. (This is an extremely long post, but read it if you want to learn Particle Emitters through and through, and yes I will start from the beginning).

First off, new function, we will need this for the Emitters:
PHP Code:
findimg(index
This function can be used for the following script:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
showimg(1,"block.png",player.x,player.y);
  
findimg(1).player.5;
  
with (findimg(1)) {
    
mode 1;
    
red 1;
    
blue 0;
    
green .5;
  }

In short, findimg(index) works exactly like findplayer(index), and can be used in much the same way, but relative to images, and not a player.
Important notes before we start:
  1. Indefined images have an image of "" (A blank string)
  2. Undefined images have an x and y equal to the player's x and y

Now, onto Particle Emitters!!

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. (Attached is a preview of what I have made, and that's on Babylon). Now, the 'emitter.' object is how we access and create an emitter. First off, the basics:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
with (findimg(1)) {
    
layer 2// This will make the emitter draw under the player
    
player.x;
    
player.y// These will show the emitter at the player's coords. 
Follow along with what I'm doing? Now, here are the variables we will need to define, after setting the layer, x, and y, still inside the findimg() bracket:
PHP Code:
emitter.delaymin float// This is the minimum delay between emissions
emitter.delaymax float// This is the maximum delay between emissions, both of these are in seconds
emitter.emissionoffset string// In format of "{float, float, float}", it's the offset from the x, y, and z that an emission will show. It's the delta variables for the location, basically.
emitter.nrofparticles integer// The number of particles to be released at the same exact time when the emitter emits. For example, set this to two, and you'll have two particles released every time instead of the default 1 
There. Define those as you wish. I have the mindelay as .01 and the max as .05. The offset I have as {.5,0,0}, which places the left edge of the emitters .5 tiles to the right. Now, time to teach how to change the particle attributes, and not just the base laws that govern them.
PHP Code:
emitter.particle.lifetime float// How long, in seconds, the emitter lasts.
emitter.particle.image string// The imagename of the emitter
emitter.particle.mode integer// Either 0, 1, or 2, the same as changeimgmode
emitter.particle.alpha float// Between 0 and 1, the alpha colour for transparancy
emitter.particle.zoom float// The zoom effect of the particle
emitter.particle.red float;
emitter.particle.green float;
emitter.particle.blue float// These three are between 0 and 1, and they're the colours of the individual particles

emitter.particle.zangle float// Between 0 and pi*2, it's the upward angle of the particles. Remember zangle from the shoot() function? Same basic idea.
emitter.particle.angle float// Again, between 0 and pi*2, it's the angle that the particle should flow.
emitter.particle.speed float// I'm not sure if this is measured in Tiles per second or what, but it's the speed. Higher = faster, obviously
emitter.particle.stretchy float// Remember elipses from your Advanced Algebra class? The eccentricity? Remember that? This is it! Yay. Values less than 1 stretch it horizontally, while values more than 1 stretch the image vertically. Fun, fun. 
Now time to close the code!
PHP Code:
  }

There.

Well, I hope that taught you a thing or two about emitters! <3, and attached is the picture of what I've done with my emitter images. Note: You'll have to change the image's x and y to the player's x and y inside a timeout loop if you want the emitter to follow the player, as I have it.

Have fun!

EDIT: I left out the things I, myself, don't fully understand. Sorry. z-z
Attached Thumbnails
Click image for larger version

Name:	emitters.png
Views:	444
Size:	147.0 KB
ID:	33200  
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight

Last edited by ForgottenLegacy; 08-26-2005 at 06:46 PM..
Reply With Quote
  #2  
Old 08-26-2005, 07:05 PM
Gamba_Legend Gamba_Legend is offline
Slow NPC Scripter
Join Date: Jun 2005
Location: Asbury Park, New Jersey
Posts: 63
Gamba_Legend is on a distinguished road
Send a message via AIM to Gamba_Legend
thats pretty O.o
__________________

is bad
IDC!
s-t-f-u
Reply With Quote
  #3  
Old 08-26-2005, 07:45 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
You totally forgot about local and global modifiers. You will need those if you want to make nice effects with the particle engine. =/
__________________
Liek omigosh.

Reply With Quote
  #4  
Old 08-26-2005, 08:27 PM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
Then tell us about local and global modifiers.
TGC doesn't have Stefan's particle system script to look at for reference.
Reply With Quote
  #5  
Old 08-26-2005, 08:38 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by ChibiChibiLuc
TGC doesn't have Stefan's particle system script to look at for reference.
Now he does.
__________________
Liek omigosh.

Reply With Quote
  #6  
Old 08-26-2005, 10:23 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Quote:
Originally Posted by ChibiChibiLuc
Then tell us about local and global modifiers.
TGC doesn't have Stefan's particle system script to look at for reference.
Yeah I did Yen, it was in Alex's NPC. I just now learned what they can do, so I didn't include it in my post.

I won't post them now because I don't know the difference between a LocalModifier and a GlobalModifier. Ajira gave me an idea, but until he gets an answer from Stefan or I find a way to verify his idea, I won't include them.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #7  
Old 08-27-2005, 02:30 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
"omgomgomg breaks of rule #2 ! delet plx !"



way to go, TGC!
keep up the good work
I'll be besting you shortly when i can log on again
(and have time to play with them -.-)




Edit:
Quote:
Originally Posted by ForgottenLegacy
Indefined
might want to fix that
__________________
Reply With Quote
  #8  
Old 08-27-2005, 02:34 AM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by calani
"omgomgomg breaks of rule #2 ! delet plx !"
Stop doing that please =/
Besides, it doesn't break the rule. He gave the basis of a script, not an actual script, and it was just for educational purposes anyway.
__________________
Liek omigosh.

Reply With Quote
  #9  
Old 08-27-2005, 02:37 AM
Gamba_Legend Gamba_Legend is offline
Slow NPC Scripter
Join Date: Jun 2005
Location: Asbury Park, New Jersey
Posts: 63
Gamba_Legend is on a distinguished road
Send a message via AIM to Gamba_Legend
Yeah
Please keep up the good work guys
you give slow retarded scripters like me a fair chance at good NAT'ing
<3
__________________

is bad
IDC!
s-t-f-u
Reply With Quote
  #10  
Old 08-27-2005, 04:11 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Quote:
Originally Posted by Gamba_Legend
you give slow retarded scripters like me a fair chance at good NAT'ing
hehe



Quote:
Originally Posted by Ajira
Stop doing that please =/
Besides, it doesn't break the rule. He gave the basis of a script, not an actual script, and it was just for educational purposes anyway.
Seriously, if I posted something like that, it would likely get deleted for the same reason as the last three: supposedly breaking rule #2 with script(s) that demonstrated how to do something with a non-working, bare-bones script.
__________________
Reply With Quote
  #11  
Old 08-27-2005, 04:25 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Rule two states I cannot give a full and complete working script that a person can copy and paste, to solve their problem.

I didn't do that. I gave every aspect of a system, every aspect I understood at that moment, in an effort to teach people about a brand new system that I like. Now, I do think I'm able to post whole scripts as 'donations' to the Grawl public, but I'm not sure. Am I allowed to do that? (If so, I might end up having a few gifts for you guys ^_~)
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #12  
Old 08-27-2005, 04:27 AM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
It's also illegal to harass players and use RC to give out player's IPs...
But nobody cares, do they?
Reply With Quote
  #13  
Old 08-27-2005, 04:33 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Its also apparently illegal to post broken and incomplete scripts that appear to be complete
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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