Page 1 of 1

The problem with determining the position of the bot

Posted: Fri Dec 22, 2017 7:36 pm
by Gadavre
I can't for a long time to solve this problem, please help!

the task such: to write the condition in function Timer() under which the bot will not perform a specific function. The bot has in its inventory only 2 weapons (SniperRifle and ImpactHammer) The bot should not perform the function, if he holds the ImpactHammer in his hands.

Code: Select all

if (...)
continue

It didn't help

Code: Select all

function Timer()
{
local Bot B;
ForEach AllActors(class'Bot', B)
{
        if ( SniperRifle(B.weapon) == None)
                        continue; 
}
}
How to write the condition?

Re: The problem with determining the position of the bot

Posted: Fri Dec 22, 2017 8:56 pm
by sektor2111
Inside Iterator continue means: skip this and move to the next
Translated it sounds like: If Bot weapon is not a SniperRifle check next Bot - nothing in common with ImpactHammer.

Re: The problem with determining the position of the bot

Posted: Sat Dec 23, 2017 1:03 am
by Barbie
Maybe you should explain more detailed what you want to achieve...

Re: The problem with determining the position of the bot

Posted: Sat Dec 23, 2017 2:08 am
by JackGriffin
This is using the sledgehammer approach, you need a scalpel instead. Share what you are trying to do and we will help you get there.

Re: The problem with determining the position of the bot

Posted: Sat Dec 23, 2017 2:11 am
by sektor2111
I think I got it.
He has that ShootTarget thing which... I don't know what version will use... However, a Bot should not aim enemies from far away locations with ImpactHammer - he has to Impactjump-ing to target not aiming enemies. Fix me if I'm wrong :mrgreen: .

Re: The problem with determining the position of the bot

Posted: Sat Dec 23, 2017 2:38 am
by papercoffee
Hey ...maybe it's a new long range Impact Hammer? :ironic:

Re: The problem with determining the position of the bot

Posted: Sun Dec 24, 2017 10:16 pm
by Gadavre
sektor2111 wrote:I think I got it.
He has that ShootTarget thing which... I don't know what version will use... However, a Bot should not aim enemies from far away locations with ImpactHammer - he has to Impactjump-ing to target not aiming enemies. Fix me if I'm wrong :mrgreen: .
Yes you are right. The bot should not aim with ImpactHammer at the enemy at long range. And he does not. However, a Bot in rare cases presses the primary fire at long range from the player. The BOT should do it next to the player.
I do not understand why he does it...
It is not critical and playable. But it looks weird. I I've got to say that I can not without the help of a professional to go very deep into the code.

Re: The problem with determining the position of the bot

Posted: Mon Dec 25, 2017 2:21 am
by sektor2111
Can I write something a little changed for a general case ?

Code: Select all

function Timer()
{
	local Bot B;

	ForEach AllActors(class'Bot', B)
	{
		if ( B.Health > 0 && B.Weapon != None
		&& !B.bHidden && B.Enemy == None ) //Only a valid free Bot
		{
			if ( B.Weapon.bMeleeWeapon )
					continue;
			else
			{
				KillAllAliens(B); //must check ammo in here else quit blocking Bot
			}
		}
	}
}