No matter what, I can’t get an entity I created to load up in-game when the gamemode first initializes. Under the init.lua, I put this simple code calling the initialization of the entity to spawn.
function GM:InitPosEntity() local icedtea = ents.Create("nws_icedtea"); icedtea:SetPos( Vector(-51.686810, 875.094482, -12223.968750) ); icedtea:Spawn(); icedtea:SetTeam(TEAM_POTATO); end
I’ve tried during various things with the function, putting it under GM:Playerspawn, GM:GamemodeInit, other methods that would normally work. I’ve had my code reviewed with friends who have a vast knowledge of lua and they can’t seem to find out what is wrong. My actual “icedtea” entity folder checks out okay. It spawns with console commands and such. But this won’t spawn normally through lua. I’m very much a beginner at lua and I’m stuck at this error.