.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Don't jump ? (http://forums.bots-united.com/showthread.php?t=964)

slash-evil 03-03-2004 14:56

Don't jump ?
 
One qeustion , is setting this below bit can make the bot don't jump ?

pEdict->v.button &= ~(IN_JUMP);

I don't think it does , because although I place it into my code , the bot also jump ,is the code wrong , or what , any ideas ???

Pierre-Marie Baty 03-03-2004 16:00

Re: Don't jump ?
 
The code you posted will clear the IN_JUMP bit of v.button. That is, if this bit is set to 1, it will set it back to 0.

Yes, this code can force the bot not to jump, but you have to ensure that nothing sets the IN_JUMP bit again later on in the code, AFTER this bit. The pEdict->v.button fields are only used when pfnRunPlayerMove() is called, not before - so ensure nothing breaks what you've done in between.

bluesy 03-03-2004 16:02

Re: Don't jump ?
 
Try moving that line as close as possible to pfnRunPlayerMove() so you won`t override IN_JUMP by mistake.

*someone beat me to it :D

slash-evil 04-03-2004 00:16

Re: Don't jump ?
 
See this one

Code:

if((BotUsesSniper(pBot) && pBot->iStates & STATE_SEEINGENEMY))
{
        pEdict->v.button |= IN_DUCK;
        pBot->f_move_speed = 0.0;
        pBot->f_sidemove_speed = 0.0;
        pBot->f_move_speed=0; pBot->f_sidemove_speed=0;
    pEdict->v.button |= IN_ATTACK2;
        pEdict->v.button |= IN_ATTACK;
        pEdict->v.button &= ~(IN_JUMP);
}

Are you think the pEdict->v.button &= ~(IN_JUMP); is at the right place ?

*note I tested this code , it worked , it is a improved sniper code done by me
, it is a older version , I have a newer version of the code , so I just need
to make sure the bot don't jump *

Pierre-Marie Baty 04-03-2004 10:06

Re: Don't jump ?
 
Well if it works I suppose it's okay...

But I wouldn't do things like that if it was my own bot. In fact what you are doing is that you are correcting a wrong behaviour by adding the opposite behaviour on top of it. I call this "patching".
You should better try to figure out WHY your bot jumps when using a sniper rifle and make it NOT press the IN_JUMP key then.

Ah I know, it's more difficult. :)

slash-evil 04-03-2004 13:46

Re: Don't jump ?
 
Yeah , you're right , I'm studying the code now !

botman 04-03-2004 15:36

Re: Don't jump ?
 
Why are you pressing both attack buttons at once (both IN_ATTACK and IN_ATTACK2)?

botman

Rick 04-03-2004 23:05

Re: Don't jump ?
 
BLEH useless post :S

Rick 04-03-2004 23:06

Re: Don't jump ?
 
And setting move_speed and side_speed twice to zero :D
I think if you just set IN_ATTACK2 once when he starts to snipe is enough 8)

slash-evil 05-03-2004 09:54

Re: Don't jump ?
 
Ha , it is just for testing !


All times are GMT +2. The time now is 22:10.

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