Paste #6210: Fancy full arrow script

Date: 2014/07/03 15:00:33 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


firework_arrow:
    type: item
    material: arrow
    display name: Firework Arrow
    lore:
    - <&a>Fire this arrow
    - <&b>for magic funtime
    - <&d>surprise!
    - <&c>(Requires BPG Launcher)
    recipe:
    - i@arrow|i@tnt|i@tnt
    - i@firework|i@air|i@air
    - i@air|i@air|i@air

sharp_arrow:
    type: item
    material: arrow
    display name: Sharpened Arrow
    lore:
    - <&c>This arrow is
    - <&c>extra sharp!
    recipe:
    - i@arrow|i@arrow|i@arrow
    - i@air|i@air|i@air
    - i@air|i@air|i@air

shotblast_arrow:
    type: item
    material: arrow
    display name: Bundle Of Arrow
    lore:
    - <&c>Launches 3 arrows
    - <&c>all at once!
    recipe:
    - i@arrow|i@arrow|i@arrow
    - i@string|i@string|i@string
    - i@air|i@air|i@air

fast_arrow:
    type: item
    material: arrow
    display name: Faster Arrow
    lore:
    - <&c>This arrow moves
    - <&c>extra fast!
    recipe:
    - i@arrow|i@arrow|i@redstone
    - i@air|i@air|i@air
    - i@air|i@air|i@air

weak_arrow:
    type: item
    material: arrow
    display name: Weakened Arrow
    lore:
    - <&c>This arrow is
    - <&c>damaged.

bpg_bow:
    type: item
    material: bow
    display name: BPG Launcher
    lore:
    - <&c>Bow Propelled Grenade
    - <&c>Launcher.
    - <&c>(Requires BPG Arrows)

weak_bpg_arrow:
    type: item
    material: arrow
    display name: Weak BPG Arrow
    lore:
    - <&c>This arrow explodes
    - <&c>weakly on impact.
    - <&c>(Requires BPG Launcher)
    recipe:
    - i@arrow|i@tnt|i@air
    - i@air|i@air|i@air
    - i@air|i@air|i@air

strong_bpg_arrow:
    type: item
    material: arrow
    display name: Strong BPG Arrow
    lore:
    - <&c>This arrow explodes
    - <&c>strongly on impact.
    - <&c>(Requires BPG Launcher)
    recipe:
    - i@arrow|i@tnt|i@tnt
    - i@air|i@air|i@air
    - i@air|i@air|i@air

superior_bpg_arrow:
    type: item
    material: arrow
    display name: Superior BPG Arrow
    lore:
    - <&c>This arrow explodes for
    - <&c>massive damage on impact.
    - <&c>(Requires BPG Launcher)

firework_arrow_determine_type:
    type: task
    script:
    - if <entry[myitem].result> == i@firework_arrow {
      - flag player arrowtype:firework
      }
      else if <entry[myitem].result> == i@weak_bpg_arrow {
      - flag player arrowtype:weak_bpg
      }
      else if <entry[myitem].result> == i@strong_bpg_arrow {
      - flag player arrowtype:strong_bpg
      }
      else if <entry[myitem].result> == i@superior_bpg_arrow {
      - flag player arrowtype:superior_bpg
      }
      else {
      - narrate "<&c>You've loaded the wrong arrow type. Must load an explosive round!"
      - determine cancelled
      }

firework_arrow_world:
    type: world
    debug: false
    events:
        on player shoots bow:
        - define item <player.inventory.slot[<player.inventory.find.material[arrow]>]>
        - adjust %item% quantity:1 save:myitem
        - if <context.bow> == i@bpg_bow {
          - inject firework_arrow_determine_type
          }
        - if <entry[myitem].result> == i@sharp_arrow {
          - flag player arrowtype:sharp
          }
          else if <entry[myitem].result> == i@weak_arrow {
          - flag player arrowtype:damaged
          }
          else if <entry[myitem].result> == i@fast_arrow {
          - flag player arrowtype:!
          - shoot arrow[critical=true] o:<player> speed:<context.force.mul[1.5]>
          - take <entry[myitem].result> qty:1
          - playsound sound:shoot_arrow <player.location>
          - determine cancelled
          }
          else if <entry[myitem].result> == i@shotblast_arrow {
          - flag player arrowtype:!
          - shoot arrow|arrow|arrow o:<player> speed:<context.force> spread:20
          - take <entry[myitem].result> qty:1
          - playsound sound:shoot_arrow <player.location>
          - determine cancelled
          }
        on projectile hits block:
        - if <context.shooter> matches player {
          - run firework_arrow_handler_internal def:<context.projectile.location> as:<context.shooter>
          - flag <context.shooter> arrowtype:!
          }
        - flag player arrowtype:!
        on arrow damages entity:
        - if <context.damager> matches player {
          - if <context.damager.as_player.flag[arrowtype]> == sharp determine <context.damage.mul[2]>
          - if <context.damager.as_player.flag[arrowtype]> == damaged determine <context.damage.div[1.5]>
          - run firework_arrow_handler_internal def:<context.entity.location> as:<context.damager>
           - flag <context.damager> arrowtype:!
          }

firework_arrow_handler_internal:
    type: task
    speed: 2t
    script:
    - ^if <player.flag[arrowtype]> == firework {
      - define t1 <li@ball|creeper.random>,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>
      - explode %1% power:2
      - spawn %1% firework[firework_item=i@firework[firework=true,false,%t1%,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>|0];velocity=0,0,0,<def[1].world.name>]
      - spawn %1% firework[firework_item=i@firework[firework=true,false,%t1%,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>,<util.random.int[1].to[255]>|0];velocity=0,0,0,<def[1].world.name>] save:myfirework
      - wait 5t
      - adjust <entry[myfirework].spawned_entities> detonate
      }
      else if <player.flag[arrowtype]> == weak_bpg {
      - explode %1% power:1
      }
      else if <player.flag[arrowtype]> == strong_bpg {
      - explode %1% power:2
      }
      else if <player.flag[arrowtype]> == superior_bpg {
      - explode %1% power:2 fire breakblocks
      }