Paste #1951: Untitled Paste

Date: 2014/02/10 12:09:22 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# Testing out making a one use scroll to summon a wolf that will attack your target.
"wolfscroll":
  type: item
  material: 339
  display name: <red> Scroll of Summon wolf
  lore:
  - This scroll can be used
  - to Summon a wolf monster
  - that will attack other 
  - nearby monsters.

# This links up with wolfscroll
"summon_wolf":
  type: world
  events:
    on player right clicks entity with i@wolfscroll:
    - run wolf_attack "def:<context.entity.location.x>:<context.entity.location.y>:<context.entity.location.z>:<context.entity.location.world.name>"

# this is the wolf actually coming into being and choosing a target based off the "def:"
"wolf_attack":
  type: task
  script:
  - ^execute as_server "npc create wolf --type wolf --at %1%"
  - execute as_server "npc assign --set wolf_assign"
  - take i@wolfscroll qty:1

# here is the assignment that gets fired from the previous task and will start his death timer.
"wolf_assign":
  type: assignment
  actions:
    on assignment:
    - attack <npc> target:<npc.location.find.living_entities.within[10].exclude[<npc>].exclude[<player>].get[1]>
    - run kill_wolf delay:10s

"wolf_damage":
  type: world
  events:
    on npc damages entity:
    - if <npc.script.replace[s@]> == wolf_assign determine <context.damage.mul[5]>

# this script will remove the wolf after 10 seconds if it has not been killed
"kill_wolf":
  type: task
  script:
  - remove <npc>