Posted 07 August 2000 - 03:37 PM
I wrote a simple AI that I hoped would prevent someone from throwing the mystic spear. Everything seems to work, except for the RunToward() statement. When the character gets to that command he just starts running away from the enemies. He just keeps running, and running, and running...
If you can help with this, or if you can provide an AI that causes a person to use the Spear as a melee weapon only, it would be greatly appreciated. Here is the code I have:
NAME "No Throw"
; Attack the attacker if he's close enough.
IF Exists(myself.LastAttacker) THEN
IF InRange(myself.LastAttacker,2) THEN
#100 SetTarget(myself.LastAttacker)
DoAttack()
; Or attack any enemy who is close enough.
IF Exists(enemy.ByRange.Pick) THEN
IF InRange(enemy.ByRange.Pick,2) THEN
#100 SetTarget(enemy.ByRange.Pick)
DoAttack()
; At this point, there may be enemies, but they are far away. Walk to them.
IF Exists(enemy.ByRange.Pick) THEN
#100 SetTarget(enemy.ByRange.Pick)
RunToward(enemy.ByRange.Pick, 2)
DoAttack()
; No enemies exist at this point.
IF True() THEN
#100 FinishCombat()