Creatures, Attack Types and Attacks

From PSwiki
Jump to navigation Jump to search

How to assign an existing brain (NPC Type) to a monster:


How to create a new brain (NPC Type) and set specific behaviours:

  • Add new entry in sc_npctypes table
  • Example: RangedIce
  • Parent: OnSightRanged
<behavior name="InitRangedIce" completion_decay="-1" initial="1000" resume="yes" >
<set_buffer buffer="KFactor"           value="1.0" />
<set_buffer buffer="AttackMelee"      value="default" /> 
<set_buffer buffer="AttackRanged"      value="Ice Ranged Attack" /> 
</behavior>
  • it's defining AttackRanged to use a special attack called "Ice Ranged Attack"

How to set the attack range:

  • set melee_range in the npc type (brain) behaviour
    • melee: melee_range="4"
    • ranged: melee_range="10"

Created a new entry in attacks table for "Ice Ranged Attack" where we set:

  • attacks.damage = points to a mathscript (example "Calculate Damage") . This determines the result of the attack, like missed, blocked, hit, and calculates the final damage.
  • attacks.range = maximum range of the attack, usually is set to the weapon range + 1 meter
  • attacks.delay = decides how long it takes to execute an attack.
  • attacks.outcome = progression script , executed ONLY if we got an hit from attacks.damage script. May contain additional damage, and visual/sound effect

If you want the vfx/sound effect to play anyway, even on a miss, then add:

  • NaturalRanged = 1;

in the attacks.damage script. This will be checked by the code and the outcome will be called anyway.


How to set the visual effect:

  • it's inside the progression script : attacks.outcome field