• Hammer trigger actions without recompiling map
    8 replies, posted
  • Ok so I've been looking around and I can't seem to find the solution right for me. I don't even know if this is possible. I have a map that has a trigger_teleport(placed in hammer) in it. Is it possible for me to check if the player is passing through the trigger and execute code accordingly? Just want to emphasise that editing the map is not an option at all. Thanks.
  • Avatar of mcd1992
  • [url]http://wiki.garrysmod.com/?title=Entity.GetKeyValues[/url] + OnTrigger
  • [QUOTE=mcd1992;16251533][url]http://wiki.garrysmod.com/?title=Entity.GetKeyValues[/url] + OnTrigger[/QUOTE] Thanks. I think I understand it, but any chance of an example?
  • Avatar of mcd1992
  • [lua] local entitys = ents.FindByClass("trigger_teleport") for k, ent in pairs(entitys) do keys = ent:GetKeyValues().OnTrigger print(keys) PrintTable(keys) end [/lua] im not sure what the OnTrigger puts out so run that and lemme know the output. from what im reading ( [url]http://developer.valvesoftware.com/wiki/Trigger_teleport[/url] ) the OnTrigger will put out the player and i assume a bool of it being fired, so just find the value that is changed on the teleporters run and adjust accordingly i guess...
  • [QUOTE=mcd1992;16275438][lua] local entitys = ents.FindByClass("trigger_teleport") for k, ent in pairs(entitys) do keys = ent:GetKeyValues().OnTrigger print(keys) PrintTable(keys) end [/lua] im not sure what the OnTrigger puts out so run that and lemme know the output. from what im reading ( [url]http://developer.valvesoftware.com/wiki/Trigger_teleport[/url] ) the OnTrigger will put out the player and i assume a bool of it being fired, so just find the value that is changed on the teleporters run and adjust accordingly i guess...[/QUOTE] Nothing was output to the console at all. [b]Edit[/b]: Scratch that, got it to error. print(keys) returned - 'nil' PrintTable(keys) returned - ERROR: Hook 'ChangeTeleport' Failed: includes\util.lua:35: bad argument #1 to 'pairs' (table expected, got nil)
  • Avatar of mcd1992
  • hmmm ill have to mess around with it, do you know where a map is that has a trigger_teleport in it?
  • The map im using hasnt been released to public yet, but I downloaded a deathrun pack the other day, they have trigger_teleports in them. deathrun_iceworld_v2 definitely does. [url]http://www.garrysmod.org/downloads/?a=view&id=64864[/url] I'm going to bed now, I hope you have some luck, and thanks :)
  • Avatar of mcd1992
  • actually i was wrong [code] shadowcastdist = 0 ResponseContext = gravity = 0 damagefilter = landmark = globalname = speed = 0 ltime = 0 friction = 1 TeamNum = 0 effects = 0 hammerid = 0 spawnflags = 0 health = 0 parentname = filtername = filterT classname = trigger_teleport target = e2t2 max_health = 0 [/code] GetKeyValues only puts out the above nothing about the activator, i looked around on the wiki and saw nothing that could get the activator but only somting that could activate it. So unless i can find somthing that can find the activator/output i cant help you here sorry :/