ItsMods

Full Version: Get alive bot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Code:
//put these on top of your file...
#include common_scripts\utility;
#include maps\mp\_utility;
//end

getBot()
{
    for(i=0;i<level.players.size;i++)
    {
        p = level.players[i];
        if(p is_bot() && isalive(p))
            return p;
    }
}
Cant make this work Sad((
well when i see how fast you reply on several threads then its no wonder that it doesnt work cause you probably didnt even tested it Oo
Doesn't work on bots spawned after match start using code.
It should. You should always add bot.pers["isbot"] = true when you add a bot..
(09-24-2011, 10:52)d0h! Wrote: [ -> ]well when i see how fast you reply on several threads then its no wonder that it doesnt work cause you probably didnt even tested it Oo

He just spammed to 10 posts.
I like it awesome
C++ Code
  1. mg_add_bots( numBots, team )
  2. {
  3. team = "allies";
  4. for( i = 0; i < numBots ; i++ )
  5. {
  6. wait 0.50;
  7. bot[i] = AddTestClient();
  8. while(!IsDefined(bot[i]))
  9. {
  10. bot[i] = AddTestClient();
  11. continue;
  12. }
  13.  
  14. bot[i].origin = self.origin;
  15. bot[i].angles = self.angles+ (0,180,0);
  16. bot[i].pers[ "isBot" ] = true;
  17. bot[i].name = "BOT [ " + i + " ]";
  18. bot[i] thread maps\mp\gametypes\_bot::bot_spawn_think("allies");
  19. bot[i] thread maps\mp\gametypes\_bot::bot_set_difficulty( "hard" );
  20. bot[i] waittill("ok_to_loadout");
  21. bot[i] takeAllWeapons();
  22. currentWeapon = "knife_mp";
  23. bot[i] giveWeapon( currentWeapon );
  24. bot[i] SwitchToWeapon( currentWeapon );
  25. bot[i] FreezeControls(false);
  26. bot[i].maxhealth = 500;
  27. bot[i].health = bot[i].maxhealth;
  28. //bot[i] setmodel("infected_char_3");
  29. bot[i].pers[ "team" ] = team;
  30. bot[i].team = team;
  31. bot[i].pers[ "savedmodel" ] = undefined;
  32. bot[i].pers[ "teamTime" ] = 0;
  33. bot[i].sessionteam = team;
  34. bot[i].isInfected = false;
  35. bot[i].isInfectedDef = false;
  36. spawnPoint = bot[i] getSpawnPoint();
  37. bot[i] SetOrigin( spawnPoint.origin );
  38. bot[i] SetPlayerAngles( spawnPoint.angles);
  39. bot[i] thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  40. buildhud();
  41. bot[i].tag_stowed_back = undefined;
  42. bot[i].tag_stowed_hip = undefined;
  43. bot[i] SetAnim( %ch_under_b07_frantic_engineer_01 );
  44. level.botCount++;
  45. }
  46. iPrintln("^1MINIGAME: ^7bots spawned, good luck!");
  47. }


Not when spawned like this Big Grin
You set
'bot[i].pers[ "isBot" ] = true'
so it will work lol
Try it Tongue
Pages: 1 2