AI Tutorial
Better Jumping

 

     Okay, you gotta agree with me... the Tutor Bot bot can't jump for beans! So were gonna try and fix THAT! so read on!!!

     Open Tutor.qc and look for THIS


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void() check_for_ledge =
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
local vector spot;

// movetogoal() will never move over a legde, so we have to 
// check for a break in front of him and force him to jump

        if (random() < 0.80)
                return;

        if (!(self.flags & FL_ONGROUND))
                return;

        makevectors (self.angles);
        spot = self.origin + (v_forward * 60);
        spot = spot - '0 0 35';
        if (pointcontents(spot) == CONTENT_EMPTY)
                bot_jump1();
};

      And replace that WHOLE thing with this:

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void() check_for_ledge =
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
local vector spot;

        if (!(self.flags & FL_ONGROUND)) // The bot can ONLY jump if he is on the ground
                return; // If he's not then don't jump

        makevectors (self.angles); // Jump the way he's a facin
        spot = self.origin + (v_forward * 5); // Coffee put that at 60.. I think he was drunk 
        spot = spot - '0 0 45'; // WOW he's checking WAY to deep for a ledge! Let's fix that! (Higher value = Less deep)
        if (pointcontents(spot) == CONTENT_EMPTY) //Look for a empty content!
                bot_jump1(); // Tell him to jump
};

    Feel free to change and PLEASE experiment! It's the way of a true QuakeC master!
 


What We Learned

1. Coffee get's drunk
2. One piece of AI can affect a whole lota stuff
3. Pointcontents() checks the world for a substance


     Author: Renegade
     Questions: jsneep@shaw.wave.ca
     AI chat on ICQ: 4437290