• manhack npc control
    2 replies, posted
So I need to control a manhack npc based on the left mouse button. The mouse button part works it's just that most of my methods of getting the npc manhack to move have crashed the server. These attempts have included applyforce and Ent:SetVector ( same as the code below except a change to mhent:SetVelocity ) [code] function KeyPressed (ply, KEY_LEFT ) local traceRes = ply:GetEyeTrace() while ply:KeyReleased( KEY_LEFT ) != true do Msg ("KAOOM AND THE STAIN IS GONE\n") --dev message local mhent = ents.FindByName( "plymanhack-" .. ply:Nick() )[1] --the manhacks name mhent:GetPhysicsObject():ApplyForceCenter( traceRes.HitPos ) end end [/code] All I want to know is how to get a manhack to budge towards any Pos while left mouse is pressed
-snip- sorry I misunderstood.
Try setting last position, then setting a running schedule on it, it will not strafe, but it will go to the direction you specified in the Set Last Pos function. [b][url=http://wiki.garrysmod.com/?title=NPC.SetLastPosition]NPC.SetLastPosition [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [b][url=http://wiki.garrysmod.com/?title=NPC.SetSchedule]NPC.SetSchedule [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Sorry, you need to Log In to post a reply to this thread.