Game Development Community

dev|Pro Game Development Curriculum

Mounted Particle Emitters

by Chris Labombard · 07/04/2005 (2:06 pm) · 38 comments

Download Code File

Ok. The "mounted particles.zip" file contains the following:

...mountedParticles.cs
...A folder containing:
dummy1.dts
dummy1.png

Put the dummy1 folder in the ~/data/shapes folder.

Place mountedParticles.cs in ~/server/scripts.

open game.cs... add the following line with all the other execs

exec("./mountedParticles.cs");

Open Player.cs ... search for maxInv...

Beneath all the other maxInv's add the lines:

maxInv[mountedImage] = 10;
   maxInv[mountedImageAmmo] = 50;

Ok... You are going to have to change the actual emitter blocks. I am using an animated fire texture to set my enemies on fire. They are the first 3 or 4 datablocks.

Alright, now to start the particle emitter emitting particles simply call:

%obj.mountImage(mountedImage,1); // Where %obj is the player to mount to

and call:
%obj.unmountImage(1);

If you want to start it again just mount it again.

Have fun with it.

About the author

I have been a professional game programmer for over 5 years now. I've worked on virtually every platform, dozens of games and released a few of my own games, including 2 iPhone titles and a title waiting release on Big Fish Games.

Page «Previous 1 2
#1
07/05/2005 (10:34 am)
This looks like a great resource, but the download sends me back to the resourse itself.
#2
07/05/2005 (11:18 am)
@Chris: If you edited the resource you have to re-upload the file with the edit otherwise the link will do what its doing :) Cool resource btw
#3
07/05/2005 (5:17 pm)
Strange... I didnt edit it. Sorry about that.

..... Fixed .....
#4
07/06/2005 (12:02 pm)
I love it. Just what many people needed I imagine.
#5
07/07/2005 (12:32 pm)
Sorry, but it doesn't work by me.
It comes always the error message: Unable to find object: '' attempting to call function 'mountImage'

And i have problems to assign new particlestextures instead of the "Fire0" - "Fire7".
#6
07/07/2005 (4:47 pm)
@Chris - You will have to post more of the console.log...

It looks like it is calling %col.mountImage where %col should be the colliding player, but isn't.

You can make the particle emitters any kind of emitter you want them to be. Try using the camp fire that came with starter.fps.
#7
08/11/2005 (2:44 pm)
Thanks Chris,
As a new programmer to torque this was the first possible emitter mounting ive been able to do. Simple scripting can go a long way, on the other hand it seems like the emitters dont get to be felt at full force since they are only in play for a moment before being deleted and created again. Is there a way that we can just give them the ability to move? I want to be able to dynamically change the positioning of the emitters depending on collisions/triggers.
Thanks
#8
08/11/2005 (4:11 pm)
sdsuEdCenter - The emitters dont get deleted and created again unless you set the image trigger.

Otherwise they just keep on emitting.

What do you mean move ? this will mount it to a player. If you animate the mount node the emitter will follow with it.
#9
10/05/2005 (12:08 pm)
One issue to alert users.

If you have multiple mounted emitters on multiple players, MAKE SURE to change

datablock ProjectileData(mountedProjectile)
{
...
armingDelay = 100;
...
}

to a number much higher, like 1000. I had 2 players each with a mountedImage, but when both attempted to be rendered at the same time, they would disapear. I don't know exactly why this is, I guess something being spawned too fast. I found it didn't change the desired visual of my particle emitter by changing this value, but it did prevent them from disapearing.
#10
10/23/2005 (11:40 am)
Hey Chris, there is a typo in the article that could bring problems to copy/pasters like me. :D
It says:

"open game.cs... add the following line with all the other execs
exec("./mountedParticles.cs");"

But the filename in the resource is actualy "mountedParticle.cs"

Great resource btw.

Cheers!
#11
11/16/2005 (1:20 am)
this is an awsome resource ,
is there a way for the emitter to be rotated?( pointing down instead of up ) i tried to to rotate the mount1 node on the model but it doesn't work.
#12
02/19/2006 (8:42 am)
complete noob here, but I'm not understanding how to get this in-game? How do I actually attach the fire to a player?
#13
02/19/2006 (9:14 am)
Alright, now to start the particle emitter emitting particles simply call:


%obj.mountImage(mountedImage,1); // Where %obj is the player to mount to
#14
02/19/2006 (9:15 am)
Chris - If you change the emitter to emit down instead of up it will do what you want.
#15
02/19/2006 (9:55 am)
I got how to do it but didn't post yet ;). I've got it working, now the trick will be to figure out how the heck to make it swirl around the player versus just encapsulate it. How do I make the fire rotate on the z axis?
#16
02/19/2006 (10:08 am)
I dont think you can Jonathan without some hefty soruce modifications
#17
02/19/2006 (10:12 am)
i can't make it move in a circle? if i make it move in a circle, then the gravity being negative will automatically move it upward and get the swirl effect. i just gotta figure out how to make it move in a circle.
#18
02/19/2006 (10:15 am)
animate your mout... then the particle emitter will follow it.
#19
02/19/2006 (10:19 am)
how would i animate the mount? you mean animate the dummy dts?
#20
02/19/2006 (10:22 am)
Your player model has a mount# node that youre attaching the dummy.dts model to.

Animate that mountPoint on the player
Page «Previous 1 2