.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Metamod and metamod plugins (http://forums.bots-united.com/forumdisplay.php?f=15)
-   -   Weapon Accuracy (http://forums.bots-united.com/showthread.php?t=1115)

nG-Juggernaut 17-03-2004 04:00

Weapon Accuracy
 
Hello,
I am trying to make a mod to increase teh accuracy of the mac-10, I am relatively new to plugin coding, but I am a c++ programmer, Any suggestions, links, or source code would be nice

ThankYou,
Juggernaut
#NationGaming
New site coming soon! ( Surreal-Media )

botmeister 17-03-2004 05:50

Re: Weapon Accuracy
 
When a bot does a traceline you can force the trace to point directly at the intended target, this will give you precise aim even with a MAC-10 shooting from far away while the bot is running and jumping like a fool

Code:

pfnTraceLine( pentToSkip->v.origin + pentToSkip->v.view_ofs, pentToSkip->v.origin + pentToSkip-v.view_ofs + gpGlobals->v_forward * 9999, fNoMonsters, pentToSkip, ptr );




You can adjust things to make it more or less precise, otherwise the aim will be too good and very unrealistic.


Pierre-Marie Baty 17-03-2004 12:38

Re: Weapon Accuracy
 
don't forget to call MAKE_VECTORS before this to build the base referential. And this should not be fNoMonsters, but dont_ignore_monsters (if you ignore monsters you will ignore clients as well, and your bullets will simply "pass through" them) :)

nG-Juggernaut 17-03-2004 20:12

Re: Weapon Accuracy
 
Ok, That is semi-helpful, I understand what you are saying, but first, I want to make the accuracy of the gun for EVERYONE in the server, not just a bot(i dont run bots), I also am wondering if anyone can give me detailed in structions on how to do this, and what libs i need to compile this, and what compiler is best for this type of thing, I have the hl sdk(full multi/single), And i use dev-c++, any links, tutorials, or even a fll peice of sourse code to do this would be MUCh appreciated.

ThankYou,
Juggernaut
#NationGaming
New Site coming soon! ( Surreal-Media )

Pierre-Marie Baty 17-03-2004 20:32

Re: Weapon Accuracy
 
This is not a problem, you can very well make a plugin that will affect the accuracy of the gun for everyone and not just a bot.

Make your plugin hook the TraceLine function. Then, do a check on pentToSkip to know if it's a player (having the FL_CLIENT flag set), and if so, to know which gun model he's carrying (check for pentToSkip->v.weaponmodel). Once you know it's a player with a Mac10 in hand, just modify the return results of the TraceLine yourself the way we described and make the function exit with your modified TraceResult :)

botmeister 17-03-2004 22:22

Re: Weapon Accuracy
 
Quote:

Originally Posted by Pierre-Marie Baty
don't forget to call MAKE_VECTORS before this to build the base referential. And this should not be fNoMonsters, but dont_ignore_monsters (if you ignore monsters you will ignore clients as well, and your bullets will simply "pass through" them) :)

What I'm doing is hooking onto the engine pfnTraceLine and passing the same arguments back to the real engine call, i.e., fNoMonsters is one of the arguments which is passed back unaltered.

The only things that are changed are v1, and v2 as shown in my first post, but I'm not using MAKE_VECTORS anywhere and it seems to be working fine for months now. Are you sure a call to MAKE_VECTORS is needed?

???:(

Pierre-Marie Baty 18-03-2004 00:32

Re: Weapon Accuracy
 
MAKE_VECTORS() builds an orthonormal referential of vectors out of a view angle and store each of the 3 vectors coordinates in the gpGlobals structure. If you don't call MAKE_VECTORS() before using gpGlobals->v_forward, gpGlobals->v_up or gpGlobals->v_right, you will use the vectors from the last referential that was declared using MAKE_VECTORS() - which may have been frames ago, for a totally different bot using a totally different view angle. :)

If your code works for months, that's because you're a lucky man: the player who is firing your TraceLine executed a MAKE_VECTORS() call in the engine with his view angle just before. But what if he doesn't ? What if your player calls MAKE_VECTORS() every 4 or 5 frames or so ? You never know what happens in the game DLL :|

Keep this in mind as this is systematic: before using any vector from the gpGlobals referential, ensure the referential is BUILT for the view angles you want to use it with. Calling MAKE_VECTORS() is not very much CPU intensive. I do it systematically. If you don't, you're never sure you're safe.


All times are GMT +2. The time now is 02:59.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.