There's a known issue with PF, when creating it with maxscript you have to reload it, for example using hold/fetch:
geo = geometry as array
for OBJ in geo do
(
-- create a particle system
local pf = PF_Source Quantity_Viewport:100
-- save its identifier for later
local handle = pf.iNode.handle
local particleAmount = random 1000 2000
ParticleFlow.BeginEdit()
-- enable render
pf.AppendAction (RenderParticles())
-- add the event to the flow
local e1 = Event()
-- create birth
e1.AppendAction (Birth Amount:particleAmount Emit_Start:0 Emit_Stop:0)
-- position to surface of current object
e1.AppendAction (Position_Object Location:3 Emitter_Objects:#(OBJ))
-- show in viewport
e1.AppendAction (DisplayParticles type:2 color:(random [128,128,128] [192,192,192]))
ParticleFlow.EndEdit()
-- create the "complete" particle system
pf.appendInitialActionList e1
-- force particle flow to update particles
holdMaxFile()
fetchMaxFile quiet:true
-- get the particle flow node again
pf = maxOps.getNodeByHandle handle
-- get particle coordinates
for i = 1 to particleAmount do
(
pf.particleID = i
coord = pf.particlePosition
format "index: %, pos: %\n" pf.particleIndex coord
)
)
On the other hand if you only need random particles on surface, PArray might be a better solution for you:
geo = geometry as array
for OBJ in geo do
(
local particleAmount = random 1000 2000
local pa = PArray emitter:obj formation:0 speed:0 Birth_Rate:particleAmount viewPercent:100 \
Emitter_Start:0f Emitter_Stop:0f wirecolor:(random [128,128,128] [192,192,192])
for i = 1 to particleAmount do
format "index: %, pos: %\n" i (particlePos pa i)
)