Paste #887: Untitled Paste

Date: 2014/01/01 20:36:40 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


NPCLoot:
    type: assignment    
    actions:
      on damage:
      - if !<npc.flag[attackers].as_list.contains[<player>]> flag <npc> attackers:->>:<player>
      on death:
      - foreach <npc.flag[attackers].aslist> {
        - if <util.random.int[0].to[100]> < 40 {
          - define item 'i@<proc[determine loot]>'
          - if %item% != null {
              - give player:%value% %item%
              - narrate player:%value% 'A %item% for your trouble...'
          }
        }
      - flag <npc> attackers:!

"Determine Loot":
    type: procedure

    script:
    - define roll <util.random.int[1].to[100]>
    - if %roll% >>= 0 && %roll% < 25 define quality "Common"
      else if %roll% >= 25 && %roll% < 40 define quality "Uncommon"
      else if %roll% >= 40 && %roll% < 101 define quality "Nothing"
    - if %quality% == Common
      determine "<li@Stick|Coal|torch.random>"      
      else if %quality% == Uncommon
      determine "<li@Iron_Sword|Iron_Spade|Iron_Pickaxe|Diamond.random>"
      else if %quality% == Nothing
      determine "null"