I wrote a simple function to turn an entity into an actual emitter (instead of just making particles appear near player):
function RPG2_Particles(EnemyID,pSource,pScattering,pFrequency,pScale,pReverse)
-- Define local variables
local dX = 0
local dY = 0
local dZ = 0
local dScale0 = 0
local dScale1 = 0
-- Process Source
if pSource == 0 then
dX = 0
dY = 0
dZ = 0
elseif pSource == 1 then
dX = g_Entity[EnemyID]['x'] - g_PlayerPosX
dY = g_Entity[EnemyID]['y'] - g_PlayerPosY
dZ = g_Entity[EnemyID]['z'] - g_PlayerPosZ
end
-- Process Scale
if pReverse == 0 then
dScale0 = 10
dScale1 = pScale
elseif pReverse == 1 then
dScale0 = pScale
dScale1 = 10
end
-- Execute Particle Emitter
ParticlesAddEmitter(EnemyID,1,0,dX,dY,dZ,dX,dY,dZ,0,dScale0,0,dScale1,-(pScattering/10),0,-(pScattering/10),pScattering/10,1,pScattering/10,0,0,0,10000,10,100,0,1,pFrequency/10)
end
Add the above function to your script between init() and main() and call it like this:
RPG2_Particles(e,1,1,1,100,1)
First parameter is entity ID (e), second tells the source of the emitter (0 = player, 1 = calling entity), third the amount of particle spreading (0 = straight up, etc), fourth is the frequency/10, fifth the maximum size of the particles and sixth defines whether particles grown or shrink (0 = grow, 1 = shrink).
Edit: smallg, answers to your previous question: the field created with the command as I showed in the previous post does follow player. I don't know why it is so. The rain box is a good guess. The only way to make the emitter stay in one place is to make the script always calculate the coordinates of that place relative to player location before calling the emitter command (my solution as showed in this post is to calculate distance of player and the emitter entity in each axis and use that distance as both min and max value in that axis, so the "field" will become a spot that is located inside the entity no matter where player moves).