Hi everyone , i have some bugs with this script
[CODE]timer.Create( 'AlienIsolation_RespawnCrates', 20, 0, function()
local crates_found = ents.FindByClass( 'item_ai_crate' )
for i, v in pairs( crates_found ) do
local pos, ang, mdl = v:GetPos(), v:GetAngles(), v:GetModel()
SafeRemoveEntity( v )
local new = ents.Create( 'item_ai_crate' )
new:SetPos( pos )
new:SetAngles( ang )
new:Spawn()
new:SetModel( mdl )
new:PhysicsInit( SOLID_VPHYSICS )
end
end )[/CODE]
when i spawn the entities i froze with my physicsgun and after 20 secs, the entites is unfroze . I try so many differents some ways but it's doesn't work.Please someone can healp me . Thank for help
Well obviously they will reset every single thing you manually do to them if you delete the entity and create it again.
[url]http://wiki.garrysmod.com/page/PhysObj/EnableMotion[/url]
This is the function that will freeze the object in place like the physics gun does.
NOTICE THAT IT IS A PHYSICS OBJECT FUNCTION, NOT AN ENTITY FUNCTION.
Also you should really move the [code]
new:SetModel( mdl )
new:PhysicsInit( SOLID_VPHYSICS )[/code]
Into the ENT:Initialize() which is called when EEntity.Spawn() is called..
Sorry, you need to Log In to post a reply to this thread.