I don't know how to create particles

Dodobee

Member
I'm trying to make my own custom particles spawn whenever the player uses their ability but I have no idea how to turn my particles into an object or how to spawn them when the player uses their ability.
 

Shows you how to create an object. It's in SOC, but you just need to know the overall knowledge.


Shows you how to do that same thing but in Lua code. Since SOCs are loaded after Lua, if you want to use your custom objects in Lua, you have to at least create the Freeslots here.


List of Lua functions. I'll just go ahead and say that you're looking for "P_SpawnMobj", but it's nice to keep all the other functions in mind.

P_SpawnMobj returns the mobj it creates, so:

Lua:
local spawnedparticle = P_SpawnMobj(p.mo.x, p.mo.y, p.mo.z, MT_CUSTOMPARTICLE)
spawnedparticle.momx = P_ReturnThrustX(p.mo, p.mo.angle, -4*FRACUNIT)
spawnedparticle.momy = P_ReturnThrustY(p.mo, p.mo.angle, -4*FRACUNIT)

This spawns a particle and makes it move backwards a bit.
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top