• addoutput not working in Entity:Fire
    0 replies, posted
I need an entity I'm spawning in lua to give outputs so I can get feedback from it (it isn't an SNPC or SENT, so I'm limited in what I can do). After some painfully slow google searching and an impressive amount of trial and error, I got the addoutput command to work in the console. Naturally, I simply decided to take what I'd done in the console and convert it into an [URL="https://wiki.garrysmod.com/page/Entity/Fire"]Entity:Fire[/URL] lua command. Sadly, though, the equivalent code in lua doesn't work. I'm not sure if it's a silly formatting issue on my part, or if something's wrong with Entity:Fire, as I get no lua errors in game, and the code has no obvious effect, if it has any. Using turrets and the player as a test, this command works in the console (when fired on an npc_turret_floor and it is tipped and finished panicking, the player is set on fire): [code]ent_fire annpc_turret_floor addoutput "OnTipped !player,ignite, 0,1"[/code] However, this lua code has no effect: [code]ATurretEntity:Fire("addoutput","\"OnTipped !player,ignite, 0,1\"")[/code] I'm open to other alternatives, but the only other option I found was abusing the functionality of [URL="https://wiki.garrysmod.com/page/Entity/SetKeyValue"]SetKeyValue[/URL], but I couldn't get it to work either, and it has even less documentation then addoutput, somehow. I prefer the addoutput method, as I put a lot into getting it to work at all; It'd be a shame to see all those google searchs and failed console commands be for nothing :pudge: Although I referenced [URL="https://facepunch.com/showthread.php?t=1244717"]this thread[/URL] quite a lot, I couldn't get any of the mentioned output adding options to work in lua (the SetKeyValue method shown doesn't even seem to allow me to specify a target entity). Furthermore, the solution the OP decided to go with involved coding lua hooks, which I can't do because I'm not working with an SENT or SNPC. I've had key values and spawnflags working for a little while now, and the options displayed for those seem to work, it's just adding outputs that seems to be beyond me. EDIT: I managed to figure out how to do this. It turns out that the examples for using SetKeyValue to send outputs I found were completely inaccurate. The following shows how to correctly configure an output with it: [code]turret:SetKeyValue("OnTipped","!player,ignite,1,0,1")[/code] I hope this helps someone :3
Sorry, you need to Log In to post a reply to this thread.