is there a way to make a slight aim assist that makes your screen follow an NPC for 3 seconds if your looking near the npc?
there is
and that is?
though i cant for the life of me find the wiki page needed for it XD sorry
thats ok
[url]https://wiki.garrysmod.com/page/Player/GetEyeTrace[/url]
[url]https://wiki.garrysmod.com/page/Player/SetEyeAngles[/url]
likely these two pages should help you
but how do i get it to follow?
also is there a swep hook that set the reload speed?
kulcris that's very vague. Even I don't know what you'd do with it.
Reload speed needs to be handled by manually writing over the reload function, I know what you need to do but that's something for another time.
As for your original question, you'll need to find some way to scan the area near the crosshair, something like FindInCone. however, FindInCone is not only extremely resource intensive, it's also non-functional and will always have a 90º vertex last I checked. You're better off going with dot products or something, but I myself could not tell you how to do it because I've never actually used dot products before.
Once you do find the entities near the crosshair, you'll then have to do a comparison of the distance to the player and grab the entity that's closest. From there you'll want a Think hook (in the shared realm so that it's predicted on client) to set the eye angles of the player towards the entity.
It seems a bit weird to have it lock on though, why not just make it like they do for most console shooters these days? Have it just "snap" to the target and then lower sensitivity until the entity is either out of range of the aim assist cone or the player dispatches the target.
you could iterate over all the players by using player.GetAll() and converting their eye positions to 2D screen vectors using the ToScreen() function and then checking to see if they are near the center of the screen. For actually aiming at them i would get the angle between you and the player by taking your eyepos, then subtracting their eyepos before converting the final vector into an angle
[URL="https://wiki.garrysmod.com/page/Vector/Dot"]https://wiki.garrysmod.com/page/Vector/Dot[/URL]
Read example 2
[QUOTE=Nick78111;49293664][URL="https://wiki.garrysmod.com/page/Vector/Dot"]https://wiki.garrysmod.com/page/Vector/Dot[/URL]
Read example 2[/QUOTE]
This helps me too, thanks
Sorry, you need to Log In to post a reply to this thread.