Can someone explain me this?

M4L4
Algorithm
Algorithm
Posts: 50

Can someone explain me this?

Post#1 » 20 Nov 2018, 22:27

https://imgur.com/a/EQTNmKo

Sorry for not beeing able to enbed the pictures, but I'm on a new phone.

The condition clearly state:

if enemy carrying resource in short or middle range from me, AND not at short or middle range from closest enemy exists
>> Move toward closest enemy carrying resource
>> bla bla bla

As you can see from the pictures, the enemy carrying resource is way closer than middle range from closer enemy, so why is my SG moving toward it?

User avatar
Hairy Phil
Automaton
Automaton
Posts: 153
Contact:

Re: Can someone explain me this?

Post#2 » 20 Nov 2018, 22:50

Because for the "distance from closest enemy" you've used OR but should have used AND.

M4L4
Algorithm
Algorithm
Posts: 50

Re: Can someone explain me this?

Post#3 » 20 Nov 2018, 23:34

But the condition is actually set to AND

https://imgur.com/a/Q8fnmMC

The enemy shoud be carrying resources
AND
at short OR middle range from me,
AND
NOT at short OR middle range from closest enemies

mcompany
Autonomous Entity
Autonomous Entity
Posts: 872

Re: Can someone explain me this?

Post#4 » 21 Nov 2018, 02:53

Image

If you want how to do it, it's [img]https://i.imgur.com/xvzTCP5.png[img] (add the '/' in the ending tag)

User avatar
Hairy Phil
Automaton
Automaton
Posts: 153
Contact:

Re: Can someone explain me this?

Post#5 » 21 Nov 2018, 08:21

M4L4 wrote:NOT at short OR middle range from closest enemies


You need to change this OR to an AND.

M4L4
Algorithm
Algorithm
Posts: 50

Re: Can someone explain me this?

Post#6 » 21 Nov 2018, 10:08

Hairy Phil wrote:
M4L4 wrote:NOT at short OR middle range from closest enemies


You need to change this OR to an AND.


Ok, now i see the syntax problem, thank you very much :)

Jeffrey Harpen
Automaton
Automaton
Posts: 122

Re: Can someone explain me this?

Post#7 » 22 Nov 2018, 17:25

M4L4 wrote:NOT at short OR middle range from closest enemies

Actually it should be read as:
NOT at short range from closest enemy OR NOT at medium range from closest enemy
which is always true.

M4L4
Algorithm
Algorithm
Posts: 50

Re: Can someone explain me this?

Post#8 » 22 Nov 2018, 17:57

Jeffrey Harpen wrote:
M4L4 wrote:NOT at short OR middle range from closest enemies

Actually it should be read as:
NOT at short range from closest enemy OR NOT at medium range from closest enemy
which is always true.


yes, i've found other similar errors in my ai, i should pay more attention with negating multiple conditions

Return to “Questions”

Who is online

Users browsing this forum: No registered users and 0 guests