Pocket Plane Group

Miscellany, Inc. => Infinity Engine Modding Q&A => Topic started by: Daniel_rpg on August 14, 2006, 03:58:45 PM

Title: AI scripting Q
Post by: Daniel_rpg 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
Title: Re: AI scripting Q
Post by: cirerrek 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.

Title: Re: AI scripting Q
Post by: Zyraen 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?