Hooking to Entity Outputs?

Is this possible at all, and if so, what’s the function to do it?

You can’t really hook to any given output, only ones given directly to a SENT, which I’m going to assume is what you want.

base_entity/outputs.lua

That contains the code on how scripted entities interact with the I/O system.

Looks interesting, but isn’t that just for creating custom outputs or calling existing ones? What I want to do is to run code on the “OnTipped” output of an npc_turret_floor, rather than call it myself.

Maybe this? I’ve never used it so I could be wrong.

I don’t think so, since that would be inputs like Kill or JoinSquad or something, rather than outputs like OnKilled.

I believe only inputs are hookable, you might want to check out this

http://www.facepunch.com/showthread.php?t=865941

I fixed it myself. Damn lazy FPers :buddy:

Make a custom SENT called turret_controller which accepts a custom input called ‘turretTipped’, or whatever.

Make the onTipped output of any npc_turret_floor entities fire the turretTipped input on the turret_controller SENT.

But my question in the first place was how to make ANYTHING happen on an output, firing another input included.

It is possible, since when an output is added by hammer logic, certain inputs are fired on the target entity to tell it to contact other entities.
I know this because I tried to integrate one of my SEnts with the hammer logic system so they could be used by mappers.
However, I gave up before I got too far due to how frustratingly difficult it is to make Hammer add (and then retain) outputs it doesn’t know about to entities that it’s never heard of, and ended up deleting the Lua files and map in a bout of rage.
At some point, I may try again using fgds to make Hammer play fair, but if you want to have a go before that, just make a basic SEnt that prints everything passed to it’s KeyValue and AcceptInput functions, and then add various outputs both at map start and with the addoutput input.

Possibly something like…

[lua]ent:Fire( “AddOutput,OnTipped turret_controller:turretTipped:!activator:0:-1”,0)[/lua]

This will (hopefully) call the turret_controller’s turretTipped input with the person who tipped it as the attribute.
Or I might be completely wrong.

Hmm, looks like it could work. But how does it know which turret_controller to reference?

Name it.