Paste #18705: New one

Date: 2015/07/26 19:31:07 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


rpg_arrow:
    type: item
    debug: false
    material: arrow
    display name: RPG Ammo
    lore:
    - <&a>Fire this
    - <&b>If you like explosions
    - <&c>(Requires RPG Launcher)
    recipe:
    - i@arrow|i@tnt|i@tnt
    - i@air|i@air|i@air
    - i@air|i@air|i@air

rpg_bow:
    type: item
    debug: false
    material: bow
    display name: RPG LAUNCHER
    lore:
    - <&c>Launches missles
    - <&c>(Requires RPG ammo)
    recipe:
    - i@bow|i@tnt|i@tnt
    - i@tnt|i@diamond_block|i@tnt
    - i@air|i@air|i@air

rpg_arrow_determine_type:
    type: task
    debug: false
    script:
    - if <entry[myitem].result> == i@rpg_arrow {
      - flag player arrowtype:rpg
      }
      else {
      - narrate "<&c>You've loaded the wrong arrow type, most load an explosive round!"
      - determine cancelled
      }
    - flag player arrows:|:<context.projectile.eid> duration:10s
    - flag player arrows:|:<context.projectile.eid> duration:10s

rpg_arrow_world:
    type: world
    debug: false
    events:
        on player shoots bow:
        - flag player arrowtype:!
        - define item <player.inventory.slot[<player.inventory.find.material[arrow]>]>
        - adjust %item% quantity:1 save:myitem
        - if <context.bow> == i@rpg_bow {
          - inject rpg_arrow_determine_type
          }
        on projectile hits block:
        - if <context.shooter||null> == null queue clear
        - if <context.shooter> matches player {
          - if !<context.shooter.as_player.flag[arrows].contains[<context.projectile.eid>]>
          - run rpg_arrow_handler_internal def:<context.projectile.location>|<context.projectile> as:<context.shooter>
          }
        on arrow damages entity:
        - if <context.damage> matches player {
          - if !<context.damager.as_player.flag[arrows].contains[<context.projectile.eid>]> queue clear
          - if <context.damager.as_player.flag[arrowtype]> == sharp determine <context.damage.mul[2]>
          - if <context.damager.as_player.flag[arrowtype]> == damaged determine <context.damager.div[1.5]>
          - run rpg_arrow_handler_internal def:<context.entity.location>|null as:<context.damager>
          }
rpg_arrow_handler_internal:
    type: task
    debug: false
    speed: 2t
    script:
    - ^if <player.flag[arrowtype]> == rpg {
      - 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 %50% power:10
      - spawn %1% rpg[rpg_item=i@rpg=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% rpg[rpg_item=i@firework[rpg=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:myrpg
      - if %2% != null remove %2%
      - wait 5t
      - adjust <entry[myrpg].spawned_entities> detonate
      }