Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple things.
#11
(target.state != 12 || target.state != 18)
what it checks: my target's state is not 12, OR, my target's state is not 18.

if my target's state is 12, then it is true that my target's state is not 18. therefore my condition is true.
if my target's state is 18, then it is true that my target's state is not 12. therefore my condition is true.
if my target's state is 9001, then it is true that my target's state is not 12. therefore my condition is true.

(target.state != 12 || target.state != 18) is not equivalent to (target.state !=12 && target.state != 18)



Azriel~
Reply
Thanks given by:
#12
(08-16-2013, 12:58 PM)Gad Wrote:  
(08-15-2013, 01:31 PM)Blue Phoenix Wrote:  The third condition will always yield true.
doesn't
Code:
target.state !=(12 || 18)
equals
Code:
target.state !=12 && target.state != 18
?
I maybe thinking wrong though.
Well, can you phrase in words how you want it to be?
In case you're thinking of something along the lines of "target.state may be neither 12 nor 18", the above snippet is correct. Guess you managed to confuse me completely in my last post :p

(08-16-2013, 12:58 PM)Gad Wrote:  
(08-15-2013, 01:31 PM)Blue Phoenix Wrote:  Just to rule out anything, do you call "get_closest_enemy()" in your AI? Also, have you tried to print out the target-index + its xdistance?

Cmon, BP. I'm not THAT stupid.
I've been programming for months at least.
I know how to test the program ;P.
I printed the result of getting closest enemies.
Heh, I just wanted to be on the safe side :p

Have you tried to print out object-id AND xdistance to see if it changes at all?
Maybe even print out all t0-objects currently in-game and check manually if it picked the right one?


az u so ninja-y
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by:
#13
I was thinkin in other way.

target.state !=( 12 || 18)

Is target other than (12 or 18)?

9001
if target state!=(12x or 18x )
alternative(12x or 18x )= 0
!0 = 1
ANSWER: YES!

18
if target state!=(12x or 18v )
alternative(12x or 18v ) = 1
!1 = 0
ANSWER: NO

12
if target state!=(12v or 18x )
alternative(12v or 18x ) = 1
!1 = 0
ANSWER: NO

I'm really confused now, if this should work.
xDD I'm probably wrong, but this seems reasonable for me.

Let's stick with:
target.state !=12 && target.state != 18
I thought I can write it shorter.


You will probably come in with a solution to my problem anyway, to show me how wrong I am.
(08-16-2013, 01:11 PM)Azriel Wrote:  (target.state != 12 || target.state != 18)
what it checks: my target's state is not 12, OR, my target's state is not 18.
But is (target.state != 12 || target.state != 18) equavilent to (target.state != (12 || 18))?


EDIT:
ANOTHER QUESTION
Just theoretical, cause I'm not willing to test it right now.
Can I ask the AI to ignore weapons in that way:
- Check target, if target is a weapon, then select other target
Won't it be buggy?
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)