How to use ents.FindInSphere

First of all, I’m making some beginner entities and I want to use this to find all props in a sphere from the entity and sets them on fire.

I know how I would do this in E2 but I’m confused with the lua way, some help would be appreciated.

I know the synax of it:

E = ents.FindInSphere( Barrel:GetPos(), 256 )

E now contains a table of entities upon which you can iterate.

[lua]for key, value in ipairs(E) do
if ValidEntity(v) then v:Ignite() end

So this would ignite every found prop in table E.

How would I make it more of a “spreading” type. What I’m thinking is that you can find X amount of props closest that are not on fire then make a timer to ignite them until all of the found props are ignited.

Would this work?

I think DarkRP has firespread, you could use that example to see how they did it.

Do you know where is could be, I searched through the obvious ones and didn’t find anything.

sv_gamemode_functions.lua #661

Find in files is your friend.

Oh, forgot about that function in N++

Wait, what darkrp version are you looking in?


Okay, here is my code

//Made by Vexx

e2function void entity:entIgnite( number Life, number Radius )
local ent = this
local E = ents.FindInSphere( ent:GetPos(), Radius )

    if ent and ent:IsValid() then   
            -- local class = ent:GetClass()
			if !ent:IsOnFire() then
				if not Radius then
					Radius = 0 
				ent:Ignite( Life, 32 )
				if( ent:IsOnFire() ) then
					if Radius > 0 then
						for k, v in ipairs(E) do  
							if ValidEntity(v) then 
								v:Ignite( Life, 32 )



This works except I want the search to continue so it can set props that come in radius after the ignite as happens to ignite.

Sloppy coding I know, I just started today.