I’ve messaged the mod’s creator and he said it has been so long since he had done anything with LUA he doubt he could help me.
Anyway, this addon has the ability to save a profile that contains information regarding what npc’s to spawn, what path they should follow, weapons they should have, behavior, etc… I want to be able to load a profile and then create a spawner at a specific location…normally the addon does this by taking wherever you ‘shoot’ as the location for the spawner.
The code to do this is in there; I just need to find it and then modify it correctly. The problem is this is one of the most complicated scripts I have looked at and I think it’s beyond my current understanding of lua to figure out on my own. Could someone help me? It’s difficult enough that i don’t even know what snippet to show you to start from.
script in question :http://www.hastebin.com/adizenigif.coffee
net.Start("sv_npctool_spawner_spawn") net.WriteVector(Vector (-8740.279297, -12666.442383, 0.000000)) //position vector net.WriteFloat(57.4) // angle data net.WriteString(GetConVarString("npctool_spawner_class")) net.WriteString(GetConVarString("npctool_spawner_squad")) net.WriteUInt(GetConVarNumber("npctool_spawner_spawnflags"),25) net.WriteString(GetConVarString("npctool_spawner_equipment")) //net.WriteString(GetConVarString("npctool_spawner_soundtrack")) net.WriteUInt(GetConVarNumber("npctool_spawner_proficiency"),4) net.WriteFloat(GetConVarNumber("npctool_spawner_delay")) net.WriteUInt(GetConVarNumber("npctool_spawner_max"),6) net.WriteUInt(GetConVarNumber("npctool_spawner_total"),14) net.WriteUInt(GetConVarNumber("npctool_spawner_turnon"),13) net.WriteUInt(GetConVarNumber("npctool_spawner_turnoff"),13) net.WriteUInt(GetConVarNumber("npctool_spawner_showeffects"),1) net.WriteUInt(GetConVarNumber("npctool_spawner_starton"),1) net.WriteUInt(GetConVarNumber("npctool_spawner_startburrowed"),1) net.WriteUInt(GetConVarNumber("npctool_spawner_deleteonremove"),1) net.WriteUInt(GetConVarNumber("npctool_spawner_patrolwalk"),1) net.WriteUInt(GetConVarNumber("npctool_spawner_patroltype"),2) net.WriteUInt(GetConVarNumber("npctool_spawner_patrolstrict"),1) net.WriteUInt(table.Count(tbKeyValues),8) for key,val in pairs(tbKeyValues) do net.WriteString(key) net.WriteString(val) end local numPPoints = #tbPatrolPoints net.WriteUInt(numPPoints,12) for i = 1,numPPoints do net.WriteVector(tbPatrolPoints*) end net.WriteUInt(table.Count(tbRelationships),8) for class,disp in pairs(tbRelationships) do net.WriteString(class) net.WriteUInt(disp,3) end net.SendToServer() print ("attempting npc spawn") end
Setting the pos/angle was simple but tbKeyValues I’m not sure about. I cannot seem to find the area of the script where I could print it’s value to find what I should use for it. If I remove that line and the lines below about PatrolPoints and Relathionships, then it DOES work however, they don’t use the patrolpoints at all…