Paste #63406: mayor

Date: 2020/01/01 20:29:47 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


mayor_script:
    type: world
    events:
        on player right clicks block with wheat:
        - take iteminhand quantity:1
        - drop mayor_placer <context.location>
        on player right clicks block with mayor_placer:
        - LocationTag.add[<context.location>]
        - create player mayor <context.location.add[0,2,0]> save:mayorID
        - take iteminhand quantity:1
        - assignment set script:mayor_assignment npc:<entry[mayorID].created_npc>
        - determine cancelled


mayor_assignment:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
    interact scripts:
    - 1 mayor_interact

mayor_interact:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - inventory open d:in@mayor_menu
                on player clicks on mayor_hire_soldier:
                - chat "hired"
                - determine cancelled
                on player clicks on mayor_dismiss:
                - chat "goodbye"
                - remove mayor
                - determine cancelled
mayor_placer:
    type: item
    material: bat_spawn_egg
    display name: Mayor spawner

mayor_hire_soldier:
    type: item
    material: stone_sword
    display name: Hire a soldier for 64 Wheat
mayor_dismiss:
    type: item
    material: barrier
    display name: Dismiss the mayor



mayor_menu:
    type: inventory
    title: Mayor
    size: 27
    slots:
    - "[] [] [] [] [] [] [] [] [i@mayor_dismiss]" 
    - "[] [] [] [] [] [i@mayor_hire_soldier] [] [] []"
    - "[] [] [] [] [] [] [] [] []"