Paste #51526: Untitled Paste

Date: 2019/01/13 06:57:29 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


VanillaMobsLeveling:
    type: world
    debug: off
    events:
        on entity damaged by entity:
        - narrate "<&c><context.damage.round_to[1]> <&e>damage given." targets:<context.damager>
        - flag <context.entity> <context.damager>:+:<context.damage>
        on mythicmob mob killed:
        - narrate "mob <context.entity> killed"
        - narrate "player is true? <context.entity.flag[<context.killer>]>"
        - determine passively CANCELLED
        - define mob '<context.entity>'
        - define totalxp '<context.xp>'
        - define totaldrops '<context.drops>'
        - foreach <def[mob].location.find.players.within[30]>:
            - if <def[mob].has_flag[<def[value]>]>:
                - define ratio '<def[mob].flag[<def[value]>].div[<def[mob].health.max>]>'
                - define xp '<def[totalxp].mul[<def[ratio]>].round_to[1]>'
                - give xp qty:<def[xp]> player:<def[value]>
                - narrate "<&c>[<&6>XP<&c>] <&a>You earned <&c><def[xp]> <&a>xp for this kill. Use <&2>/lvl <&a>to track your level." targets:<def[value]>
                - define player '<def[value]>'
                - foreach <def[totaldrops]>:
                    - give <def[value]> qty:<def[value].quantity.mul[<def[ratio].round>]> to:<def[player].inventory>