• Quick question, random entities?
    3 replies, posted
So I have a for loop that will ignite entities, [CODE]local en = ents.FindByClass("prop_physics") for k,e in pairs(en) do e:Ignite(600, 128) end[/CODE] Is there a way to make the game pick an entity at random to ignite? Excuse my novice knowledge in this area, I've just started out. Could I use something like ents.FindInSphere() and use math.random to fill out random numbers for the arguments?
[QUOTE=mogey5101;38796558]So I have a for loop that will ignite entities, [CODE]local en = ents.FindByClass("prop_physics") for k,e in pairs(en) do e:Ignite(600, 128) end[/CODE] Is there a way to make the game pick an entity at random to ignite? Excuse my novice knowledge in this area, I've just started out.[/QUOTE] [LUA]table.Random(en):Ignite(600,128)[/LUA]
Thanks, just wondering if theres some sort of documentation that I can read/look at/search for different functions to use? I've been using the old wiki but sometimes documentation gets burred under piles of other garry's mod stuff.
Well there's also the new wiki as well as the official lua manual (for anything not unique to Garry's Mod).
Sorry, you need to Log In to post a reply to this thread.