The problem with determining the position of the bot

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

The problem with determining the position of the bot

Post 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?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: The problem with determining the position of the bot

Post 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.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: The problem with determining the position of the bot

Post by Barbie »

Maybe you should explain more detailed what you want to achieve...
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: The problem with determining the position of the bot

Post 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.
So long, and thanks for all the fish
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: The problem with determining the position of the bot

Post 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: .
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: The problem with determining the position of the bot

Post by papercoffee »

Hey ...maybe it's a new long range Impact Hammer? :ironic:
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: The problem with determining the position of the bot

Post 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.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: The problem with determining the position of the bot

Post 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
			}
		}
	}
}
Post Reply