Author Topic: why is bot not working  (Read 8314 times)

i have put in the code to make bot

new AIPlayer(bot) { datablock="LightMaleHumanArmor"; position=localclientconnection.camera.getPosition(); };

but nothing happens

                                                   HELP


Because that command was made for Blockland v0002, the beta, not v10. You also have to be the host of the server. (Non-dedicated)

new AIPlayer(bot) { datablock="PlayerStandardArmor"; position=localclientconnection.camera.getPosition(); };

Try that.

I'm assuming you're using this guide or one of the many copies of it. If you are, the other commands in v10 versions:

Spawn Second Bot
new AIPlayer(bot2) { datablock="PlayerStandardArmor"; position=localclientconnection.camera.getPosition(); };

Invisible
bot.hideNode("ALL");

Visible
bot.applyDefaultCharacterPref s(); (probably, I haven't tested)

Bot Weapons
bot.mountImage(shotgunImage,0); will work if you have Ephialtes' shotgun installed and enabled. Other 'images' to try:
gunImage: Gun
swordImage: Sword
bowImage: Bow
hammerImage: Hammer

The weapons won't run out of ammo in v10.

Bots Fight Each Other
    bot.setAimObject(bot2);
    bot2.setAimObject(bot1);
    bot.setImageTrigger(0,1);
    bot2.setImageTrigger(0,1);

They will shoot at each other, but not hurt each other.

Bot fights a player
    bot.setAimObject(localclientconnection.player);
    bot.setImageTrigger(0,1);

It will shoot at you, but not hurt you. You also cannot hurt it.

Make bot aim higher
bot.setAimLocation(VectorAdd(bot2.getPosition(),"0 0 1"));

Kill bots
    bot.kill();
    bot2.kill();

Make bots follow player
   bot.setMoveObject(localclientconnection.player);

Give bot a name
  bot.setShapeName("Name Here");

Players don't have health bars in v10 when you move your mouse over them.

Make bot walk around randomly
This command is unavailable in v10, unfortunantly.

Get guns
Simply place a brick and use the Wrench on it. You can spawn items from there. Place the Vehicle Spawn brick in the Special tab to create vehicles.
« Last Edit: January 01, 2009, 01:45:38 PM by Space Guy »

omg i worked you the best im so happy words can discrib how happy i am

but the bot is not trying to kill me i shoots one time and thats it

That happens with the Gun, and the weapons that work by 'Clicking' multiple times.

Use:
Code: [Select]
bot.setImageTrigger(0,0);bot.setImageTrigger(0,1);...to get it to fire once. If you keep putting that in the console (press 'up' in the console to get the last thing typed) then it'll keep firing. Alternately, put this line in the console:

Code: [Select]
function AIPlayer::fireGun(%a){%a.setImageTrigger(0,0);%a.setImageTrigger(0,1);%a.schedule(1000,fireGun);}
Then:
Code: [Select]
bot.fireGun();Enter it once per bot. It'll keep firing once a second until it dies.

ok oh and the fight player one  is it so post to aim at you or what


Yey, i thought this still worked for Blockland, but i forgot how to do this ._.

Thanks for posting how to do it Space Guy

Edit: Can you make a bot follow/fire at other players too? If so, how?

Also, will the code to turn the bot invisible make the last bot you spawned invisible or you can choose the one you want by changing the 'bot' part of the code? And to turn it visible again, can't you do bot.unHideNode("ALL");?
« Last Edit: January 02, 2009, 05:19:39 AM by Masterlegodude »

Can you make a bot follow a player? Never mind.

the code isint working for me  :[

Oh wow, I remember those commands...that's when I first started making simple scripts for RTB.  I remember trying to figure out how to add buttons to the old admin menu to control bots, and never quite figuring it out...

Haha, I can remember what I did wrong now that I know better.

Yey, i thought this still worked for Blockland, but i forgot how to do this ._.

Thanks for posting how to do it Space Guy

1. Edit: Can you make a bot follow/fire at other players too? If so, how?

2. Also, will the code to turn the bot invisible make the last bot you spawned invisible or you can choose the one you want by changing the 'bot' part of the code?

3. And to turn it visible again, can't you do bot.unHideNode("ALL");?

1. bot.setMoveObject(findClientByName("Space Guy").player); would make it follow my player, assuming I'm in your server and spawned. You can change the name to anything else.

2. If you replace "bot" in the spawn command with a different name, then you can use that new name instead of "bot" in other functions to make them apply to it. For instance:
Code: [Select]
new AIPlayer(thirdbot) { datablock="PlayerStandardArmor"; position=localclientconnection.camera.getPosition(); };
then
Code: [Select]
thirdbot.setAimObject(bot2);
... would spawn another bot and make it aim at the second one if you have that.

3. That would unhide all appearance parts on the bot, not just the default avatar - you'd get something similar to this, except with some of them coloured:

Alright, thanks Space Guy :D

how do you get to the console?