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«First 1 2 Next»
#21
02/19/2006 (10:40 am)
Hmm.. what about moving the mount# itself? For instance: Say we mount the emitter to mount1 node. Then, 1/2 second later, switch it to mount2 then mount3 and so on. Would this be better than looping an animated mount node?
#22
02/19/2006 (11:01 am)
that would work but animating the node is better
#23
03/28/2006 (6:21 am)
Nice Ressource, thx! :)
#24
08/30/2006 (6:36 am)
This is a really great source. I am only having one problem though. My weapon starts firing immediately when I enter the game and quits when I hit the fire button. Any explanation would be greatly appreciated. Thanks.
#25
09/08/2006 (11:58 pm)
Robert, when/how are you mounting the "mountedImage" image?

Oh and mounting it to your weaponslot isnt a very good idea, i dont think. Normally its mount1 or mount0 i think, i cant remember.
#26
09/26/2006 (10:24 am)
This working great ! Only problem is, I would like to switch the muzzleVelocity by hitting a key and I'm a little confused as to which way to approach this. Any help is greatly appreciated.
#27
09/27/2006 (5:34 pm)
Still can't get the muzzle velocity to change dynamically, any ideas anybody ?
#28
04/25/2007 (12:51 am)
Although it seems to work just fine, I get a weird (null) node at the origin on my level, streaming ID# as fast as they come out of my actual mounted particle emitter projectile. Everything's fine, I just got this additional thing going on, and of course I'm wondering if it is wasting resources...anyone else seen this?
#29
05/17/2007 (9:59 pm)
Very helpful, great for placing particle emitters on shapes with only torquescript.

There is a big problem though as the projectile created doesnt flow smoothly with the mount, it lags behind in a wierd sort of way.
#30
07/20/2007 (1:28 pm)
Hmm, I can't seem to get this resource to work... I am getting that '' attempting to call function 'mountImage' as well. Not sure what is going on to make this error.

The particles should just be coming off my guy without me doing anything else in the game after the call is executed right? And if I comment out the animate 1-7 part because I don't have the fire file will it still work?
#32
08/30/2007 (12:34 pm)
I am having a lot of trouble with these mounted particles making my game crash. I have this code running and spewing out little sparks for some filler effect but when i try to switch levels i am getting a crash and it is due to the mounted particles. I have a feeling they are not being destroyed properly or something like that.

Anyone else get this crash when they are using this particle emitter? Anyone got any suggestions on how to thouroughly delete this thing before switching a level?
#33
08/30/2007 (3:30 pm)
Question: How do you know they are causing the problem? Also, are you using Torsion?
#34
11/02/2007 (9:47 am)
Had an error and realized that I didn't read the directions good enough,

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

Check your code in mountedParticle.cs down in:

datablock ShapeBaseImageData(mountedImage)
{
shapeFile = "~/data/shapes/dummy1.dts";

the file name points to "~/data/shapes/dummy1/dummy1.dts";
I had to change it to "~/data/shapes/dummy1.dts";

No big deal, but thought it might help someone that can't get it to work. Something to check.


Also, anyone having any problem with a really bright circle being rendered below the player using other emitters, such as the ember emitter included stock starter.fps

AWESOME resource, it is very, very handy!

DER...THINK BEFORE YOU SPEAK..figured out the bright circle...
#35
01/23/2008 (1:34 pm)
It Works! Great resource!
Thanks Chris!
and thanks Pablo for mentioning the mountedParticle.cs name mistake and Chris R for the Fire0-7 - With those fixed. It works! Now I just gotta adjust the particle I want!! =)

Nuts.. this doesn't seem to want to do the sort of particle that I wanted.. I wanted a slow steady pulsing one, whereas this seems to want to be a fast flickering type (eg., flame) darn
#36
01/15/2009 (9:24 am)
Could someone please tell me where I can download mounted particles.zip? I've been searching this redesigned resource page for about an hour and cannot find a link to the zip file.
#37
12/02/2009 (10:19 pm)
Hi guys,

I am running into an error when I run the %obj.mountImage(mountedImage,1); function. Whenever I call the function I get this error:

Unable to find object: '' attempting to call function 'mountImage'

I have tried retrieving the player using %client.player but I still get the same error. I commented out all of the animation so the fire1-7 shouldn't be a problem.

Would really appreciate any help,
Thanks
#38
12/02/2009 (10:30 pm)
Can you post the code where you set the %obj? I think it's null.
Page«First 1 2 Next»