• Cannot spawn custom NPC
    1 replies, posted
Hi, With the help of a tutorial I've created a shopkeeper NPC. It works great, but has to be spawned manually with ent_create npc_testshopkeeper. The server the addon is going on only runs one map, and I'd like to spawn 4 of this NPC at certain points around the map. Unfortunately the following code doesn't spawn any. It doesn't produce any LUA errors, but it does write 'working' to the console. (some of my debug code) init.lua [lua] local function Init_TriggerLogic() --if SERVER then local ent1 = ents.Create("npc_zombie") if(ent1~=nil) then ent1:SetPos(Vector(494.909241,1050.031250,64.031250)) ent1:SetAngles(Angle(9.656099,-90.406731,0.000000)) ent1:Spawn() end local ent2 = ents.Create("npc_testshopkeeper") if(ent2~=nil) then ent2:SetPos(Vector(327.159698,1050.006226,64.031250)) ent2:SetAngles(Angle(9.656099,-90.406731,0.000000)) ent2:Spawn() end local ent3 = ents.Create("npc_testshopkeeper") if(ent3~=nil) then ent3:SetPos(Vector(197.012878,1050.031250,64.031250)) ent3:SetAngles(Angle(9.656099,-90.406731,0.000000)) ent3:Spawn() end local ent4 = ents.Create("npc_testshopkeeper") if(ent4~=nil) then ent4:SetPos(Vector(56.945251,1050.031250,64.031250)) ent4:SetAngles(Angle(9.656099,-90.406731,0.000000)) ent4:Spawn() end --end print("working") end hook.Add( "InitPostEntity", "ShopkeepersSpawnOnMapLoad", Init_TriggerLogic ) [/lua] Thanks, YM Edit: Forgot to mention, the first one spawns a zombie instead as a test that the custom npc isn't the issue. The zombie doesn't spawn either.
Turns out that this error only occurs in the Cinema gamemode. Does anyone know of any reason entities fail to spawn in Cinema?
Sorry, you need to Log In to post a reply to this thread.