Paste #33458: Untitled Paste

Date: 2016/05/14 16:03:18 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


##########################################@TERRAINCONTROL USERS@########################################
#   Do not Modify anything unless indicated otherwise!
#   The contents of this file provide the following functions:
# - AncientDungeonsArrow script ( This is a part of the dispenser script. removing this will break the dispenser script )
# - Dispenser Script ( Controls Traps & Special mob spawns of NLBlackEagle's Realms )
# - Sapling Fix ( Fixes a problem with trees growing constainly )
# - ChestScript ( Populates the chest generated by TerrainControl & Repopulate them after 300 minutes 
#   This function is player-bound so no global repopulate timings! )
#   Check the lootcrates.yml file for all loot items!
#
# Note: After changing values type /denizen reload -a ingame! Otherwise there wont be any diffrence. No need to restart!
#
# This is a YAML formatted file, make sure you check for YAML errors after updating this script!


#####################################
#  Created by NLBlackEagle          #
#  Website: www.craftrealms.org     #
#  TeamSpeak: ts3.craftrealms.org   #
#####################################


DungeonGhost:
  # This script creates a item which functions as boss spawn check.
  type: item 
  debug: false
  material: i@Bone
  display name: <&3>Restless Bone
  lore: 
  - This bone gives of a strange confusing aura
  no_id: false
  bound: false

DungeonBoss:
  # This script creates a item which functions as boss spawn check.
  type: item 
  debug: false
  material: i@Bone
  display name: <&3>Evil Bone
  lore: 
  - You feel slightly unconfortable when holding this bone.
  no_id: false
  bound: false


DungeonGuardian:
  # This script creates a item which functions as boss spawn check.
  type: item 
  debug: false
  material: i@Bone
  display name: <&3>Heavy Bone
  lore: 
  - This bone feels heavier then it should be, almosth as if something resides within
  no_id: false
  bound: false

AncientDungeonsArrow:
  # This is a part of the dispenser script. removing this will break the dispenser script
  type: item 
  debug: false
  material: i@arrow
  display name: <&3>Magical Ancient Arrow
  lore: 
  - This arrow only works with the Ancient Dispensers
  no_id: false
  bound: false

DungeonsMobSlowEffect:
    type: task
    debug: false
    script:
    - ^narrate "You legs have been broken by your oppoment!"
    - random {
      - playeffect effect:SLOW target:<player> quantity:2
      - playeffect effect:SLOW target:<player> quantity:3
      - playeffect effect:SLOW target:<player> quantity:4
      }

DungeonsMobPoisonEffect:
    type: task
    debug: false
    script:
    - ^narrate "You have been poisoned by your oppoment!"
    - random {
      - potion POISON duration:3 <player>
      - potion POISON duration:2 <player>
      - potion POISON duration:4 <player>
      }

DungeonsMobWitherEffect:
    type: task
    debug: false
    script:
    - ^narrate "You are poisoned by your oppoment!"
    - random {
      - potion WITHER duration:3 <player>
      - potion WITHER duration:2 <player>
      - potion WITHER duration:1 <player>
      }

DungeonsMobFlameEffect:
    type: task
    debug: false
    script:
    - ^narrate "You have been cursed by your oppoment!"
    - random {
      - burn <player> duration:4
      - burn <player> duration:3
      - burn <player> duration:2
      }

DispenserScript:
  # This script manages all dispensers placed by TerrainControl. To open the boss dispensers you'll need to have operator permissions!
  type: world
  debug: true
  events:
    on entity killed:
      - if <context.entity> contains <server.flag[DungeonSpawns]> {
        - explode power:10 l@<context.entity.location.simple>
        - if <util.random.int[1].to[10]> == 1 {
          - random {
            - drop i@GOLDEN_APPLE <context.entity.location.simple> qty:1
            - drop i@DIAMOND <context.entity.location.simple> qty:1
            - drop i@EXP_BOTTLE <context.entity.location.simple> qty:1
            - drop i@GOLD_BARDING <context.entity.location.simple> qty:1
            - drop i@GOLD_BLOCK <context.entity.location.simple> qty:1
            - drop i@GOLD_SWORD <context.entity.location.simple> qty:1
            - drop i@GOLD_HELMET <context.entity.location.simple> qty:1
            - drop i@GOLD_LEGGINGS <context.entity.location.simple> qty:1
            - drop i@GOLDEN_CARROT <context.entity.location.simple> qty:1
            }
          }
        }



    on entity damages player:
    - announce "<context.damager>"
    - if <context.damager> contains <server.flag[DungeonSpawns]> {
      - announce "hello"
      - if <util.random.int[1].to[1]> == 1 {
        - random {
          - run s@DungeonsMobWitherEffect as                     :<context.entity>
          - run s@DungeonsMobFlameEffect as:<context.entity>
          - run s@DungeonsMobPoisonEffect as:<context.entity>
          - run s@DungeonsMobSlowEffect as:<context.entity>
          }
        }
        - random {
          - determine |<context.damage.add[1]>
          - determine |<context.damage.add[2]>
          - determine |<context.damage.add[3]>
          - determine |<context.damage.add[4]>
          - determine |<context.damage.add[5]>
          }
        }
    on player opens inventory:
    - if <context.inventory.contains[li@DungeonBoss|DungeonGuardian|DungeonGhost]> {
      - if !<player.is_op||false> {
        - narrate "This dispenser has been locked with a ancient powerfull spell"
        - DETERMINE CANCELLED
        }
      }
    on block dispenses item:
    - if !<server.flag[dispenser].as_list.contains[<context.location.simple>]||false> {
        - if <context.location.inventory.list_contents> contains <i@DungeonBoss> {
          - if !<server.has_flag[dungeonboss]||false> {
            - playsound <context.location> sound:ENTITY_ENDERDRAGON_GROWL pitch:-100
            - ^spawn skeleton <context.location.add[0,1,0]> save:DungeonBoss
            - ^flag server "DungeonSpawns:|:<entry[DungeonBoss].spawned_entities>"
            - ^health <entry[DungeonBoss].spawned_entities> 30
            - ^heal <entry[DungeonBoss].spawned_entities>
            - ^adjust <entry[DungeonBoss].spawned_entities.get[1]> "custom_name:<gold><bold>DungeonBoss"
            - flag server dungeonboss duration:5m
            - DETERMINE CANCELLED
            }
          }
        - if <context.location.inventory.list_contents> contains <i@DungeonGuardian> {
          - if !<server.has_flag[DungeonGuardian]||false> {
            - playsound <context.location> sound:ENTITY_LIGHTNING_THUNDER pitch:-100
            - ^spawn skeleton <context.location.add[0,1,0]> save:DungeonGuardian
            - ^flag server "DungeonSpawns:|:<entry[DungeonGuardian].spawned_entities>"
            - ^health <entry[DungeonGuardian].spawned_entities> 30
            - ^heal <entry[DungeonGuardian].spawned_entities>
            - ^adjust <entry[DungeonGuardian].spawned_entities.get[1]> "custom_name:<red><bold>DungeonGuardian"
            - flag server DungeonGuardian duration:1m
            - DETERMINE CANCELLED
            }
          }
        - if <context.location.inventory.list_contents> contains <i@DungeonGhost> {
          - if !<server.has_flag[DungeonGhost]||false> {
            - playsound <context.location> sound:ENTITY_LIGHTNING_IMPACT pitch:-100
            - ^spawn skeleton <context.location.add[0,1,0]> save:DungeonGhost
            - ^flag server "DungeonSpawns:|:<entry[DungeonGhost].spawned_entities>"
            - ^health <entry[DungeonGhost].spawned_entities> 30
            - ^heal <entry[DungeonGhost].spawned_entities>
            - ^adjust <entry[DungeonGhost].spawned_entities.get[1]> "custom_name:<bold>DungeonGhost"
            - flag server DungeonGhost duration:1m
            - DETERMINE CANCELLED
            }
          }
        - if <context.location.inventory.list_contents> contains <i@AncientDungeonsArrow> {
          - if <server.has_flag[Entity]> == true {
            - if <server.has_flag[LaggOFix]> == false {
              - random {
                - DETERMINE i@lingering_potion[potion_effects=li@POISON,false,false]
                - DETERMINE i@lingering_potion[potion_effects=li@INSTANT_DAMAGE,true,false]
                - DETERMINE i@lingering_potion[potion_effects=li@SLOWNESS,false,true]

                - DETERMINE i@AncientDungeonsArrow
                }
              - DETERMINE CANCELLED
              - flag server LaggOFix duration:20
              }
            }
            else if <server.has_flag[Entity]> == false {
            - random {
              - spawn zombie <context.location>
              - spawn pig_zombie <context.location>
              - spawn creeper <context.location>
              - spawn spider <context.location>
              - DETERMINE CANCELLED
              }
            - random {
              - flag server Entity duration:5m
              - spawn zombie <context.location>
              - spawn pig_zombie <context.location>
              - spawn spider <context.location>
              - DETERMINE CANCELLED
              }
            - DETERMINE CANCELLED
            }
          }
        }
    - if <context.location.inventory.contains[li@DungeonBoss|DungeonGuardian|DungeonGhost|AncientDungeonsArrow]> {
      - DETERMINE CANCELLED
      }



Sapling100Script:
  #This script makes sure that the saplings which remain on the ground after growing a tree gets deleted, removing this script can make the server have a increase generation time.
  type: world
  debug: false
  events:
    on structure grows:
    - determine passively cancelled
    - modifyblock <context.location> m@AIR


Chest100Script:
  type: world
  default constants:
  #The RepopulateCooldown value is in minutes and determines the amount of time before a re-population 
  #should be executed. This causes no server load since the re-population is player-bound. 
  #Change the value "300m" to any number you'd like. 300m equals 5 hours.
    RepopulateCooldown: 300m
  #PopulateAttemts, lower this number to decrease the amount of items in a chest.
    PopulateAttempts: 10
  #PopulateMinimalItems, Minimal items in a chest upon populating. 0 Makes items more rare but not impossibile to populate.
    PopulateMinimalItems: 1
  #PopulateRarity, this parameter sets the rarity of the rare loot table. Adjust the rarity from 1 to 100. 1 = common. 100 is extremely rare.
    PopulateRarity: 5
  #RarePopulateAttempts, Minimal items in a chest upon populating from the rare item loot table. 0 Makes items more rare but not impossibile to populate.
    RarePopulateAttempts: 1
  debug: false
  events:
    on server start:
    - yaml load:lootcrates.yml id:lootcrates
    on player opens chest:
    - if !<player.has_flag[<context.inventory.location.simple>]> {
      - flag player <context.inventory.location.simple>:true duration:<s@chest100script.constant[RepopulateCooldown]>
      - if <server.flag[chest].as_list.contains[<context.inventory.location.simple>]> {
        - queue clear
      }
      - repeat <s@chest100script.constant[PopulateMinimalItems]> {
        - inventory add d:<context.inventory> o:<yaml[lootcrates].read[loot].random.as_item> slot:<util.random.int[1].to[27]>
      }
      - repeat <s@chest100script.constant[PopulateAttempts]> {
        - if <util.random.int[1].to[5]> == 5 {
          - inventory add d:<context.inventory> o:<yaml[lootcrates].read[loot].random.as_item> slot:<util.random.int[1].to[27]>
        }
      }
      - repeat <s@chest100script.constant[RarePopulateAttempts]> {
        - if <util.random.int[1].to[<s@chest100script.constant[PopulateRarity]>]> == 1 {
          - inventory add d:<context.inventory> o:<yaml[lootcrates].read[rareloot].random.as_item> slot:<util.random.int[1].to[27]>
        }
      }
    }
    on player places block:
    # This is part of the ChestScript Script and detects if the chest was placed by TerrainControl
    - if li@chest|trapped_chest contains <context.material.name> {
      - flag server chest:->:<context.location.simple>
    }
    # This is part of the DispenserScript Script and detects if the Dispenser was placed by TerrainControl
    - if dispenser contains <context.material.name> {
      - flag server dispenser:->:<context.location.simple>
      }