Modifying the Nodegraph via LUA?

Curious what would be the best way to go about this. Had a good search of the forums and the internet and got a couple on answers, none that clear.

What I’m looking to do is dynamically update the AI Nodegraph mid-game using LUA. This will be used in a sort of maze where corridors and junctions get randomized.

I found one method using the info_node_link point map entity which can enable and disable node links however I don’t know how to trigger it mid-game through LUA. Any thoughts?

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

Sadly, the changes will only take effect after saving the nodegraph and restarting the server. Looking for a way to enable / disable routes dynamically mid-game. Still cool nonetheless.

[editline]1st September 2012[/editline]

Never mind, figured it out.

Because Garrys Mod treats alot of the original map point entities with an index of 0, it was tricky to narrow down to the precise entity to trigger it. Turns out that the ents.FindByName() proved useful here and was able to return the exact info_node_link using the name it was given in Hammer. From there, go ENT:Fire(“TurnOff”) or ENT:Fire(“TurnOn”) to toggle the link.


ents.FindByName("link1")[1]:Fire("TurnOn")

Niiiiiiiice…