Throw and Teleport

Type: Additional skill
Level: 3 star
Pages: 1
Description: Allows the player to throw a weapon at an enemy and then teleport to where the weapon lands.

This is not a standalone brain and will need to be called using add brain

eg.
WHEN [Right trigger][pressed] DO [add brain][brain: Throw and Teleport]

Kode

Shoots the equipment forwards when activated (in our example on a right trigger)

  1. WHEN [started to] DO [objvar:my weapon][equals][equipment]
  2. …WHEN DO [boolvar:end throw][equals][false]
  3. …WHEN [objvar:my enemy][equal to][nothing] DO [shoot][objvar:my weapon][in direction][forward][with damage][0][at speed][15][bounce on impact][disallow friendly fire]
  4. …WHEN [else] DO [shoot][objvar:my weapon][at][objvar:my enemy][with damage][0][at speed][15][bounce on impact][disallow friendly fire]

    When the weapon is thrown

  5. WHEN [objvar:my weapon][is projectile]
  6. …WHEN DO [objvar:my weapon][collidable][equals][false]
  7. …WHEN DO [boolvar:weapon thrown][equals][true]
  8. …WHEN [enemies][objects closer than][(][objvar:my weapon][height][multiplied by][2.5][)][from][objvar: my weapon] DO [damage][them][heavy damage][cooldown][1]
  9. …/…WHEN [boolvar:end throw][equals][true]
  10. …WHEN [raycast hit][(][all visible objects][minus][me][minus][objvar: my weapon][minus][attachments][minus][equipment][minus][enemies][minus][allies][)][from][objvar:my weapon][direction][objvar:my weapon][up][length][objvar: my weapon][height][multiplied by][1.35][draw]
  11. …/…WHEN DO [boolvar:end throw][equals][true]
  12. …WHEN DO [objvar:my weapon][up][equals][objvar: my weapon][velocity]
  13. …WHEN DO [objvar: my weapon][yaw][40]
  14. …WHEN DO[play fx][fx:Energy projectile][at position][objvar:my weapon]
  15. …WHEN DO [objvar:my weapon][collidable][equals][true]
  16. …WHEN [countdown timer][1.5] DO [boolvar:end throw][equals][true]

    Teleport mechanism

  17. WHEN [boolvar: end throw] DO [play fx][fx: Death impact][at position][center][scale][1.2][overlapping]
  18. …WHEN DO [play sound][sound:Magic Teleport][overlapping]
  19. …WHEN DO [play fx][fx: Death impact][at position][objvar:my weapon][center][scale][1.2][overlapping]
  20. …WHEN DO [play sound][sound:Magic Teleport][overlapping]
  21. …WHEN DO [objvar:my weapon][collidable][equals][false]
  22. …WHEN DO [objvar:my weapon][velocity[equals][zero]
  23. …WHEN DO [position][equals][objvar:my weapon][position]
  24. …WHEN DO [velocity][equals][zero]

    Weapon returned to hand

  25. WHEN [countdown timer][1][in frames]
  26. …WHEN DO [equip][objvar:my weapon]
  27. …WHEN DO [objvar:myweapon][collidable][equals][true]
  28. …WHEN DO [boolvar:end throw][equals][false]
  29. WHEN [no longer][boolvar:end throw] DO [remove brain][this brain]

Alterations

Add a cooldown period

In player brain
WHEN [numvar:cooldown][less than or equal to][0] DO [numvar:cooldown][equals][0]
…WHEN [right trigger][pressed] DO [add brain][IWP:throw and teleport brain]
…WHEN [else]
…/…WHEN [countdown timer][loop] DO [numvar:cooldown][decrement by][1]

In a template copy of Throw and Teleport brain

29. WHEN [no longer][boolvar: end throw]
30. …WHEN DO [numvar:cooldown][equals][10] // change this number for length of time of cooldown
31. …WHEN DO [remove brain][this brain]

Have the throw but not the teleport

Simply remove line 23.

 

 

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: