ai_action - ryzom/ryzomcore GitHub Wiki


title: Creating new AI Actions description: published: true date: 2023-03-01T05:15:18.141Z tags: editor: markdown dateCreated: 2021-07-02T02:08:12.438Z

AI actions can be found under leveldesign/game_elem/creature/.../aiaction.

A script to generate a generic set of actions is available under code/ryzom/tools/extract_r2_required/generate_aiaction.py.

Combat

  • DamageFactor: Damage factor addition, further modified in damage calculation by skill and weapon
  • DamageModifier: Fixed additional damage added on top of weapon and skill factored action
  • ArmorFactor: ?

Total Damage Calculation

Total Creature Damage = (100 * creature.PlayerHpLevel / creature.NbHitToKillPlayer) / (1.0 - _AverageDodgeFactor) * EGS BotDamageFactor

Value _AverageDodgeFactor is applied optionally depending on EGS ApplyAverageDodgeFactor flag.

Phrase DamageFactor (from AI Action for NPC) = (aiaction.DamageFactor + 1.0) * AI bot DamageCoef

Total Player Melee Damage = (EGS MinDamage + (EGS DamageStep * min(skill.Level, weapon.Quality))) * lerp(EGS WeaponDmg, EGS WeaponDmgMax, weapon.Damage) * phrase.DamageFactor

The EGS ExponentialPower configuration value should always be 1, since spell attack level for NPCs does not have an exponential power configuration modifier. Otherwise it cannot be balanced. Hence, it's not listed in this document's calculation.

Creature

Melee

Range

Magic

  • CastingTime: Time to cast the spell (if -1, use the creature's AttackSpeed)
  • PostActionTime: Time to wait before doing the next action
  • SapCost: Sap used in casting
  • HpCost: HP used in casting
  • Behaviour: The casting animation to use, this should usually match the damage type

Damage

  • Type: DamageSpell
  • DamageValue: The base amount of damage that the spell will do, part of the total damage
  • SpellPowerFactor: Multiplied with the AttackLevel of the creature, and added to the total damage
  • DamageType: The type of magic damage (acid, cold, etc.)
  • DamageScore: Target score to which damage is done (HP, sap, etc.)

DoT

  • Stackable: Whether multiple spell effects can be stacked, or the spell gets canceled when a new one is cast

Total Damage Calculation

Total Magic Damage = DamageValue + (SpellPowerFactor * creature.AttackLevel)

⚠️ **GitHub.com Fallback** ⚠️