Paste #14210: Edit of P#14209 - Untitled Paste

Date: 2015/03/04 05:31:41 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


treasurehunt:
  type: world

  events:
    on server start:
      # Monsters will not spawn this long for that player finding a treasure
      - flag global treasure_SP_cooldown_duration:30m
      # Player 1 enters the trigger cuboid. Player 2 now has this much time to enter it as well before monsters spawn again.
      - flag global treasure_MP_cooldown_duration:10m

    on player enters treasure_b1:
    - run spawnTreasureMobs def:treasure_b1|<proc[playerCountDifficulty].context[50]>|<fl@pmsWorldName>|l@-2351,65,-3490/l@-2359,70,-3490/l@-2359,65,-3489/l@-2351,65,-3486/l@-2358,74,-3490 instantly

    on player enters treasure_f1:
    - run spawnTreasureMobs def:treasure_f1|<proc[playerCountDifficulty].context[60]>|<fl@pmsWorldName>|l@1881,40,-3304/l@1890,45,-3298/l@1891,45,-3306/l@1883,50,-3304/l@1891,50,-3302/l@1888,62,-3310/l@1887,35,-3307/l@1894,35,-3306 instantly

    on player enters treasure_a2:
    - run spawnTreasureMobs def:treasure_a2|<proc[playerCountDifficulty].context[40]>|<fl@pmsWorldName>|l@-3989,76,-2630/l@-3992,77,-2630/l@-3990,69,-2636/l@-3988,69,-2628/l@-3993,69,-2628 instantly

    on player enters treasure_b2:
    - run spawnTreasureMobs def:treasure_b2|<proc[playerCountDifficulty].context[75]>|<fl@pmsWorldName>|l@-2103,84,-2277/l@-2112,84,-2285/l@-2095,84,-2286/l@-2103,77,-2285/l@-2098,84,-2296/l@-2109,84,-2296/l@-2104,84,-2290/l@-2103,84,-2290 instantly

    on player enters treasure_d2:
    - run spawnTreasureMobs def:treasure_d2|<proc[playerCountDifficulty].context[30]>|<fl@pmsWorldName>|l@-828,71,-3051/l@-836,71,-3051/l@-828,71,-3049/l@-828,71,-3053 instantly

    on player enters treasure_f2:
    - run spawnTreasureMobs def:treasure_f2|<proc[playerCountDifficulty].context[35]>|<fl@pmsWorldName>|l@1798,62,-2297/l@1795,62,-2297/l@1791,62,-2297/l@1792,62,-2294/l@1791,62,-2294/l@1792,62,-2302/l@1791,62,-2302 instantly

    on player enters treasure_f2_1:
    - run spawnTreasureMobs def:treasure_f2_1|<proc[playerCountDifficulty].context[30]>|<fl@pmsWorldName>|l@1812,55,-2267/l@1812,55,-2257/l@1805,55,-2257/l@1805,55,-2267/l@1808,55,-2262/l@1808,55,-2267/l@1808,55,-2257 instantly

    on player enters treasure_f2_2:
    - run spawnTreasureMobs def:treasure_f2_2|<proc[playerCountDifficulty].context[60]>|<fl@pmsWorldName>|l@1773,55,-2266/l@1781,55,-2266/l@1781,55,-2258/l@1781,55,-2258/l@1776,55,-2261/l@1776,55,-2263/l@1778,55,-2263/l@1778,55,-2261 instantly

    on player enters treasure_e3:
    - run spawnTreasureMobs def:treasure_G5|<proc[playerCountDifficulty].context[20]>|<fl@pmsWorldName>|l@190,64,-1448/l@188,64,-1437/l@197,67,-1441/l@199,64,-1449/l@187,64,-1443 instantly

    on player enters treasure_f3:
    - run spawnTreasureMobs def:treasure_f3|<proc[playerCountDifficulty].context[45]>|<fl@pmsWorldName>|l@1353,69,-1235/l@1364,69,-1245/l@1342,69,-1257/l@1353,69,-1230/l@1356,69,-1252/l@1363,69,-1234 instantly

    on player walks over treasure_f3_1:
    - run spawnTreasureMobs def:treasure_f3_1|<proc[playerCountDifficulty].context[30]>|<fl@pmsWorldName>|l@1340,56,-1218/l@1358,56,-1218 instantly

    on player enters treasure_B4:
    - run spawnTreasureMobs def:treasure_B4|<proc[playerCountDifficulty].context[50]>|<fl@pmsWorldName>|l@-2460,64,-536/l@-2452,64,-529/l@-2452,64,-546/l@-2457,64,-541/l@-2447,64,-541/l@-2444,64,-537 instantly

    on player enters treasure_e4:
    - run spawnTreasureMobs def:treasure_e4|<proc[playerCountDifficulty].context[15]>|<fl@pmsWorldName>|l@127,86,-431/l@127,81,-431/l@127,74,-431/l@121,74,-425/l@122,74,-417 instantly

    on player enters treasure_G5:
    - run spawnTreasureMobs def:treasure_G5|<proc[playerCountDifficulty].context[35]>|<fl@pmsWorldName>|l@2887,68,734/l@2882,68,734/l@2874,68,734/l@2877,68,732/l@2887,68,734 instantly

    on player enters treasure_c6:
    - run spawnTreasureMobs def:treasure_c6|<proc[playerCountDifficulty].context[50]>|<fl@pmsWorldName>|l@-1140,88,1369/l@-1148,87,1367/l@-1140,88,1377/l@-1140,93,1381/l@-1136,87,1377/l@-1149,87,1378 instantly

    on player enters treasure_h6:
    - run spawnTreasureMobs def:treasure_h6|<proc[playerCountDifficulty].context[30]>|<fl@pmsWorldName>|l@3543,71,1484/l@3546,71,1481/l@3546,71,1473/l@3543,71,1470/l@3534,71,1470/l@3531,71,1473/l@3531,71,1481/l@3534,71,1484 instantly

    on player enters treasure_a7:
    - run spawnTreasureMobs def:treasure_a7|<proc[playerCountDifficulty].context[40]>|<fl@pmsWorldName>|l@-3241,70,2452/l@-3238,70,2453/l@-3236,70,2447/l@-3243,70,2448/l@-3241,74,2455/l@-3239,70,2450/l@-3240,88,2455/l@-3239,70,2443 instantly

    on player enters treasure_b7:
    - run spawnTreasureMobs def:treasure_b7|<proc[playerCountDifficulty].context[45]>|<fl@pmsWorldName>|l@-2025,79,2975/l@-2025,75,2970/l@-2025,71,2975/l@-2019,71,2970/l@-2021,71,2963/l@-2015,71,2963/l@-2012,71,2972/l@-2025,71,2973/l@-2025,67,2967/l@-2025,67,2966/l@-2034,68,2971 instantly

    on player enters treasure_f7:
    - run spawnTreasureMobs def:treasure_f7|<proc[playerCountDifficulty].context[30]>|<fl@pmsWorldName>|l@1567,96,2371/l@1570,96,2377/l@1566,96,2381/l@1567,95,2390/l@1558,94,2367 instantly

    on player enters treasure_a8:
    - run spawnTreasureMobs def:treasure_a8|<proc[playerCountDifficulty].context[65]>|<fl@pmsWorldName>|l@-3715,78,3999/l@-3709,78,3988/l@-3712,78,3986/l@-3710,72,3993/l@-3711,72,3995/l@-3721,68,4000/l@-3712,65,3992/l@-3723,68,3996/l@-3720,68,4009 instantly

    on player walks over treasure_h8:
    - run spawnTreasureMobs def:treasure_h8|<proc[playerCountDifficulty].context[50]>|<fl@pmsWorldName>|l@3167,132,3082/l@3163,131,3081/l@3164,139,3082/l@3169,139,3078/l@3169,139,3083/l@3172,139,3079 instantly

ttest:
  type: task
  script:
  - run spawnTreasureMobs def:treasure_XX|<proc[playerCountDifficulty].context[75]>|<fl@pmsWorldName>|l@1000,79,-960/l@1000,79,-964/l@1000,79,-962 instantly

spawnTreasureMobs:
  type: task
  definitions: treasurename|difficulty|world|locations
  script:
  - if !<player.has_flag[%treasurename%_found]> && !<global.has_flag[%treasurename%_MP_cooldown]> {
    # narrate to all players within range
    - narrate <proc[xRandomTreasureMessage]> targets:<player.location.find.players.within[36]>

    - define locationList <def[locations].split[/]>
    # Randomize spawn locations so that bosses don't always spawn at the same spot.
    - foreach <def[locationList].random[<def[locationList].size>]> {
      - define loc "%value%,%world%"
      - if <def[loc].world.is[!=].to[null]> {
        - flag player %treasurename%_found duration:<global.flag[treasure_SP_cooldown_duration]>
        - flag global %treasurename%_MP_cooldown duration:<global.flag[treasure_MP_cooldown_duration]>

        - define handEquip <proc[randomitem].context[pmsWeapons|%difficulty%|true]>
        # One boss will be spawned
        - if %loop_index% == 1 {
          - define drop <proc[lerp].context[pmsDropRate|<def[difficulty]>|true]>
          - define dropChances "<def[drop]>F,<def[drop]>F,<def[drop]>F,<def[drop]>F,<def[drop]>F"

          - define theMob <proc[getProceduralMob].context[%difficulty%|true]>
          - if <def[theMob].entity_type.is[==].to[SKELETON]> {
            - define handEquip <proc[randomitem].context[<li@pmsWeapons|pmsBows.get[<util.random.int[<util.random.int[1].to[2]>].to[2]>]>|%difficulty%|true]>
          }
          - run s@spawnSummonWrapper def:as_server|%loc%|<def[theMob]>|hand:<def[handEquip]>/head:<proc[randomitem].context[pmsHelmets|%difficulty%|true]>/chest:<proc[randomitem].context[pmsChestplates|%difficulty%|true]>/legs:<proc[randomitem].context[pmsLeggings|%difficulty%|true]>/boots:<proc[randomitem].context[pmsBoots|%difficulty%|true]>/DropChances:[%dropChances%]|%difficulty%|true instantly
        }
        else {
          # At this point, the boss has already been spawned.
          - if <util.random.decimal.is[LESS].than[<math:1-<fl@pmsSpawnProbability>>]> {
            # The rest of the locations will be filled with random mobs with half the boss level
            - define drop <proc[lerp].context[pmsDropRate|<def[difficulty]>|false]>
            - define dropChances "<def[drop]>F,<def[drop]>F,<def[drop]>F,<def[drop]>F,<def[drop]>F"
            - narrate "normal diff %difficulty%"
            - define theMob <proc[getProceduralMob].context[%difficulty%|false]>
            - if <def[theMob].entity_type.is[==].to[SKELETON]> {
              - define handEquip <proc[randomitem].context[<li@pmsWeapons|pmsBows.get[<util.random.int[<util.random.int[1].to[2]>].to[2]>]>|%difficulty%|false]>
            }
            - run s@spawnSummonWrapper def:as_server|%loc%|<def[theMob]>|hand:<def[handEquip]>/head:<proc[randomitem].context[pmsHelmets|%difficulty%|false]>/chest:<proc[randomitem].context[pmsChestplates|%difficulty%|false]>/legs:<proc[randomitem].context[pmsLeggings|%difficulty%|false]>/boots:<proc[randomitem].context[pmsBoots|%difficulty%|true]>/DropChances:[%dropChances%]|%difficulty%|false instantly
          }
        }
      }
      }
    }