Ignite Players in Radius

I’m trying to ignite all the players in the radius of an NPC ENT named beast.

[lua]
beast:Ignite(2,100)
[/lua]

Yet, no players get ignited who are within 200 units of it.

Yeah, well, that’s because fire doesn’t spread properly.

Use ents.FindInSphere() and then run on each of them Ignite()
Just a proper for loop should do.

ents.FindInSphere( beast:GetPos(), 200 )

But how would I make the function then execute on players within the sphere.

You check for players from that function using “for id, ply in pairs( table ) do end” loop in your entitys ENT:Think. If there are player entities returned in that function, then ignite them.

You can also try to call the ignite function in ENT:Think, but I am not sure what of performance.

I tried this, didn’t work.

				ents.FindInSphere( beast:GetPos(), 200 )
				for id, ply in pairs( table ) do 
				ply:Ignite( 40, 0 )
				end

You don’t even know how to use Lua, do you?


for id, ent in pairs( ents.FindInSphere( beast:GetPos(), 200 )) do 
    if ( ent:IsPlayer() ) then
         ent:Ignite( 40, 0 )
    end
end