• ents.Create() doesn't create the entity clientside
    6 replies, posted
I have this serverside code, it is supposed to create an entity on the gamemode initialization and create one every time I call the console command "create_my_lol": [CODE]function GM:Initialize() self:CreateMyEnt() end function GM:CreateMyEnt() ents.Create("lol") end concommand.Add("create_my_lol", function() GAMEMODE:CreateMyEnt() end) [/CODE] So I list the entities (client and server) before and after calling that command. Before calling it I have one entity, which is normal, it appears both serverside and clientside. The thing is, when I call the command the entity is created serverside but it's not created clientside. This is probably just a problem with the way I call the function CreateMyEnt(). Can anyone enlighten me on that matter?
Are you calling AddCSLuaFile in the entities file? The other thing to watch for is PVS, by default entities only exist clientside when they're in what's called your PVS, basically what's near you. Also I'm assuming you've snipped some code out of this - are you calling ent:Spawn()?
Yeah, spawn not being called is your problem.
Oops! The entity didn't have time to be created because the game was paused while I was doing my things in the console :D I just needed to unpause for a second... or test in multiplayer mode. And it turns out I don't need to call ent:Spawn(), is it really necessary to call it? I know it's used to initialize the entity but I'm doing nothing in the function Initialize() anyway.
[QUOTE=garry;40217342]Yeah, spawn not being called is your problem.[/QUOTE] Wait what? I was having trouble spawning client side entities, then I read that you removed spawning client side entities in a gmod 13 update, so I stopped trying...
[QUOTE=ash47;40219011]Wait what? I was having trouble spawning client side entities, then I read that you removed spawning client side entities in a gmod 13 update, so I stopped trying...[/QUOTE] He's not trying to spawn a clientside entity, read his post again (and you still can spawn clientside-only entities, there's a different function for it I think)
[QUOTE=Drakehawke;40219084]He's not trying to spawn a clientside entity, read his post again (and you still can spawn clientside-only entities, there's a different function for it I think)[/QUOTE] Not entities, but clientside models.
Sorry, you need to Log In to post a reply to this thread.