I started lua day before yesterday, and I’ve run into a bit of a snag. Im using the “template npc” method to spawn npcs. In other words, i already have spawn points set up, and the npc i wish to spawn “prebuilt” into the map. It works beautifully activating the npc_template_maker “INSIDE” hammer, but i’d like to choose between sandbox mode, and that. So i thought i would try some gamemode scripting.
I was able to set all the basics up, and i wanted to create a function to activate the npc_template_maker thus beginning the headcrab spawning. Here is that function:
BeginSpawn = function() local Spawner = ents.GetByClass("npc_template_maker") Spawner:Fire("Enable","",5) end
In my mind this should work well after thoroughly reading through the lua documentation for the “Fire” action. But i receive the error
attempt to call method 'Fire' (a nil value)
Any clue what im doing wrong here? I know i just started the other day, but im normally good at figuring things out, but this is just stumping me.