Bot Bug in firing

Discussions about Coding and Scripting
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Bot Bug in firing

Post by Gadavre »

I ask to help to fix lack of firing at the player in my Mutator
-----------------------------------------------------
VIDEO
https://youtu.be/H7J4HTZFmXs
-----------------------------------------------------
In the original game, bots can not shoot at the player at a very large distance. I put this line in my Mutator and bot began to see the player! Now we see the animation of aiming. But we don't see the shot. What can prevent firing at a great distance? Please help to fix!

Code: Select all

function ModifyPlayer(Pawn Other)	// called by GameInfo.RestartPlayer()
{ 
        Bot(Other).BaseAlertness = 2.000000;

        if ( NextMutator != None )
	NextMutator.ModifyPlayer(Other); 
}
Last edited by Gadavre on Sun Dec 11, 2016 11:27 pm, edited 6 times in total.
User avatar
sektor2111
Godlike
Posts: 6402
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Bot Bug in firing

Post by sektor2111 »

Do you have a pain in wrapping your code ? If We all are players Will only spread Accessed Nones...

Code: Select all

if (Bot(Other) != None)
	Bot(Other).BaseAlertness = 2.000000;
else

Code: Select all

if (Other.IsA('Bot'))
	Bot(Other).BaseAlertness = 2.000000;
Because ModifyPlayer is NOT ONLY FOR BOT :loool: .
And then SightRadius goes at 5000 UU but... I cannot be sure if SeePlayer is being called at 100000 UU. When I was talking somewhere about an additional attached Bot Brain everybody doesn't have a clue why I was speaking about such things. Okay, keep going...
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Bot Bug in firing

Post by Gadavre »

sektor2111
I tested your lines. They also don't work. I increased the variable Sight Radius to the value 10000 - 20000. It didn't help.
Increased visibility also did not help ( In original game by default 128).

Code: Select all

if (Other ! = None)
        Other.Visibility = 255;
User avatar
sektor2111
Godlike
Posts: 6402
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Bot Bug in firing

Post by sektor2111 »

Visibility has nothing to do with SightRadius, see wiki before wasting more time.

Else it's normal to not work, but nobody is getting hurt if you WRAP codes properly - even if are not useful for this job.

Engine will lag itself at testing huge ranges, definitely this is not an answer...

Like I SAID, A.I. AKA Artificial Intelligence (stupidity) AKA BOT uses SeePlayer for detecting enemies. That crap is called by LORD ENGINE who need your help because he is wacky and poor.
User avatar
OjitroC
Godlike
Posts: 3601
Joined: Sat Sep 12, 2015 8:46 pm

Re: Bot Bug in firing

Post by OjitroC »

You could have a look at the code for the TWFSightRadius Version 3 mutator, as "it allows the bots to spot another player at infinite distance", and see if it would help you (I use it playing with bots on large sniper maps and it certainly seems to work well, enabling the bots to spot the player at very long range and take shots - it does, though, throw up quite a few script warnings).
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Bot Bug in firing

Post by Gadavre »

OjitroC wrote:You could have a look at the code for the TWFSightRadius Version 3 mutator, as "it allows the bots to spot another player at infinite distance", and see if it would help you (I use it playing with bots on large sniper maps and it certainly seems to work well, enabling the bots to spot the player at very long range and take shots - it does, though, throw up quite a few script warnings).
I tested this Mutator (TWFSightRadius Version 3) with Mutator Sniper Arena. The Bot also couldn't shoot at the player who was on the top platform with a SniperRifle (see my video above).
User avatar
OjitroC
Godlike
Posts: 3601
Joined: Sat Sep 12, 2015 8:46 pm

Re: Bot Bug in firing

Post by OjitroC »

So, as you say, the problem is not that the bot does not see the player but that the bot does not fire at the player. Does it happen with ALL/ANY bots on THIS map? Does it happen on other maps? Is it to do with the bot skills settings (skills, accuracy, combat style etc)?
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Bot Bug in firing

Post by Gadavre »

OjitroC wrote:So, as you say, the problem is not that the bot does not see the player but that the bot does not fire at the player. Does it happen with ALL/ANY bots on THIS map? Does it happen on other maps? Is it to do with the bot skills settings (skills, accuracy, combat style etc)?
Right!

--- merged ---

I think the code of this function from original class"Bot" prevents the shoot at the player. What do you think?
Spoiler
function Killed(pawn Killer, pawn Other, name damageType)
{
local Pawn aPawn;

if ( Killer == self )
Other.Health = FMin(Other.Health, -11); // don't let other do stagger death

if ( Health <= 0 )
return;

if ( OldEnemy == Other )
OldEnemy = None;

if ( Enemy == Other )
{
bFire = 0;
bAltFire = 0;
bReadyToAttack = ( skill > 3 * FRand() );
EnemyDropped = Enemy.Weapon;
Enemy = None;
if ( (Killer == self) && (OldEnemy == None) )
{
for ( aPawn=Level.PawnList; aPawn!=None; aPawn=aPawn.nextPawn )
if ( aPawn.bIsPlayer && aPawn.bCollideActors
&& (VSize(Location - aPawn.Location) < 1600)
&& CanSee(aPawn) && SetEnemy(aPawn) )
{
GotoState('Attacking');
return;
}

MaybeTaunt(Other);
}
else
GotoState('Attacking');
}
else if ( Level.Game.bTeamGame && Other.bIsPlayer
&& (Other.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
{
if ( Other == Self )
return;
else
{
if ( (VSize(Location - Other.Location) < 1400)
&& LineOfSightTo(Other) )
SendTeamMessage(None, 'OTHER', 5, 10);
if ( (Orders == 'follow') && (Other == OrderObject) )
PointDied = Level.TimeSeconds;
}
}
}
Last edited by Metalfist on Sun Jul 28, 2019 9:15 am, edited 1 time in total.
Reason: Merging posts
User avatar
sektor2111
Godlike
Posts: 6402
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Bot Bug in firing

Post by sektor2111 »

I think default sniper rifle has 4096 range, the rest is a myth at this weapon regarding to 5000 Sight triggered by a DefencePoint, LOL.

Above code is for picking next enemy from a closer horde and not for tracing a 10000 UU sphere space.

And here you came at my point. I did not loved Bot, so I did MBot - now it's your turn to make your own Bots and leave alone EPIC because is a waste of time.
User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: Bot Bug in firing

Post by Chamberly »

Now the question is, do you have the code to make the bot fire at target? Since if it only see you... there is no other command telling it to shoot?

Btw, I think you are coding into a custom sniper rifle?
Image
Image
Image Edit: Why does my sig not work anymore?
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Bot Bug in firing

Post by Gadavre »

Chamberly wrote:Now the question is, do you have the code to make the bot fire at target? Since if it only see you... there is no other command telling it to shoot?

Btw, I think you are coding into a custom sniper rifle?
I have no such code. The bot shoots as it is specified to him in the original game. yes, i m coding into a custom sniper rifle. But bots do not shoot at long range
with a standart sniperrifle.My SniperRifle does not affect the behavior of the bot.

I suggest community to fix it. I don't know what to do.
User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: Bot Bug in firing

Post by Chamberly »

Gadavre wrote:I have no such code. The bot shoots as it is specified to him in the original game. yes, i m coding into a custom sniper rifle. But bots do not shoot at long range
with a standart sniperrifle.My SniperRifle does not affect the behavior of the bot.

I suggest community to fix it. I don't know what to do.
Funny that you suggested the community to fix it (like really? Not all of us can do it!). It's a lot more complicated than that. Coding is beyond the simplification of getting things up and running in easy mode, and, a lot of time to learn to learn to code properly and how to work on some progress to build up.
Just like planning a house, you'd need knowledge and specific requirements, the tools, and your own design in mind.

So to resume, I can tell that you're simply lying that you said you have no such code. The code you posted up there in beginning of the thread, IS part of a code...

Not sure what you rather wanting to do with the sniper, so we have no idea what's going on without the full context of details of what you are trying to do.

But there can be errors in the code you are trying to work on already so we don't know where to look if you modify something else already in full source.

So tbh, if you wanting to make your own sniper rifle in custom, look at some that are already made. No need to modify anything else to swap the engine into trouble and errors by modifying bots and everything else.

Just my 2 cent.
Image
Image
Image Edit: Why does my sig not work anymore?
User avatar
EvilGrins
Godlike
Posts: 9657
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Bot Bug in firing

Post by EvilGrins »

Gadavre wrote:In the original game, bots can not shoot at the player at a very large distance
That depends on your bot...
Image
...I was never a fan of the default settings.

If you hype up a bot's skill, alertness, & accuracy (not necessarily as high as that above but more than the medium) it will not only shoot at you from very far away, it will often kill you without you having a clue where it was.

I'm not a coder, I go with the initial basics and customize all my bots individually.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
OjitroC
Godlike
Posts: 3601
Joined: Sat Sep 12, 2015 8:46 pm

Re: Bot Bug in firing

Post by OjitroC »

I agree with EG - I think it could well be down to your bot skill settings (as EG indicates and as I suggested earlier) - I've certainly not had your problem with bots (I do use a lot of MBots, which you could try out to see if there is any difference in behaviour, and TSFSightRadius; I have not experienced any problems with bots not firing at long range). The bot in your video seems to avoid combat rather than seek it, as should be the case, so what combat style setting are you using for your bots and what base skill setting in the Start Practice Session menu?
User avatar
papercoffee
Godlike
Posts: 10441
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Bot Bug in firing

Post by papercoffee »

Weapon defines bot behaviour.
Post Reply