Advertisement
Guest User

5dewre

a guest
Sep 26th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.76 KB | None | 0 0
  1. /*****  Make the bot MOVE ******/
  2.     // Did we successfully just take a big step?
  3.     if (walkmove(angle, dist))  
  4.     {
  5.        
  6.         if(agr_server & IS_TEST_SERVER)
  7.         bprint(#PRINT_HIGH, "bmd 1, ");
  8.         // Success, we're walking normally
  9.         self.time_till_next_jump = time + BOT_JUMP_INTERVAL;
  10.        
  11.        
  12.         self.jumping_time = 0; // reset the jump counter (we didnt jump)
  13.        
  14.        
  15.         return; // back to the loop
  16.     }
  17.    
  18.    
  19.    
  20.     // we COULDN'T take big steps (We just ran into something...)
  21.     // are we on 'stop on obstacles' mode?
  22.     if (self.stop_on_obstacle==1)
  23.     {
  24.         if(agr_server & IS_TEST_SERVER)
  25.         bprint(#PRINT_HIGH, "botmovedist stop on obstacles mode\n");
  26.         self.time_till_next_jump = time + BOT_JUMP_INTERVAL;
  27.        
  28.         if (self.attack_finished < time)
  29.         GruntyAnim_Stuck();
  30.        
  31.         return;
  32.     }
  33.    
  34.  
  35.     // MAKING BOTS CLIMB LADDERS!!!!
  36.     // Did we successfully just take a small step?
  37.     if (walkmove(angle, 0.25))
  38.     {
  39.         if(agr_server & IS_TEST_SERVER)
  40.         bprint(#PRINT_HIGH, "bmd 2 walkmove(angle, 0.25\n");
  41.         // not sure what "not all corners are valid" means  (defs.qc)
  42.         self.flags = self.flags | #FL_PARTIALGROUND;
  43.         self.time_till_next_jump = time + BOT_JUMP_INTERVAL;
  44.         // we're climbing a ladder!
  45.        
  46.         self.jumping_time = 0; // reset the jump counter (we didnt jump)
  47.  
  48.         return;
  49.     }
  50.     else
  51.     {
  52.        
  53.         makevectors(self.v_angle);
  54.         tracebox (self.origin, #VEC_HULL_MIN,#VEC_HULL_MAX, self.origin + v_forward*8, MOVE_EVERYTHING, self);
  55.         setorigin (self, trace_endpos + '0 0 2');
  56.         bprint(#PRINT_HIGH, "bmd 2B the tracebox");
  57.    
  58.         return;
  59.    
  60.    
  61.     }
  62.  
  63. if (self.grunty_tacticMode == GRUNTY_TACTICMODE_STATIC)
  64.         return;
  65.    
  66.  
  67.     // BELOW THIS LINE: we couldn't take big OR small steps. so it's:
  68.     // JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME!
  69.     // JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME!
  70.     // JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME! JUMP TIME!
  71.  
  72.  
  73.     // need to reset this so that jumping is possible:
  74.     self.flags = self.flags - (self.flags & #FL_PARTIALGROUND);
  75.  
  76.  
  77.     if (self.time_till_next_jump > time)
  78.         return;
  79.    
  80.     self.grunty_movement_type = MOV_FORWARD; // abort dodging
  81.  
  82.     makevectors(self.angles);
  83.  
  84.     // Assess a potential jump
  85.     // Are we on the ground?
  86.     if (self.flags & #FL_ONGROUND)
  87.         traceline(self.origin + '0 0 20', self.origin + '0 0 20' + v_forward * 10, #MOVE_NORMAL, self);
  88.    
  89.     if (trace_fraction == 1.0)
  90.         {
  91.             // OMC: THIS IS WHERE THE BOT DOES TTHE STUPID JUMPING
  92.             // this stops grunty moving when attacking but he still moves while shooting
  93.             // OMC this is the Grunty blocked and jumping forward
  94.        
  95.         //self.velocity = self.velocity + v_forward * 20;
  96.  
  97.         if(agr_server & IS_TEST_SERVER)
  98.         dprint("bmd, 2\n");
  99.        
  100.         //self.velocity_z = self.velocity_z + 270; // jump
  101.         self.velocity = self.velocity + '0 0 300'; // jump
  102.         //self.velocity += v_forward * 20;
  103.        
  104.         //self.velocity_z += 270;
  105.         //sound (self, #CHAN_BODY, "player/plyrjmp8.wav", 1, #ATTN_NORM);
  106.         sound (self, #CHAN_VOICE, "player/plyrjmp8.wav", 1, #ATTN_NORM);
  107.         self.time_till_next_jump = time + BOT_JUMP_INTERVAL;
  108.            
  109.            
  110.        if(sexy)
  111.            {
  112.            
  113.            
  114.            
  115.            
  116.            // if but has jumped over 6 times bot gives up
  117.             if(!self.jumping_time)
  118.                     self.jumping_time = 6;
  119.                
  120.             else
  121.             if(self.jumping_time <= 1)
  122.             {
  123.                 if(agr_server & IS_TEST_SERVER)
  124.                 bprint(#PRINT_HIGH, "botmovedist 4 too many jumps\n");
  125.                 // get me a waypoint
  126.                 self.ai_state = AI_STUCK;
  127.                
  128.                 self.jumping_time = 0; // reset the jump counter
  129.                
  130.             }
  131.             else self.jumping_time--;
  132.             }
  133.            
  134.             return;
  135.         }
  136.         else // trace fraction didnt find anything
  137.         self.time_till_next_jump = time + BOT_JUMP_INTERVAL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement