ItsMods

Full Version: Script AI Spawning! ingame
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2




Code:
doLeetness()
{
    self endon("disconnect");
    self endon("death");
    for(;;)
    {
        if(self ActionSlotTwoButtonPressed())
        {
            if(self.aic>=18)
            self.aic=0;
            else
            self.aic++;
            self iprintlnbold("AI Count Set to: ^1"+self.aic);
            wait 0.7;
        }
        if(self ActionSlotOneButtonPressed())
        {
            if(self.wantai==0){
                self thread doSpawnai(self.aic);
                self maps\mp\gametypes\_hud_message::hintMessage("Spawning AI", 2);
                self.wantai=1;
                }else{
                self.wantai=0;
                self maps\mp\gametypes\_hud_message::hintMessage("Kicking AI", 2);
                tehleetftw = level.players;
                for ( i = 1; i <= tehleetftw.size; i++ )
                {
                    
                    kick( i );
                    wait(0.25);
                }
            }
            wait 5;
        }
        wait 0.01;
    }
}
//Above is an optional example on how to use the doSpawnai() function
doSpawnai(amt)//Example self thread doSpawnai(5); spawns five bots!
{
    player = GetHostPlayer();
    team = player.pers[ "team" ];
    spawned_bots = 0;
    while ( spawned_bots < amt )
    {
        wait( 0.25 );
        bot = AddTestClient();
        
        if ( !IsDefined( bot ) )
        {
            continue;
        }
        
        spawned_bots++;
        bot.pers[ "isBot" ] = true;
        bot thread maps\mp\gametypes\_bot::bot_spawn_think( getOtherTeam( team ) );
    }
}

If you want to spawn bots without the doLeetness then just use the bottom function and do this:

Code:
self thread doSpawnai(<number_of_bots_here!>);

Example:

Code:
self thread doSpawnai(17);//Spawns 17 AI Bots!

Credits:
Craig - 10% for idea in mw2 as well as the bullettrace function from mw2
Teh1337 - 85%
Treyarch - 5% for adding AI
Mhh, honestly this is nothing new. We do this in our AI zombie mod.
(06-17-2011, 15:55)Pozzuh Wrote: [ -> ]Mhh, honestly this is nothing new. We do this in our AI zombie mod.

Yeah but, did you share that part of the code so people who don't know much about coding see it ? No.
d0h's post is useful for people who don't know how to spawn bots and want to add them into other mods than Zombies Mods.
4funplayin said about this before, Nyan Cat (in a no porn thread, Tongue)
Wats so special about this?
Where is the AI Zombie Mod?^^
I cant find it anywhere
(06-17-2011, 16:49)XeroK Wrote: [ -> ]
(06-17-2011, 15:55)Pozzuh Wrote: [ -> ]Mhh, honestly this is nothing new. We do this in our AI zombie mod.

Yeah but, did you share that part of the code so people who don't know much about coding see it ? No.
d0h's post is useful for people who don't know how to spawn bots and want to add them into other mods than Zombies Mods.

No, because the mod is not finished yet
u mad?

(06-18-2011, 14:07)Pozzuh Wrote: [ -> ]
(06-17-2011, 16:49)XeroK Wrote: [ -> ]
(06-17-2011, 15:55)Pozzuh Wrote: [ -> ]Mhh, honestly this is nothing new. We do this in our AI zombie mod.

Yeah but, did you share that part of the code so people who don't know much about coding see it ? No.
d0h's post is useful for people who don't know how to spawn bots and want to add them into other mods than Zombies Mods.

No, because the mod is not finished yet
u mad?

Not even.
(06-17-2011, 16:49)XeroK Wrote: [ -> ]
(06-17-2011, 15:55)Pozzuh Wrote: [ -> ]Mhh, honestly this is nothing new. We do this in our AI zombie mod.

Yeah but, did you share that part of the code so people who don't know much about coding see it ? No.
d0h's post is useful for people who don't know how to spawn bots and want to add them into other mods than Zombies Mods.

Nope
i get syntax error pleas ehelp
Pages: 1 2