Paste #62348: Grappling Hook 3.0

Date: 2019/11/26 09:50:37 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


grappling_hook:
  type: item
  debug: false
  material: tripwire_hook
  display name: <&a><&l><&n>Grappling Hook
  lore:
  - "<&b><&l>Use this to grapple a block"
  - "<&b><&l>and pull yourself to it."

grappling_hook_events:
  type: world
  debug: false
  events:
    on player right clicks with grappling_hook:
      - if <player.has_flag[grappling]>:
        - narrate "<&c>You can only fire one grappling hook at a time."
        - stop
      - shoot arrow speed:3 script:grappling_hook_pull save:hook
      - flag player grappling:true duration:10s
      - repeat 999:
        - if !<entry[hook].shot_entities.get[1].is_spawned> || !<player.has_flag[grappling]>:
          - stop
        - playeffect redstone at:<player.location.points_between[<entry[hook].shot_entities.get[1].location>].distance[0.5]> quantity:5 special_data:1|gray offset:0.1
        - wait 2t

grappling_hook_pull:
 type: task
 debug: false
 script:
   - if <[location].find.blocks.within[2].filter[material.name.is[!=].to[air]].is_empty> || !<player.can_see[<[last_entity]>]>:
     - narrate "<&c>Unable to grapple to this location from here."
     - flag player grappling:!
   - else:
     - push <player> d:<[location]> script:grappling_hook_sanity def:<[location]>

grappling_hook_sanity:
  type: task
  debug: false
  definitions: loc
  script:
    - flag player grappling:!
    - teleport <[loc].with_pitch[<player.location.pitch>].with_yaw[<player.location.yaw>]>