A bit of a complicated code request.

I need a code to ignite all entities in a certain radius of an entity. Thanks!

(User was banned for this post ("Undescriptive thread title" - mahalis))

not complicated at all… Use FindInSphere and ignite the found entites :smiley:

FindInSphere is supposedly bugged. I’ve never used it myself, but… if it is, util.TraceLine will do the job almost as well.

In case FindInSphere is bugged…

[lua]function IgniteRadius(ent,rad)
for _,v in ipairs(ents.GetAll()) do
if ent:GetPos():Distance(v:GetPos()) <= rad then

Bugged? How so, i use it with my entity spawning function, to make sure the entity’s don’t spawn near one another, i call it up to 1000 times in a game and don’t notice any bugs.

local RadiusThatYouWantToIgniteEverythingWithin = 20
Entity:Ignite( 5, RadiusThatYouWantToIgniteEverythingWithin )
Seriously, does anyone read the wiki at all?

Correct me if I’m wrong, but wont that call on EVERY entity? So it would possibly keep catching entites that are under 20 units on fire from that entity, and the next entity, and the next and so on.

No because the other ignited entities aren’t having ignite run on them, just being ignited.

I know it can become very laggy becuase it uses up alot of memory for the checks (compared to other methods) but no, I haven’t found any bugs with it either.

Banned for a non descriptive thread title. well sorry about my unethical thread title.

Back to the point:

I now have:

function SWEP:kaboom(boom, block)
local brickloc = block.FindInSphere( Vector(0, 0, 0), 500 )
local explode = ents.Create( “env_explosion” )
explode:SetPos( boom )
explode:SetOwner( self.Owner )
explode:SetKeyValue( “iMagnitude”, “220” )
explode:Fire( “Explode”, 0, 0 )
explode:EmitSound( “Combine_Console.Detach”, 400, 400 )

and it didnt work.

It says it cant call findinsphere due to a nil value. Help?

Just like Lexic said the second value is the ignite radius…
so Ignite(60,500)