• 2 Questions
    9 replies, posted
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
[QUOTE=Jackarunda;24795980]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?[/QUOTE] For 2, self.Remove() or self:Remove()? Should be the latter. [editline]11:18AM[/editline] Also for 1, did you do [b][url=http://wiki.garrysmod.com/?title=PhysObj.SetVelocity]PhysObj.SetVelocity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] or [b][url=http://wiki.garrysmod.com/?title=Entity.SetVelocity]Entity.SetVelocity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]? Should be the former.
For 2 [b][url=http://wiki.garrysmod.com/?title=G.SafeRemoveEntityDelayed]G.SafeRemoveEntityDelayed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
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)). [editline]07:12PM[/editline] Also, you need to do ent:GetPhysicsObject():SetVelocity() not ent:SetVelocity()
[QUOTE=Jackarunda;24804194] 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.[/QUOTE] May I suggest using [url=http://luasearch.overvprojects.nl]Overv's Lua search?[/url] It's much easier to search with.
[QUOTE=iRzilla;24807944]The Wiki search only sucks if you don't know how to use it.[/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.