You are on page 1of 2

Hey, I never knew a method like setplayerangles existed, turns out it does exist.

With that method I made bots aim perfectly at players. Here's the code GSC (Quake3) Render in: 0.012 addBotClients() { if(getcvar("scr_numbots") == "") { return; } wait 5; iNumBots = getCvarInt("scr_numbots"); for(i = 0; i < iNumBots; i++) { ent[i] = addtestclient(); wait 0.5; if(isPlayer(ent[i])) { if(i & 1) { ent[i] notify("menuresponse", game["menu_team"], "axis"); wait 0.5; ent[i] notify("menuresponse", game["menu_weapon_ axis"], "kar98k_mp"); } else { ent[i] notify("menuresponse", game["menu_team"], "allies"); wait 0.5; ent[i] notify("menuresponse", game["menu_weapon_ allies"], "mosin_nagant_mp"); } ent[i].isBot = true; ent[i] thread shootPlayers(); } } } shootPlayers() { while(1) { wait .01; if(self.sessionstate != "playing") { continue; } players = getentarray("player", "classname"); dist = -1; nearestPlayer = undefined; for (i = 0; i < players.size; i++ ) { // find nearest alive player who is not a bot if(isdefined(players[i].isBot) || players[i].sessionstat e != "playing") { continue; } if(dist == -1 || distance(self.origin, players[i].origin ) < dist) { dist = distance(self.origin, players[i].origin);

org delete(). if ( z < 50 ) return "crouch". // this is required. return "stand".nearestPlayer = players[i]. } . ( 0.origin[ 2 ]. self. if ( z < 20 ) return "prone". 0 ). case "crouch": z = 30. break. org = spawn( "script_model". break. "tag_helmet". self.self. case "prone": z = 5. org linkto( self. 0. break. y. } // method by Cheese getStance() { if ( !self isOnGround() ) return "in air". ( 0.origin[0].origin[ 2 ] . 55) ).origin ).(self. wait 0. or else the model will not move to tag_helm et by the time it's removed z = org.origin[1].origin[0]. } } if(isdefined(nearestPlayer)) { x = nearestPlayer. 0. 0 ) ). default: z = 40. y = nearestPlayer. z) )). switch(nearestPlayer getStance()) { case "in air": z = 90.origin[1]. } self setPlayerAngles(getAnglesTo( (x. } } } getAnglesTo(origin) { return vectorToAngles( origin .05.