Paste #32982: Edit of P#32981 - Classes

Date: 2016/04/23 08:41:17 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# This is the first mage special ability - there is a 1 in 8 chance that every (hostile) mob in 20 blocks will be struck by lightning when a player hits an entity. I pinched (and edited) this from darthriddle's Sword of Purity so credit to him
mage:
    type: world
    debug: false
    events:
        on player damages entity:
        - if <player.has_permission[class.mage]> && <util.random.int[1].to[8]> == 2 {
          - foreach <player.location.find.entities[zombie|creeper|enderman|skeleton|pig_zombie|wither_skeleton|spider].within[20]> {
            - strike <def[value].location>
            }
             }
        on player damaged by lightning:
        - if <player.has_permission[class.mage]> {
          - determine cancelled
          }


classes: 
   type: command
   debug: true
   name: class
   script:  
# This deals with the race section of classes. 
   - if <context.args.get[1].is[==].to[race]> {
# This is a list of races players can choose along with classes for each race.
    - if <context.args.get[2].is[==].to[list]> {
        - narrate "<&2>[Classes] <&a>You may choose one of three races."
        - narrate "<&2>[Classes] <&1>The agile (+100 Acrobatics) Elf is capable of healing magic (/c prayer and /c heal)."
        - narrate "<&2>[Classes] <&1>Elf classes are Guardian, Herbalist, Woodsman."
        - narrate "<&2>[Classes] <&3>The Dwarf is a capable miner (+100 Mining) and can sense nearby ores (/c dowse and /c stonevision)."
        - narrate "<&2>[Classes] <&3>Dwarf classes are Blacksmith, Warrior, Miner."
        - narrate "<&2>[Classes] <&6>The strong (+100 Swords +100 Unarmed) Human cannot use magic without specialist training."
        - narrate "<&2>[Classes] <&6>Human classes are Soldier, Mage, Builder."
        - determine fulfilled
         }
    - if <player.flag[racechosen]> {
       - narrate "<&c>[Classes] You have already chosen a race."
       - determine cancelled
        }
# These are the three races players can choose currently - it might be possible to add donator or perk unlocked races.
    - if <context.args.get[2].is[==].to[elf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> acrobatics 100"
         - ^execute as_server "pex user <PLAYER.NAME> group add elf"
         - flag player elf
         - flag player racechosen
         - narrate "Your race is now <context.args.get[2]>"
          }
    - if <context.args.get[2].is[==].to[dwarf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> mining 100"
         - ^execute as_server "pex user <PLAYER.NAME> group add dwarf"
         - flag player dwarf
         - flag player racechosen
         - narrate "Your race is now <context.args.get[2]>"
          }
    - if <context.args.get[2].is[==].to[human]]> {
         - ^execute as_server "addlevels <PLAYER.NAME> swords 100"
         - ^execute as_server "addlevels <PLAYER.NAME> unarmed 100"
         - flag player human
         - flag player racechosen
         - narrate "Your race is now <context.args.get[2]>"
          }
    }
# This is the class help command, it gives information about the entire classes system
   - if <context.args.get[1].is[==].to[help]> {
        - narrate "<&2>[Classes] <&a>You may choose one of three races and one of three unique classses for that race."
        - narrate "<&2>[Classes] <&a>Each race and class will give you different MCMMO boosts and a passive or active skill."
        - narrate "<&2>[Classes] <&a>Use /class race <racename> to choose your race."
        - narrate "<&2>[Classes] <&a>Use /class class <classname> choose your class."
        - narrate "<&2>[Classes] <&a>Use /class race list to list races."
        - narrate "<&2>[Classes] <&a>Use /class class list to list classes for each race."
        }

# This is the class list, it lists classes and bonuses by race
   - if <context.args.get[1].is[==].to[class]> {
      - if <context.args.get[2].is[==].to[list]> {
        - narrate "<&2>[Classes] <&a>You may choose one of three classes for each race."
        - narrate "<&2>[Classes] <&1>Elf Guardians are excellent fighters (+75 Swords +75 Archery)."
        - narrate "<&2>[Classes] <&1>Elf Herbalists can forage well (+25 Herbalism) and nature flourishes in their presence (/c tree and /c lifewalk)."
        - narrate "<&2>[Classes] <&1>An Elf woodsman is completely at home in the wilderness (+75 Taming) (+75 Fishing)."
        - narrate "<&2>[Classes] <&3>Dwarf Blacksmiths excell at forging and repairing armour. (+100 Repair and /c armor)"
        - narrate "<&2>[Classes] <&3>Dwarf Warriors are trained in all forms of combat (+25 Archery +50 Swords +50 Axes +25 Unarmed)"
        - narrate "<&2>[Classes] <&3>Dwarf Miners can dig a hole in seconds (+75 Mining +75 Excavation)"
        - narrate "<&2>[Classes] <&6>Human Soldiers are strong with conventional weapons (+75 Swords +75 Archery)"
        - narrate "<&2>[Classes] <&6>Human Mages are at their best when fighting mobs (Special passive ability)"
        - narrate "<&2>[Classes] <&6>Human Builders can find materials anywhere (+75 Woodcutting +75 Excavation)"
        }
# This makes sure that players cannot repeatedly choose classes. This might be phased out if I can work out how to subtract mcmmo levels
      - if <player.flag[classchosen]> {
       - narrate "<&c>[Classes] You have already chosen a class."
       - determine cancelled
        }
# Moving on to the elven classes now
      - if <context.args.get[2].is[==].to[guardian]> && <player.flag[elf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> swords 75"
         - ^execute as_server "addlevels <PLAYER.NAME> archery 75"
         - flag player guardian
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[herbalist]> && <player.flag[elf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> herbalism 25"
         - ^execute as_server "pex user <PLAYER.NAME> group add herbalist"
         - flag player herbalist
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[woodsman]> && <player.flag[elf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> taming 75"
         - ^execute as_server "addlevels <PLAYER.NAME> fishing 75"
         - flag player woodsman
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
# The next three classes are the dwarven classes
      - if <context.args.get[2].is[==].to[blacksmith]> && <player.flag[dwarf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> repair 100"
         - ^execute as_server "pex user <PLAYER.NAME> group add blacksmith"
         - flag player blacksmith
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[warrior]> && <player.flag[dwarf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> swords 50"
         - ^execute as_server "addlevels <PLAYER.NAME> axes 50"
         - ^execute as_server "addlevels <PLAYER.NAME> archery 25"
         - ^execute as_server "addlevels <PLAYER.NAME> unarmed 25"
         - flag player warrior
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[miner]> && <player.flag[dwarf]> {
         - ^execute as_server "addlevels <PLAYER.NAME> excavation 75"
         - ^execute as_server "addlevels <PLAYER.NAME> mining 75"
         - flag player miner
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
# Last but not least are the 3 human classes.
      - if <context.args.get[2].is[==].to[soldier]> && <player.flag[human]> {
         - ^execute as_server "addlevels <PLAYER.NAME> swords 75"
         - ^execute as_server "addlevels <PLAYER.NAME> archery 75"
         - flag player soldier
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
         } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[mage]> && <player.flag[human]> {
         - ^execute as_server "pex user <PLAYER.NAME> add class.mage"
         - flag player mage
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
          } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
      - if <context.args.get[2].is[==].to[builder]> && <player.flag[human]> {
         - ^execute as_server "addlevels <PLAYER.NAME> woodcutting 75"
         - ^execute as_server "addlevels <PLAYER.NAME> excavation 75"
         - flag player builder
         - flag player classchosen
         - narrate "Your class is now <context.args.get[2]>"
         } else {
          - narrate "<&c>[Classes] Your race cannot choose this class."
          }
         }
        }

deflagger:
         type: assignment
         interact scripts:
         - 10 flagrace

deflagger2:
         type: assignment
         interact scripts:
         - 10 flagclass

flagrace:  
    type: interact
    steps:
         1:    
          click trigger:
           script:
            - flag player racechosen:!
flagclass:  
    type: interact
    steps:
         1:    
          click trigger:
           script:
            - flag player classchosen:!
#####################################################################    
ERROR:

while parsing a block mapping
  in "<unicode string>", line 19, column 4:
       type: command
       ^
expected <block end>, but found '<block sequence start>'
  in "<unicode string>", line 26, column 5:
        - if <context.args.get[2].is[==] ...