Paste #17462: Merchant 03

Date: 2015/07/06 17:38:34 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# NPC Merchant
# Citizens 2 (build #992)
# Denizen 0.9.3 (build #1352)
#
# @author M0R_Gaming
#
# FOR EASY SETUP
# 1) Select the NPC and type /npc assign --set “sell”

# Assignment script for merchant.
Merchant:
    type: assignment

    interact scripts:
     # Priority starts from 10
     - 10 “Sell”

    actions:
         on assignment:
         # Enable/disable triggers with NPC via chatting, clicking and entering proximity.
         - trigger name:chat toggle:true
         - trigger name:click toggle:true
         - trigger name:proximity toggle:true radius:5

         on enter proximity:
         - random 2
         - chat “<dark_gray>Welcome to my store.”
         - chat “<dark_gray>Please take your time.”

         on exit proximity:
         - zap ’s@Sell’ step:default

Sell:
    type: interact
    steps:
        default:
            click trigger:
                script:
                - chat “<dark_gray>Do you wish to buy something?”
                - narrate "Type <gold>Yes<white> or <gold>No<white>"
                - zap BuyMenu

        BuyMenu:
            chat trigger:
                'Yes':
                    trigger: '/Yes/.'
                    script:
                        - chat <dark_gray>Well, we have <Gold>Diamonds, Iron Ingots, and Blaze Rods <dark_gray>in stock.
                        - chat <dark_gray>What would you like to buy?
                        - zap Buy

                'No':
                    trigger: ‘/No/, I do not wish to buy anything.’
                    script:
                        - chat “<dark_gray>Come back later if you want anything.”
                        - zap default

        Buy:
            chat trigger:
                ‘Diamond’:
                    trigger: ‘/Diamond/s please.’
                    script:
                        - chat “<dark_gray>Sure thing! How much do you want?”
                        - narrate “Type in your amount in integers”
                        - zap BuyDiamond

                ‘Iron’:
                    trigger: ‘/Iron/ Ingots please.’
                    script:
                        - chat “<dark_gray>Sure thing! How much do you want?”
                        - narrate “Type in your amount in integers”
                        - zap BuyDiamond

                ‘Blaze’:
                    trigger: ‘/Blaze/ Rods please.’
                    script:
                        - chat “<dark_gray>Sure thing! How much do you want?”
                        - narrate “Type in your amount in integers”
                        - zap BuyDiamond

        BuyDiamond:
            chat trigger:
                ‘’:
                    trigger: ’//I would like <player.chat_history>’
                    script:
                        - narrate “This has not been completed yet”
                        - zap default