Hey. Im dealing with AI at the moment. I'm not going to post my code, because there are too many arrays/types for it to make much sense on its own, but lets use some pseudo code.
In my AI the enemy detects it's distance from it's target, then decides upon an action. There are 4 posible distancces:
near
medium
far
distant
So in my code at the moment it says something like
FOR enemy=firstenemy to lastenemy
getdistancetotaget(enemy,target)
if distance=near
*do some stuff*
endif
if distance=medium
*do some stuff*
endif
if distance=far
*do some stuff*
endif
if distance=distant
*do some stuff*
endif
next enemy
That's all well and good, but really those 4 "ifs" are mutually exclusive. If the target is "medium" there's no need to run the other "ifs".
I did some sniffing around on how to create mutually exclusive events and Hands On DBpro said I should type it like this:
FOR enemy=firstenemy to lastenemy
getdistancetotaget(enemy,target)
if
distance=near:
*do some stuff*
distance=medium:
*do some stuff*
endif
distance=far:
*do some stuff*
distance=distant:
*do some stuff*
endif.
But that doesn't appear to work for me. I get:
Error : If condition only takes 1 parameter at line whatever.
So I'm asking for some help! How can I type this so it works?!?!