Paste #63346: script

Date: 2019/12/31 17:15:13 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#GUI
skillGUI:
    type: inventory
    inventory: chest
    title: Skill allocation
    size: 45
    slots:
        - "[available_skill_points]  []  []  []  []  []  []  [strength_skill_points]  [1_strength]"
        - "[]  []  []  []  []  []  []  [resistance_skill_points]  [1_resistance]"
        - "[]  []  []  []  []  []  []  [charisma_skill_points]  [1_charisma]"
        - "[]  []  []  []  []  []  []  [intelligence_skill_points]  [1_intelligence]"
        - "[reset_skill_points]  []  []  []  []  []  []  []  []"
#Items in GUI
available_skill_points:
    type: item
    material: lime_terracotta
    display name: "Available skill points: <player.flag[skillpoints]>"
strength_skill_points:
    type: item
    material: white_terracotta
    display name: "Strength points: <player.flag[strength]>"
resistance_skill_points:
    type: item
    material: white_terracotta
    display name: "Resistance points: <player.flag[resistance]>"
charisma_skill_points:
    type: item
    material: white_terracotta
    display name: "Charisma points: <player.flag[charisma]>"
intelligence_skill_points:
    type: item
    material: white_terracotta
    display name: "Intelligence points: <player.flag[intelligence]>"
1_strength:
    type: item
    material: lime_concrete
    display name: "Allocate a skill point to strength"
1_resistance:
    type: item
    material: lime_concrete
    display name: "Allocate a skill point to resistence"
1_charisma:
    type: item
    material: lime_concrete
    display name: "Allocate a skill point to charisma"
1_intelligence:
    type: item
    material: lime_concrete
    display name: "Allocate a skill point to intelligence"
reset_skill_points:
    type: item
    material: light_blue_concrete
    display name: "<blue>Reset skill points"
#GUI code
GUIcode:
    type: world
    events:
        on player drags in skillGUI priority:100:
            - determine cancelled
        on player clicks in skillGUI priority:100:
            - determine cancelled
        on player clicks 1_strength in skillGUI:
            - if <player.flag[skillpoints]> >= 0:
            - if <player.flag[strength]> =< 10:
                - narrate "<gree>You have aloocated a skill point to strength"
                - flag player strength:++
                - flag player skillpoints:-:1
            - else:
                - narrate "<red>You have reached the max level"
                - stop
            - else:
                - narrate "<red>You have no skill points"
                - stop
        on player clicks 1_resistance in skillGUI:
            - if <player.flag[skillpoints]> >= 0:
                - if <player.flag[resistance]> =< 10:
                    - narrate "<gree>You have aloocated a skill point to resistance"
                    - flag player resistance:++
                    - flag player skillpoints:-:1
                - else:
                    - narrate "<red>You have reached the max level"
                    - stop
            - else:
                - narrate "<red>You have no skill points"
                - stop