Page 1 of 1

Displaying Custom Particles

Posted: Sat May 13, 2017 8:39 pm
by trylobite
Does anyone know how to display particles like smoke? I want to be able to show a particle at (x,y) with a particular png file. I'm not sure how to define the entity for it, however - I've looked at projectiles and explosions, but none of them are even displaying the png. Has anyone successfully created a custom particle?

Re: Displaying Custom Particles

Posted: Sun May 14, 2017 2:01 pm
by Krayt
To your second question: What exactly do you mean with custom particle? I was successful in changing the properties of the smoke a custom train emits to be tinted red plus a few other things. Would that count as custom particle in your definition? Then I could share my approach.

Example definition of red and thicker smoke:
entities.lua
With color you can change the tint and opacity of the grayscale sprites quite easily.
Under filename you should be able to change the sprites to something else.

I figured this out when looking inside the file data/base/prototypes/entity/demo-entities.lua. There also is a function to create custom smoke by specifying some options. Here I don't know how to use this function from a file in the mod, which is the reason I copied all attributes of smoke manually.

Greetings
Krayt

Re: Displaying Custom Particles

Posted: Sun May 14, 2017 8:09 pm
by trylobite
Thanks! I ignored the lua files starting with "demo," so I never found the code for smoke. I changed the filename and set the animation parameters to all 1's - might not be the best way to display a static image, but it certainly works! Thanks again.

Re: Displaying Custom Particles

Posted: Mon May 15, 2017 9:05 am
by bobingabout
A static image is just a 1 frame animation.

Note the demo- prefix on file names are the only files that exist in the demo. All files are used by the full game.