2 Questions

I already searched the forums for this.

  1. I have some entities that appear on your body when you die. When they spawn though, they have zero velocity. I want them to be realistic and go the same speed as your body (that they supposedly dropped from). I tried using ent:SetVelocity() together with ply:GetVelocity() but it didn’t work. Any ideas?

  2. I have an entity that is automatically created when certain events happen. This is sort of a “waste” entity; a piece of trash. I want it to automatically disappear after some amount of time. I tried timer.Simple() together with self.Remove() bit it didn’t work. Any ideas?

Post the codes of both entities so we can help you

For 2, self.Remove() or self:Remove()? Should be the latter.


Also for 1, did you do **[PhysObj.SetVelocity

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=PhysObj.SetVelocity)** or **[Entity.SetVelocity

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.SetVelocity)**? Should be the former.

For 2


I used the Entity.SetVelocity() function.

and I didn’t know about the SafeRemoveEntityDelayed() function. GmodWiki’s search kinda sucks, as I’m sure you know, and that function didn’t come up when I searched for “remove” and such.

If I continue to have problems I will post my code. Thanks for the help guys.

You need to use : not . for member function calls else you’ll get an error. For example, ent:Remove(), not ent.Remove(), unless you want to pass ent to it (ent.Remove(ent)).


Also, you need to do ent:GetPhysicsObject():SetVelocity() not ent:SetVelocity()

May I suggest using Overv’s Lua search? It’s much easier to search with.

The Wiki search only sucks if you don’t know how to use it.

It depends. If you know what you are looking for, its fine. If you don’t, then it is useless.

I got it working. Awesome. Thank you all so much.