Paste #73970: things

Date: 2020/08/06 18:42:03 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


archeryworldscript:
  type: world
  events:
    on player shoots target with arrow in:archeryroom:
    - modifyblock <context.location> air
    - if <server.flag[archerylevel]> == 1:
      - flag <context.shooter> archerypoints:+:1
      - if <context.shooter.flag[archerypoints]> = 6:
        - flag server archeryreward:100
      - else:
        - flag server archeryreward:+:16
    - else if <server.flag[archerylevel]> == 2:
      - flag <context.shooter> archerypoints:+:2
      - flag server archeryreward:+:16
      - if <context.location.y> > 75:
        - flag server toptarget
        - if <server.has_flag[toptarget]> && <server.has_flag[bottarget]>:
          - flag server endarcherytwo
      - else:
        - flag server bottarget
        - if <server.has_flag[toptarget]> && <server.has_flag[bottarget]>:
          - flag server endarcherytwo
    - else if <server.flag[archerylevel]> == 3:
      - flag <context.shooter> archerypoints:+:3
    - else if <server.flag[archerylevel]> == 4:
      - flag <context.shooter> archerypoints:+:5
    on player enters archeryenter:
    - if <server.has_flag[archeryrangeinuse]>:
      - determine passively cancelled
    - else:
      - flag server archeryrangeinuse
    on player exits archeryenter:
    - flag server archeryrangeinuse:!
    - take archerybow
    - take archeryarrows quantity:64

alynniaradius:
  type: assignment
  actions:
    on assignment:
    - trigger name:proximity state:true radius:2
    - trigger name:chat state:true
  interact scripts:
  - alynnia

alynnia:
  type: interact
  steps:
    1:
      proximity trigger:
        entry:
          script:
            - if <player.has_flag[npcengage]>:
              - stop
            - flag player npcengage
            - if !<player.has_flag[archerybegin]>:
              - narrate "<&6>[<&f>[<&4>NPC<&f>] <&c>Alynnia <&6>-> <&c>me<&6>]<&r> Welcome to the Arenslas archery range! There are four rounds and it costs c100 to enter. Would you like to play?"
              - narrate "<&6>Play the Arenslas archery game? Reply 'yes' to accept."
              - flag player archerybegin
        exit:
          script:
            - flag player archerybegin:!
            - flag player npcengage:!
            - disengage
      chat trigger:
        1:
          trigger: /Yes/.
          script:
            - if <player.has_flag[archerybegin]>:
              - narrate "<&6>[<&f>[<&4>NPC<&f>] <&c>Alynnia <&6>-> <&c>me<&6>]<&r> Okay! Get ready. The game will begin in a moment."
              - money take quantity:100
              - give archerybow
              - give archeryarrows quantity:64
              - flag player archerypoints:0
              - wait 5s
              - run archerygame

archerybow:
  type: item
  material: bow

archeryarrows:
  type: item
  material: arrow

archerygame:
  type: task
  script:
    - while <server.has_flag[archeryrangeinuse]>:
      - title "title:<gold>Round One..." stay:1s
      - wait 1s
      - title "title:<gold>3..." stay:1s
      - wait 1s
      - title "title:<gold>2..." stay:1s
      - wait 1s
      - title "title:<gold>1..." stay:1s
      - wait 1s
      - title "title:<gold>Go!" stay:1s
      - modifyblock archerytarget1 target
      - modifyblock archerytarget2 target
      - modifyblock archerytarget3 target
      - modifyblock archerytarget4 target
      - modifyblock archerytarget5 target
      - modifyblock archerytarget6 target
      - wait 18s
      - modifyblock archeryreset air
      - wait 3s
      - title "title:<gold>Round Two..." stay:1s
      - wait 1s
      - title "title:<gold>3..." stay:1s
      - wait 1s
      - title "title:<gold>2..." stay:1s
      - wait 1s
      - title "title:<gold>1..." stay:1s
      - wait 1s
      - title "title:<gold>Go!" stay:1s
      - flag server archeryleveltwo duration:15s
      - while <server.has_flag[archeryleveltwo]> && !<server.has_flag[endarcherytwo]>:
        - run toptarget
        - run bottarget


toptarget:
  type: task
  script:
    - while !<server.has_flag[toptarget]>:
      - modifyblock archerytarget3 target
      - wait 0.5s
      - modifyblock archerytarget3 air
      - modifyblock archerytarget8 target
      - wait 0.5s
      - modifyblock archerytarget8 air
      - modifyblock archerytarget2 target
      - wait 0.5s
      - modifyblock archerytarget2 air
      - modifyblock archerytarget7 target
      - wait 0.5s
      - modifyblock archerytarget7 air
      - modifyblock archerytarget1 target
      - wait 0.5s
      - modifyblock archerytarget1 air
      - modifyblock archerytarget7 target
      - wait 0.5s
      - modifyblock archerytarget7 air
      - modifyblock archerytarget2 target
      - wait 0.5s
      - modifyblock archerytarget2 air
      - modifyblock archerytarget8 target
      - wait 0.5s
      - modifyblock archerytarget8 air
      - if !<server.has_flag[archeryleveltwo]>:
        - stop