I'm not sure how to explain this properly but is there a function that lets you to call output events to be used in maps?
I want to recreate how source map entities can trigger outputs (eg. trigger_once calls the "OnTrigger" output when touched) but as far as I can tell there isn't a way to do this with lua entities.
Basically, I want to be able to do this:
[lua]self:FireOutput("OnMapSpawn") --This will trigger the output OnMapSpawn and can be used in hammer to trigger events[/lua]
Calling that function would trigger any inputs set up in hammer:
[img]https://developer.valvesoftware.com/w/images/4/4a/Output.png[/img]
If a function like this doesn't exist can someone post a request on Github properly explaining what I tried to explain?
I think you want [URL="http://wiki.garrysmod.com/page/Entity/Fire"]Entity:Fire()[/URL] ?
EDIT:
Oh. The wiki says that it fires inputs.... but..... does it do what you want?
I must admit I haven't quite got the hang of the inputs and outputs, sometimes it seems like outputs are inputs to me.
If you can get your hands on any old version of FloodMod, I believe it uses a map-related function to change the water level.
If your entity is derived from any of the default base-entities, you can simply do this:
[LUA]
local tOutputs = {"onstarttouch"}
function ENT:KeyValue(key,val)
key = string.lower(key)
if(table.HasValue(tOutputs,key)) then
self:StoreOutput(key,val)
end
end
function ENT:StartTouch(ent)
self:TriggerOutput("onstarttouch",ent) // 2nd arg is the activator
end
[/LUA]
Entity:Fire() is for when you know the exact entity you want to use inputs on.
In hammer entities have output events that get called, like "OnOpen" when you open a prop door, that allow you to made a light come on for example.
I'm %99.99 sure that in floodmod you just have to name the water something specific so it can be found with ents.findbyname then has Entity:Fire() used on it.
[editline]24th July 2013[/editline]
Is triggeroutput a function only available on source engine base-entities or Garry's mod ones
Sorry, you need to Log In to post a reply to this thread.