Author Topic: Bots that CAN be hurt  (Read 1719 times)

So, i am working on some bot that works independent of Gamemode_zombie.
But so far, not so good.

My bot spawns, performs the action i want (sorta, need to fix it), but:
It can't be hurt.

So what is the best way to spawn a bot?
Currently i am using:
Code: [Select]
%bot = new AIPlayer()
{
datablock = BotArmor;
position = %pos;
};
MissionCleanup.Add(%bot);

There isn't any other way to spawn a bot.

There isn't any other way to spawn a bot.
Any idea what could cause my problem then?

Maybe include it into the mini-game?

You need to make sure the datablock "BotArmor" exists. PlayerStandardArmor is the default datablock for players.

The bot is added into the same minigame as the one who spawns it.

BotArmor is in this case a changed name, just for illustrational purpose.
But I'm fully sure that he datablock that is called exists.

The datablock does also contain a maxdamage.
%pos is also allready stated earlier in the code.

Sorry to bother you with my question with not much more info, but what else is important?

Use the Mission Editor to find a Horse vehicle included in your minigame and find the fields ("Dynamic Fields" with F11/F3 menu) relating to the spawn brick etc. if you want it to be counted like a bot, or give it a client if you want it to be included like a player.

Hmm, giving it a client, eh?

That could be the thing i need, but i guessed i didn't need to actually 'give' it a client.
When i tested the first time i used:
client = %player.client
And that resulted in damaging myself when i shot the bot. :o

I should've known that i needed to give it a client, i was suspecting such a thing allready.

Once again, thanks SpaceGuy.
Also thanks to  all the others, at least you tried to help me.
I appreciate that very much.

It worked.
Massive thanks, now to get the other thing working, but that is a problem not to be posted yet.

Lemme try it myself first, eh?


/locks topic

Unlocked for another question around it.

I gave the bot an AiConnection, however when i killed it:
Quote from: console
WARNING: No player object in GameConnection::onDeath() for client '42143'
The client number stated was the client number of the bot.
Oddly, i really gave it an AiConnection:
Code: [Select]
%sentry = new AIPlayer()
{
datablock = SentryArmor;
position = %pos;
};
MissionCleanup.Add(%sentry);
%sentry.client = new AIconnection()
{
minigame = %client.minigame;
brickGroup = %client.brickGroup; //So the client can still ride horses and whatnot
name = "Sentry";
};
MissionCleanup.add(%sentry.client);
So, i want to know, how to fix this?
EDIT: (Once again, everything called here exists)


Also, when i kill it a CI pops up and displays i killed something without name.
Perhaps related to the console report, or do i need to add something else to fix that?
« Last Edit: May 13, 2010, 06:07:51 PM by lordician »

You'll need to do %sentry.client.player = %sentry;

You'll need to do %sentry.client.player = %sentry;
I can't think of the reason why, but okay, i'll sure try.

Because the game doesn't do it automatically.

Because the game doesn't do it automatically.
So if i give it a client, i still have to put that in to let it act as a player?

And if i want to call the client of the sentry, can i still use the setted client?
Or will it be like this: %sentry.client.player.client

It would be odd if i had to do it like the latter.

Because %sentry.client.player IS %sentry, you could still just do %sentry.client. You could also do %sentry.client.player.client.player.client.player.client.player.client.player.client.player.client and get the same result.
Giving the client a .player and giving that player the .client makes it into a stable reference loop required by several core functions.