[Release] QBots

Topic created · 4 Posts · 437 Views
  • [QBots]

    This is a ChaiScript for doing knife lunges and what else in private with bot/bots.
    NOTE: Won't work with multiple people. ( at least ideally )

    Things possible with this script:
    {

    • Save Position | crouch & +reload
    • Load Position | crouch & +activate
    • Spawn Bot ( currently only via Console ) | +actionslot 3
    • Kick Bots ( Kick all bots from game ) | +actionslot 4
    • Move Bot To You ( Move the bot to your current position ) | +actionslot 1
    • Send Me To Heaven ( Sets your origin super high ) | +actionslot 6

    }
    Open the console to see what buttons to use ^^

    Youtube Video

    Download: qbots.chai
    or you can just make it manually at "...\AppData\Local\Plutonium\storage\iw5\scripts"
    and make a ChaiScript and put this code in it:

    
    gsc.setDvar("testClients_doAttack", 0);
    gsc.setDvar("testClients_doCrouch", 0);
    gsc.setDvar("testClients_doMove", 0);
    gsc.setDvar("testClients_doReload", 0);
    gsc.setDvar("testClients_doWatchKillcam", 0);
    
    global Bots = [];
    global sPos = [];
    global sAng = [];
    global stance = "crouch";
    
    level.onNotify("connected", fun(arguments) 
    {
    	var player = arguments[0];
    	if(player.getGuid().find("bot") != -1)
    	{
    		addBot(player);
    		return;
    	}
    	else
    	{
    		BotSystem(player);
    	}
    
    	player.onNotify("spawned_player", fun[player](arguments) 
    	{
    		
    	});
    
    	player.onNotify("SavePos", fun[player](arguments) 
    	{
    		if(correctStance(player))
    		{
    			SavePosition(player);
    		}
    	});
    	player.onNotify("LoadPos", fun[player](arguments) 
    	{
    		if(correctStance(player))
    		{
    			LoadPosition(player);
    		}
    	});
    	player.onNotify("KickBots", fun[player](arguments) 
    	{
    		kickBots();
    	});
    	player.onNotify("SpawnBot", fun[player](arguments) 
    	{
    		spawnBot();
    	});
    	player.onNotify("MoveBotToPlayer", fun[player](arguments) 
    	{
    		var bots = getBots();
    		if(bots.size() > 0)
    		{
    			var bot = bots[bots.size()-1];
    			MoveBotToPlayer(bot, player);
    		}
    	});
    	player.onNotify("SendMeToHeaven", fun[player](arguments) 
    	{
    		SendMeToHeaven(player);
    	});
    });
    
    def BotSystem(player)
    {
    	BotSystemMessages(player);
    
    	player.notifyOnPlayerCommand( "SavePos", "+reload" );
    	player.notifyOnPlayerCommand( "LoadPos", "+activate" );
    	player.notifyOnPlayerCommand( "KickBots", "+actionslot 4" );
    	player.notifyOnPlayerCommand( "SpawnBot", "+actionslot 3" );
    	player.notifyOnPlayerCommand( "MoveBotToPlayer", "+actionslot 1" );
    	player.notifyOnPlayerCommand( "SendMeToHeaven", "+actionslot 6" );
    }
    
    def BotSystemMessages(player)
    {
    	player.iPrintLnBold("\n");
    	player.iPrintLnBold("^9[QBots]^7 ^9Bot system activated!\n");
    	player.iPrintLnBold("\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Save Position:^2 Crouch + [{+reload}]\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Load Position:^2 Crouch + [{+activate}]\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Kick Bots:^2 [{+actionslot 4}]\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Spawn Bot:^2 [{+actionslot 3}]\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Move Bot To You:^2 [{+actionslot 1}]\n");
    	player.iPrintLnBold("^9[QBots]^7 ^3Send Me To Heaven:^2 [{+actionslot 6}]\n");
    	player.iPrintLnBold("\n");
    }
    
    def correctStance(player)
    {
    	if(player.getStance() == stance)
    	{
    		return true;
    	}
    	return false;
    }
    
    def SavePosition(player)
    {
    	sPos = player.getOrigin();
    	sAng = player.getPlayerAngles();
    	gsc.iPrintLnBold("Position Saved.");
    }
    
    def LoadPosition(player)
    {
    	if(sPos.empty() || sAng.empty())
    	{
    		gsc.iPrintLnBold("No Position Saved.");
    		return;
    	}
    
    	player.setVelocity(0);
    	player.setOrigin(sPos);
    	player.setPlayerAngles(sAng);
    	gsc.iPrintLnBold("Position Loaded.");
    }
    
    def addBot(bot)
    {
    	Bots.push_back_ref(bot);
    }
    
    def getBots()
    {
    	return Bots;
    }
    
    def clearBots()
    {
    	Bots.clear();
    }
    
    def spawnBot()
    {
    	gsc.iPrintLnBold("You have to manually spawn the bot via Console: /bot");
    }
    
    def kickBots()
    {
    	var bots = getBots();
    	for(var i = 0; i < bots.size(); ++i)
    	{
    		gsc.kick(bots[i].getEntityNumber());
    	}
    	clearBots();
    }
    
    def MoveBotToPlayer(bot, player)
    {
    	var pOrigin = player.getOrigin();
    	var pAngles = player.getPlayerAngles();
    
    	bot.setOrigin(pOrigin);
    	bot.setPlayerAngles(pAngles);
    }
    
    def SendMeToHeaven(player)
    {
    	var origin = player.getOrigin();
    	origin[2] += 2048;
    	player.setOrigin(origin);
    }
    
  • Have any plans to create way-points for them so they could move around the map?

  • @VERsingthegamez that is not the point of the chai script plz re read what it says, its only ment for knife lunges

  • Thank you very much! I finally can do knife lunge use a bot script

Log in to reply