• Nodegraph detection?
    10 replies, posted
Well, I'm working on some SNPCs and they work well, but I'm making a director (some sort of AI) that handles the npc spawning, the thing is, I can't make the director detect the ai nodes to spawn them on the nodes, please help
Well what have you tried so far?
I recall Silverlan making a module to manually read those
Well, I saw his code, I tried to use it, but it keeps telling me something Are you talking about this? local _R = debug.getregistry() local nodegraph = _R.Nodegraph.Read() for _,node in pairs(nodegraph:GetNodes()) do local pos = node.pos [...] end
That's just example code - the code you posted doesn't actually work.
Nodegraph only exist when the game loads the map. Then it gets deleted. (Along with other useful entities) You can locate them using GM/EntityRemoved. Don't use GM/OnEntityCreated( ent ) as they haven't been assigned a position yet. Here is a quick script:    _NODES = _NODES or {["node"] = {},["hint"] = {},["climb"] = {}}     hook.Add("EntityRemoved","Nodetest",function(ent)         local class = ent:GetClass()         if class == "info_node" then             table.insert(_NODES["node"],ent:GetPos())         elseif class == "info_node_hint" then             table.insert(_NODES["hint"],ent:GetPos())         elseif class == "info_node_climb" then             table.insert(_NODES["climb"],ent:GetPos())         end     end)
Thanks for the script, I will test it when I got time
What pastebin code..?
The one that Silverlan posted too long ago
(I was specifically referring to the [...] - it's just a placeholder and that's where your node-specific code goes)
OK thanks for the advice, I'm some sort of dumb
Sorry, you need to Log In to post a reply to this thread.