Getting a console command that uses ent_fire to repeat?
4 replies, posted
Trying to get "ent_fire npc_combine_s setsquad 1" to fire every 20 seconds, but you can't use ent_fire with RunConsoleCommand because the command is blocked. Any clues as to how to do it?
for id, ent in pairs( ents.FindByClass("npc_combine_s")) do
ent:Fire("SetSquad", "1")
end
[QUOTE=Robotboy655;48342498]for id, ent in pairs( ents.FindByClass("npc_combine_s")) do
ent:Fire("SetSquad", "1")
end[/QUOTE]
I know no lua whatsoever, what does that mean and how do I get it to work every 20 seconds automatically?
[code]timer.Create( "CombineFire", 20, 0, function()
for _, ent in ipairs( ents.FindByClass( "npc_combine_s" ) ) do
ent:Fire("SetSquad", "1")
end
end[/code]
[QUOTE=code_gs;48342743][code]timer.Create( "CombineFire", 20, 0, function()
for _, ent in ipairs( ents.FindByClass( "npc_combine_s" ) ) do
ent:Fire("SetSquad", "1")
end
end[/code][/QUOTE]
It didn't work for me.
Sorry, you need to Log In to post a reply to this thread.