[Preview] Retarded Insane Bots

Topic created ยท 26 Posts ยท 3039 Views
  • Hello everyone. [Post updated]

    Videos first:

    DOME gameplay
    Youtube Video

    LOOKOUT gameplay
    Youtube Video

    AGROUND gameplay
    Youtube Video

    I've modified AIBots animated movement script by S3VDITO (found here) in order for bots to target and engage the player (and other bots too).
    Save the script as retbots.chai in C:\Users\<your username>\AppData\Local\Plutonium\storage\iw5\scripts folder
    (remove all other chai scripts before running of course)

    UPDATE: now script runs with any count of bots and there was added some kind of player protection after spawn - the bots won't target the player for some random seconds after spawn.

    The bots shoot infinitely and move to the player when see him and engage him (and other bots; only first 9 bots are attacked - set the bots_under_attack_max variable, you may decrease or increase the count but on my system I've got slowdowns if more than 9 bots were attacked by other bots).

    The script works in DM; also I've tried it in Gungame, but only the player has weapon progress, the bots have default weapons as in DM.

    Sorry for bad code, no time to fix it at all. That's just proof-of-concept!

    I don't have deep knowledge of Plutonium MW3 scripts, I am sure there are more experienced devlopers who can improve this code. The bots are still stupid, but they attack you and don't run around like dummies - that's the thing I wanted to have since installed MW3.

    The script is provided AS-IS, no warranties of any kind

    Many thanks to S3VDITO !


    1. Works in Deathmatch or Gungame
    2. In order to increase difficulty use Hardcore
    3. You may also edit bot speed in script - gsc.setDvar("testClients_doSpeed", 12) - increase speed to get more insane gameplay
    4. Decrease the number of bots if the game lags or it is too difficult to play
    5. bots_under_attack_max variable - allows to set the number of bots under attack from other bots
    6. BE SURE to enter bot xx command in console BEFORE the countdown before match ends. Do it right after the level loads.

    Download script

    Here is the script source:

    // Retarded Insane bots version
    // Feel free to modify this code as you want!
    // Many thanks and credits to:
    // AIBots by S3VDITO
    gsc.setDvar("testClients_doAttack", 1);
    gsc.setDvar("testClients_doCrouch", 0);
    gsc.setDvar("testClients_doMove", 1);
    gsc.setDvar("testClients_doReload", 0);
    gsc.setDvar("testClients_doWatchKillcam", 1);
    gsc.setDvar("scr_dm_playerrespawndelay", 0); // for hardcore
    //gsc.setDvarIfUninitialized("testClients_doSpeed", 4);
    gsc.setDvar("testClients_doSpeed", 12);
    global bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
    global players_list = [];
    global player_target_list = [];
    global bots_under_attack_max = 9;
    global protectPlayer = false;
    global protectPlayerInterval = 3000;
    level.onNotify("connected", fun(args) {
    	var player = args[0];
    	if(player.getGuid().find("bot") != 0)
    		print("Player connected");
    		player.onNotify("spawned_player", fun[player](arguments) {
    level.onNotify("prematch_done", fun(args) {
    	if(gsc.getDvar("g_gametype") == "dm" || gsc.getDvar("g_gametype") == "gun") {
    		for(var entRef = 0; entRef < players_list.size(); ++entRef)
    			var tempEntBot = gsc.getEntByNum(entRef);
    			if(tempEntBot.getGuid().find("bot") == 0)
    				var animBody;
    				//var animBody = gsc.spawn("script_model", tempEntBot.getOrigin());
    				//animBody.LinkTo(tempEntBot, "tag_origin", [-4, 0, -1], [-4, 0, -1]);
    				setInterval(fun[tempEntBot, animBody]() { 
    					botMoveOnPlayer(tempEntBot, gsc.getEntByNum(0), animBody); 
    				}, 1);
    				var bots_under_attack = players_list.size() - 1;
    				if (bots_under_attack > bots_under_attack_max)
    					bots_under_attack = bots_under_attack_max;
    				for(var i = 0; i < bots_under_attack; ++i)
    					var targetBot = gsc.getEntByNum(i+1);
    					setInterval(fun[tempEntBot, targetBot, animBody]() { 
    						botMove(tempEntBot, targetBot, animBody); 
    					}, 1);
    				//setInterval(fun[animBody]() { 
    				//	animBody.scriptModelPlayAnim("pb_stumble_pistol_walk_forward");
    				//}, 1000);
    		setInterval(fun[protectPlayer]() { 
    			protectPlayer = false;
    		}, protectPlayerInterval);
    def botMove(bot, target, animModel)
    	var bot_weapon_origin = bot.getTagOrigin("tag_weapon_left");
    	if(LockSightTest(bot, target) == false)
    		// animModel.scriptModelPlayAnim("pb_stand_alert_pistol");
    		var angle = gsc.vectorToAngles([target.getTagOrigin("j_helmet")[0] - bot_weapon_origin[0], target.getTagOrigin("j_helmet")[1] - bot_weapon_origin[1], target.getTagOrigin("j_helmet")[2] - 25 - bot_weapon_origin[2]]);
    		// Spaming field bug =(
    		//animModel.set("angles", bot.getPlayerAngles());
    	var moveTarget = target.getOrigin();
    	var distance = gsc.distanceSquared(moveTarget, bot.getOrigin());
    	if(gsc.distance(moveTarget, bot.getOrigin()) <= 256)
    		// bot_speed = 0;
    		bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
    		var normalize = gsc.vectorNormalize([moveTarget[0] - bot.getOrigin()[0], moveTarget[1] - bot.getOrigin()[1], moveTarget[2] - bot.getOrigin()[2]]);
    		bot.setOrigin([bot.getOrigin()[0] + normalize[0] * bot_speed, bot.getOrigin()[1] + normalize[1] * bot_speed, bot.getOrigin()[2] + normalize[2] * bot_speed]);
    def botMoveOnPlayer(bot, target, animModel)
    	// Prevent massive spawn killing of human player! The bots will not lock on player after player spawn
    	if (protectPlayer == true)
    	botMove(bot, target, animModel);
    def HideTestClientParts(bot)
    def protectPlayerOnSpawn(player)
    	protectPlayer = true;
    // Stolen from _stinger.gsc :)
    def LockSightTest(self, target)
    	var eyePos = self.GetEye();
    	var passed = gsc.SightTracePassed(eyePos, target.getOrigin(), false, target);
    	if ( passed == 1)
    		return true;
    	var front = target.GetPointInBounds(1, 0, 0);
    	passed = gsc.SightTracePassed( eyePos, front, false, target );
    	if (passed == 1)
    		return true;
    	var back = target.GetPointInBounds(-1, 0, 0);
    	passed = gsc.SightTracePassed( eyePos, back, false, target );
    	if (passed == 1)
    		return true;
    	return false;
  • I was in the same boat as you. I've wanted this for so long. How do I install this to get started?

  • Well, the installation is easy.
    Once again, put the script in C:\Users\<your username>\AppData\Local\Plutonium\storage\iw5\scripts\ folder
    "C:" - is your Windows system disk
    "<your username>" - is your user's folder
    (you might need to enable showing hidden folders in Windows Explorer)

    When you put the script in this folder it runs automatically when you start the private match
    So, start Free-for-all private match (DOME map is good), immediately open the console with ~, write the command:
    bot 12
    and press Enter
    Then you may choose the team and class

    And you should be running deathmatch with 12 bots. If everything is OK, you may try to increase the bot count the next time (it may cause lags depending on your CPU).

    But dont expect much as i said! My knowledge of the game engine is very limited.
    If anything is wrong, delete the script.

  • This post is deleted!
  • @rrq1257 Ok seems to be working good now. I hope you are looking to expand this further. The possibilities are endless

  • @rrq1257 said in [Preview] Retarded Insane Bots:

    (remove all other chai scripts before running of course)

    Nice work!

  • Do you plan on expanding on this further?

  • UPDATE: I've modified the code. Now script runs with any count of bots and there was added some kind of player protection after spawn - the bots won't target the player for some random seconds after spawn.

    I don't know how to make the script better. Maybe someone else will be able to develop a true bot script.

  • @rrq1257 One day. Does this mod now work on all maps? I had some maps where the bots acted like they normally do.

  • @VERsingthegamez Should work on any map, but better results will be on smaller maps - on large maps the bots don't see each other and don't attack each other.

  • Try to add waypoints ๐Ÿ™‚

    If bots cannot see each other, then they will move along these points to find someone

  • @rrq1257 Execellent work my guy! It's so nice to see the community still making mods for such an old game like this, and this is an excellent start for a proper bot mod.

    All that's really needed now is waypointing and a few tweaks / additions to the AI and we'll finally get to see a bot mod for MW3! Very nice.

  • Hey rrq ๐Ÿ™‚ Is there any place where I could contact you in private about the script? Would be much appreciated!

  • @herodias Sorry, I'm not online often and can't offer support for script in private. Just do everything as written in manual in first post ane the script should work.

  • @rrq1257 I can't say much right now but you might be able to work on some smarter bots soon....

  • it's crazy how even 10 years after the game was released there is still a community enjoying and working on this game !

  • https://forum.plutonium.pw/topic/9174/release-lua-scripting

    You think you might be able to make better bots now?

  • @rrq1257 you should take a look at the new release Lua Scripting (https://forum.plutonium.pw/topic/9174/release-lua-scripting)

    it might give you more possibility to improve the smart bots

  • Hello, very good job you did with the mod, but one question ... is there any way to increase the difficulty to the bots as shown in the videos? Because when I put them in my private game, the only thing they do It is going around shooting like crazy and from time to time taking a detour around the map. Thank you very much and I hope your answer. PS: Excuse my English, I actually speak Spanish so I had to use the translator to write this.

Log in to reply