Displaying Custom Particles

Place to get help with not working mods / modding interface.
Post Reply
User avatar
trylobite
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Mar 14, 2017 4:59 am
Contact:

Displaying Custom Particles

Post 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?

User avatar
Krayt
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Fri Aug 14, 2015 8:47 am
Contact:

Re: Displaying Custom Particles

Post 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

User avatar
trylobite
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Mar 14, 2017 4:59 am
Contact:

Re: Displaying Custom Particles

Post 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.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Displaying Custom Particles

Post 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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”