• Ignite Players in Radius
    5 replies, posted
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.
[QUOTE=rbreslow;42033286]ents.FindInSphere( beast:GetPos(), 200 ) But how would I make the function then execute on players within the sphere.[/QUOTE] 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
[QUOTE=rbreslow;42033551]I tried this, didn't work.[/QUOTE] You don't even know how to use Lua, do you? [code]for id, ent in pairs( ents.FindInSphere( beast:GetPos(), 200 )) do if ( ent:IsPlayer() ) then ent:Ignite( 40, 0 ) end end[/code]
Sorry, you need to Log In to post a reply to this thread.