Fighter

Type: NPC Brain
Level: not in gallery
Pages: 9
Description: Found in the Enemy – Bandit Fighter brain. A complex 8 page enemy brain. The enemy will wander up and down or turn around and do their idle animations when not engaged to an enemy. When any is in range it will advance. When attacking he first puts up a blocking shield. He will move around the player before attacking again. His attack is an upper cut with a fist with a sparking special effect. He has a health bar that appears above his head when health is changed.

Parts of this kode cannot be viewed as it uses saved brains that are not part of the gallery and are therefore inaccessible. I cannot therefore write out the full kode for these characters.

page 1 @Wander

  1. WHEN [once]
  2. …WHEN DO [textvar:name][equals][text:Bandit Fighter]
  3. …WHEN DO [team][equals][team 2]
  4. …WHEN DO [call page] [page:@Init]
  5. WHEN [boolvar:alerted] DO [switch page][page:@Pursue]
    Detect enemy
  6. WHEN [detect][enemies][nearest object]
  7. …WHEN [it][attackable][and][it][visible] DO [boolvar:alerted][equals][true]
  8. …/…WHEN DO [objvar:target][equals][it]
  9. WHEN [else][see][enemies][nearest object][or][see][player][neutrals][nearest object] DO [boolvar:alerted][equals][true]
  10. …WHEN DO [objvar:target][equals][it]
  11. …WHEN DO [else][health][changed]
  12. …/….WHEN DO [objvar:target][equals][it]
  13. …/…WHEN DO [boolvar:alerted][equals][true]
    Alerted to an enemy
  14. WHEN DO [boolvar:alerted]
  15. …WHEN [for each of][detect][allies] DO
  16. …/…WHEN DO [it][boolvar:alerted][equals][true]
  17. …/…WHEN DO [it][objvar:target][equals][objvar:target]
  18. …WHEN DO [switch page][page:@Pursue]
    Wander when not engaged
  19. WHEN [countdown timer][numvar:wander time][loop][trigger on start]
  20. …WHEN [distance to][vectorvar:Spawn position][greater than][Max Wander distance] DO [vectorvar:Wander Direction][equals][vectorvar:Spawn position][minus][position]
  21. …/…WHEN [else][distance to][allies][nearest object][less than][numvar:Spread DIstance]
  22. …/…./….WHEN DO [objvar:Near object][equals][allies][nearest object]
  23. …/…./…/…WHEN DO [vectorvar:Wander Direction][equals][position][minus][objvar:Near object][position]
  24. …/…/….WHEN [else] DO [vectorvar:Wander direction][equals][random vector]
  25. WHEN DO [move][in direction][vectorvar:Wander Direction][at speed][numvar Wander Move Speed]

page 2 @Pursue

  1. WHEN [once]
  2. …WHEN DO [numvar:repel ally distance][equals][2.5][plus][random number][0.25][to][-0.25]
  3. …WHEN DO [numvar:combat range][equals][1][plus][random number][0.25][to][0.5]
  4. WHEN DO [call page][@Targeting]
  5. WHEN [numvar: Target distance][less than][combat range] DO [switch page][page:@Orbit]
  6. WHEN [countdown timer][1][and][(][numvar:target distance][greater than][numvar:combat range][)]
  7. …WHEN DO [ground acceleration][equals][5]
  8. …WHEN DO [numvar:walk or run][equals][1.75]
  9. …WHEN [else]
  10. …/… WHEN DO [ground acceleration][equals][3.5]
  11. …/…WHEN DO [numvar:walk or run][equals][0.75]
  12. WHEN DO [move][toward][objvartarget][at speed][numvar:walk or run]
  13. WHEN [detect][allies]
  14. …WHEN [distance to][it][less than][numvar:repel ally distance]
  15. …/….WHEN DO [move][away from][it][with strafing][at speed][0.75

page 3 @Orbit

  1. WHEN [once] DO
  2. …WHEN DO [numvar:enemy repel range][equals][0.5]
  3. …WHEN DO [numvar:target out of range][equals][7][plus][random number][1][to][-1][as integer]
  4. WHEN [page entered] DO [boolvar:moving left][equals][random number][less than][0.5]
  5. WHEN DO [call page][page:@Targeting]
  6. WHEN [not][equipment] DO [equip][objvar:my weapon]
  7. WHEN [numvar:target distance][greater than or equal to][numvar:target out of range] DO [switch page][page@Pursue]
  8. WHEN [numvar:target distance][less than][numvar:combat range] DO [switch page][page@Signaling]
  9. WHEN [numvar:target distance][less than or equal to][numvar:enemy repel range] DO [switch page][@Back off]
  10. WHEN [numvar:target distance][greater than ][numvar:combat range] DO [move][toward][objvar:target]
  11. WHEN [countdown timer][random number][5][to][7][as integer][loop] DO [toggle][boolvar:moving left]
  12. WHEN [boolvar:moving left] DO [vectorvar:Strafing Direction][equals][left]
  13. …WHEN [else] DO [vectorvar:Strafing Direction][equals][right]
  14. .
  15. …WHEN DO [vectorvar:toward player][equals][(][objvar:target][center][minus][center][)][normal]
  16. …WHEN DO [numvar:Move Speed][equals][(][numvar:Target out of range][minus][(][distance to][target][)][)][divided by][numvar:Target out of range][minus][numvar:combat range]
  17. …WHEN DO [vectorvar:Final Move][equals][vectorvar:Strafing Direction][plus][(][vectorvar:toward player][minus][vectorvar:Strafing Direction][)][multiplied][numvar:Move Speed]
  18. …WHEN DO [move][in direction][vectorvar:Final Move][at speed][0.5][with strafing]
  19. .
  20. WHEN [countdown timer][3][in frames][loop][trigger on start]
  21. …WHEN [detect][allies]
  22. …/…WHEN [distance to][it][less than][numvar: Friend Repel Range]
  23. …/…/…WHEN DO [move][away from][it][with strafing][at speed][ 0.75]

page 4 @Close In

  1. WHEN [once] DO [numvar:attack range][equals][2]
  2. WHEN DO [call page][page:@Targeting]
  3. WHEN [numvar:target distance][less than or equal to][numvar:attack range] DO [switch page][page:@Attack]
  4. …WHEN [else] Do [move][toward][target]
  5. WHEN [countdown timer][3] DO [switch page][page:@Orbit]

page 5 @Back Off

  1. WHEN DO [call page][page:@Targeting]
  2. WHEN DO [move][away from][target][at speed][0.5][with strafing]
  3. WHEN [numvar:target distance][greater than or equal to][numvar:combat range] DO [switch page][@Orbit]
  4. WHEN [countdown timer][1.5]
  5. …WHEN DO [boolvar:attacked recently][equals][false]
  6. …WHEN DO [switch page][page:@Attack]

page 6 @Attack

  1. WHEN [once]
  2. …WHEN DO [numvar:accuracy][equals][(][1][plus][numvar:accuracy multiplier][)][multiplied by][0.5]
  3. …WHEN DO [numvar:damage][equals][heavy damage][plus][heavy damage][multiplied by][numvar:damage multiplier]
  4. …WHEN DO [numvar:attack speed][equals][numvar:base speed][plus][numvar:base speed][multiplied by][numvar:attack speed multiplier]
  5. …/…WHEN [numvar:attack speed][greater than][2] DO [numvar:attack speed][equals][2]
  6. WHEN DO [unequip][to inventory]
  7. WHEN DO [attack][heavy][unblockable][objvar:target][with windup][end combo][with damage][numvar:damage]
  8. …WHEN [duration timer][1][in frames] DO [objvar:telegraph signal][equals][create][unavailable: Attack Telegraph Signal][at position][above] // this line contains a tile for a prop that does not exist in the gallery – however it still works and puts an exclamation mark above the characters head
  9. WHEN [duration timer][numvar:accuracy] DO [turn][toward][target]
  10. WHEN [started to][attacking][windup]
  11. …WHEN DO [pace][equals][numvar:attack speed][multiplied by][0.75]
  12. WHEN [started to][attacking][swing]
  13. …WHEN DO [pace][equals][numvar:attack speed]
  14. WHEN [no longer][attacking]
  15. …WHEN DO [boolvar:attacked recently][equals][true]
  16. ..
  17. …/…WHEN DO [invulnerable][equals][false]
  18. …/…WHEN DO [light hit reaction][equals][true]
  19. …/…WHEN DO [equals][true]
  20. …/…WHEN DO [heavy hit reaction][equals][true]
  21. …/…WHEN DO [damage hit reaction][equals][true]
  22. ..
  23. …WHEN DO [pace][equals][numvar:base speed]
  24. …WHEN DO [me][numvar:eagerness][equals][0]
  25. …WHEN DO [switch page][page:@Back Off]
  26. ..
  27. WHEN [started to] DO [play fx][fx:invincible start][at position][position]
  28. WHEN [countdown timer][0.6] DO [play fx][fx:Invincible Loop][at position][position]
  29. ..
  30. …WHEN [hit by attack] DO [boolvar:armor hit][equals][true]
  31. WHEN [boolvar:armor hit]
  32. …WHEN [countdown timer][8][in frames]
  33. …/…WHEN DO [boolvar:armor hit][equals][false]
  34. …WHEN [ignore line] DO [display][icon:Shield icon 01][at world position][center][scale][2] // this line does nothing . However if you want a shield to appear on the character if you hit him when his shield is up then change it to:
    …WHEN DO [display][Shield icon 01][scale][2][at world position][head][position]
  35. …WHEN [duration timer] DO [hologram][custom grey]
  36. WHEN [attacking]
  37. …WHEN DO [play fx][at socket][right hand][fx:Energy Blaze]
  38. …/…WHEN DO [invulnerable][equals][true]
  39. …/…WHEN DO [light hit reaction][equals][false]
  40. …/…WHEN DO [equals][false]
  41. …/…WHEN DO [heavy hit reaction][equals][false]
  42. …/…WHEN DO [damage hit reaction][equals][false]
  43. WHEN [attack hit] DO [play fx][at socket][right hand][fx:Spark emitter]

page 7 @Signaling

  1. WHEN DO [boolvar:highest eagerness][equals][true]
  2. WHEN [for each of][objvar:target][enemies][objects closer than][10][from][objvar:target]
  3. …WHEN [it][numvar:eagerness][greater than][me][numvar:eagerness]
  4. …/…WHEN DO [boolvar:highest eagerness][equals][false]
  5. WHEN [boolvar:highest eagerness]
  6. …WHEN [not][boolvar:attacked recently] DO [switch page][@Close In]

page 8 @Targeting

  1. WHEN [objvar:target][is dead] DO [emote][Taunt]
  2. …WHEN DO [boolvar:alerted][equals][false]
  3. …WHEN DO [switch page][page:@Wander]
  4. WHEN [countdown timer][loop][trigger on start]
  5. …WHEN [enemies][nearest object][or][player][neutrals][nearest object] DO [objvar:target][equals][it]
  6. WHEN [countdown timer][0.3][loop][trigger on start] DO [numvar:target distance][equals][distance to][objvar:target]
  7. WHEN DO [turn][toward][objvar:target]
  8. WHEN DO [numvar:eagerness][increment by][numvar:eagerness amount]
  9. WHEN [hit by attack] DO [numvar:eagerness][increment by][numvar:eagerness amount][multiplied by][2]
  10. …WHEN DO [numvar:Attack Cooldown][decrement by][2]
  11. WHEN [boolvar:attacked recently]
  12. …WHEN [started to][countdown timer][numvar:attack cooldown]
  13. …/…WHEN DO [boolvar:attacked recently][equals][false]

 

page 9 @Init

  1. WHEN [once] DO [ground acceleration][equals][10]
  2. WHEN [once]
  3. …WHEN DO [add brain][Temporary Health]
  4. …WHEN DO [add brain][Enemy Objectives][to slot][@Enemy Objectives Brain][to channel][Enemy Objectives Channel]
  5. …WHEN DO [add brain][Enemy Lights Brain][to slot][@Lights Brain][to channel][@Lights Channel]
  6. …WHEN DO [vectorvar:Spawn Position][equals][position]
  7. WHEN [once]
  8. …WHEN DO [health][equals][max health]
  9. …WHEN DO [objvar:my weapon][equals][create][fighters sword]
  10. …WHEN DO [equip][objvar:my weapon]
  11. …WHEN DO [onjvar:my weapon][visible][equals][false]
  12. …WHEN DO [numvar:base speed][equals][1]
  13. …WHEN DO [numvar:eagerness][equals][random number][1][to][100]
  14. …WHEN DO [numvar:eagerness amount][equals][random number][1][to][2.5]
  15. …WHEN DO [numvar:attack cooldown][equals][random number][1][to][2.5]
  16. …WHEN DO [numvar:target distance][equals][0]
  17. …WHEN DO [boolvar:alerted][equals][false]
  18. …WHEN DO [scale][equals][1.25]
  19. …WHEN DO [hit reaction recovery][equals][0.75]
  20. …WHEN DO [ranged hit reaction][equals][0]
  21. WHEN [once]
  22. …WHEN DO [numvar:Max Wander Distance][equals][2.5]
  23. …WHEN DO [numvar:Wander Move Speed][equals][0.4]
  24. …WHEN DO [numvar:Wander Turn Speed][equals][8]
  25. …WHEN DO [ground turn speed][equals][numvar:Wander Turn Speed]
  26. ..WHEN DO [numvar: Wander Timer][equals][3][plus][random number][-1][to][1]
  27. WHEN [once]
  28. …WHEN DO [numvar:min health bonus][equals][negative][0.25]
  29. …WHEN DO [numvar:max health][equals][1]
  30. …WHEN DO [numvar:min accuracy bonus][equals][negative][0.25]
  31. …WHEN DO [numvar:max accuracy bonus][equals][0.5]
  32. …WHEN DO [numvar:min damage bonus][equals][negative][0.5]
  33. …WHEN DO [numvar:max damage bonus][equals][0.75]
  34. …WHEN DO [numvar:min attack speed bonus][equals][negative][0.25]
  35. …WHEN DO [max attack speed bonus][equals][0.5]
  36. WHEN [once]
  37. …WHEN DO [numvar: health multiplier][equals][clamp][global][numvar:Difficulty][max][numvar:max health bonus][min][numvar:min health bonus]
  38. …WHEN DO [numvar: accuracymultiplier][equals][clamp][global][numvar:Difficulty][max][numvar:max accuracy bonus][min][numvar:min accuracy bonus]
  39. [numvar: damage multiplier][equals][clamp][global][numvar:Difficulty][max][numvar:max damage bonus][min][numvar:min damage bonus]
  40. [numvar: attack speed multiplier][equals][clamp][global][numvar:Difficulty][max][numvar:max attack speed bonus][min][numvar:min attack speed bonus]
  41. WHEN [once]
  42. …WHEN DO [max health][equals][max health][plus][max health][multiplied by][numvar:health  ultiplier]
  43. …WHEN DO [health][equals][max health]

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: