Author Topic: AI scripting Q  (Read 890 times)

Offline Daniel_rpg

  • Planewalker
  • *****
  • Posts: 5
AI scripting Q
« on: August 14, 2006, 03:58:45 PM »
For the 'arang' script, I would like to keep characters from running so far away before using missile weapons.  So which variable do I change to shorten their movement distance?

Quote
// * Date Created: Mar 21, 2000.
// * Brent Knowles
// * A ranged weapon script.  Attempts to stay out of melee ranged with opponents,
// * Although will switch to melee weapons if needed.


//*combat*
IF
   ActionListEmpty()
   AttackedBy([ANYONE],DEFAULT)
   Range(LastAttackerOf(Myself),4)
THEN
   RESPONSE #100
      EquipMostDamagingMelee()
      AttackReevaluate(LastAttackerOf(Myself),30)
END

IF
   ActionListEmpty()
   See(NearestEnemyOf(Myself))
   !Range(NearestEnemyOf(Myself),4)
   Range(NearestEnemyOf(Myself),10)
THEN
   RESPONSE #100
      RunAwayFrom(NearestEnemyOf(Myself),25)
END

IF
   ActionListEmpty()
   See(NearestEnemyOf(Myself))
   !Range(NearestEnemyOf(Myself),10)
THEN
   RESPONSE #100
      EquipRanged()
      AttackReevaluate(NearestEnemyOf(Myself),20)
END

IF
   ActionListEmpty()
   See(NearestEnemyOf(Myself))
   Range(NearestEnemyOf(Myself),4)
THEN
   RESPONSE #100
      EquipMostDamagingMelee()
      AttackReevaluate(NearestEnemyOf(Myself),30)
END

IF
   ActionListEmpty()
   See(NearestEnemyOf(Myself))
   !Range(NearestEnemyOf(Myself),4)
THEN
   RESPONSE #100
      EquipRanged()
      EquipMostDamagingMelee()
      AttackReevaluate(NearestEnemyOf(Myself),30)
END

Offline cirerrek

  • Planewalker
  • *****
  • Posts: 92
Re: AI scripting Q
« Reply #1 on: August 14, 2006, 09:34:05 PM »
Daniel_rpg

Code: [Select]
IF
   ActionListEmpty()
   See(NearestEnemyOf(Myself))
   !Range(NearestEnemyOf(Myself),4)
   Range(NearestEnemyOf(Myself),10)
THEN
   RESPONSE #100
      RunAwayFrom(NearestEnemyOf(Myself),25)
END

You will want to shorten the Action RunAwayFrom(NearestEnemyOf(Myself),25)

Description of the action from IEDSP

29 RunAwayFrom(O:Creature*,I:Time*)
Is a very nice command to use to escape your enemies when your hitpoints get low, provided there is somewhere to run to. The Time parameter is measured in AI updates. Since, by default, there are 15 AI updates per second, it is usually a rule of thumb to use multiples of 15, such as 90, 120, or 180.


Offline Zyraen

  • Planewalker
  • *****
  • Posts: 279
Re: AI scripting Q
« Reply #2 on: September 18, 2006, 11:38:29 AM »
Erm is this related to Zy's Misc Mods?

I might shift this to another forum (if I can, as mentioned also)

All ok?
(http://www.geocities.com/arkevaul/btlbn2.gif)
SoA Release - Love between a Law Enforcer and a Fugitive - can such a thing even happen?

Zyraen's Miscellaneous Mods - Ust Natha Accelerator, item tweaks, & more

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: