Potion Maker w/Quests


Author: Hyruii
Created: 2014-01-10T02:50:22-0500
Edited: 2014-02-04T04:03:40-0500
Denizen Version: 0.9.3
Views: 47
Downloads: 634
Likes: 0


WGET
Description: Assignment for a NPC potion maker with quests

# NPC Potion Maker
# Citizens 2 (build #992)
# Denizen 0.9.3 (build #1352)
#
# @author Hyruii
#
# FOR EASY SETUP
# 1) Select the NPC and type /npc assign --set "potionmaker"
 
# Item script for potion of healing II.
applejuice:
   type: item
   material: 373:8229
   display name: 'Apple Juice'
   lore:
   - Magical juice made from special apples brewed by Red Apple Inn.
   - '-Heals 4 hearts instantly-'
 
# Assignment script for potion maker.
"potionmaker":
    type: assignment
    default constants:
        # Type of item to retrieve
        item: apple
        # Amount of item to retrieve
        amt: 20
        # Name of quest flag
        qflag: applejuice

    interact scripts:
        # Priority starts from 10
        - 10 PM Chat
        - 9 PM Take Item
 
    actions:
        on assignment:
        # Enable/disable triggers with NPC via chatting, clicking and entering proximity.
        - trigger name:chat state:true 
        - trigger name:click state:true
        - trigger name:proximity state:true radius:5
 
        # The NPC will hold a potion bottle
        # - equip 373:8229
 
        # Potion maker will ask you to begin quest if flag[applejuice] is not complete.
        on enter proximity:
            - narrate "<npc.name> brightens up when she sees you."
            - if <global.flag[applejuice]> == complete||started {
                - random 2
                - chat "<red>Hi, <gold><npc.name>!"
                - chat "<red>Here to get more potions?"
              }
              else {
                - chat "<gold><player.name><red>! I need your help to make some potions, please say yes!"
                - narrate "Please type 'yes' or 'no'."
              }

        on exit proximity:
            - zap 's@PM Chat' step:default
 
# Interact script for accepting/refusing quest and buying potions.
"PM Chat":
    type: interact
    steps:
        default:
            chat trigger:
                'Yes':
                    trigger: '/Yes/, I will help you...'
                    script:
                    - if <global.flag[applejuice]> != complete {
                      - chat "<red>Thank you! Please help me collect 20 apples and give it to me!"
                      - chat "<red>As thanks, I will make potions for you whenever you want once you complete the task."
                      - flag global "applejuice:started"
                      }
                      else {
                        - chat "<red>I'm sorry? Did I ask you anything?"
                      }

                'No':
                    trigger: '/No/, I cannot help you...'
                    script:
                    - narrate "<npc.name> looks disappointed..."
                    - chat "<red>Oh no, please come back soon..."

                'Applejuice':
                    trigger: '/Apple juice/, please...'
                    script:
                    - if <global.flag[appleamt]> OR_MORE 1 {
                      - if <player.money> OR_MORE 20 {
                        - take money qty:20
                        - give applejuice qty:1
                        - narrate "<player> is left with <player.money> coins."
                        }
                        else {
                          - chat "<red>You do not have enough money,<player>."
                        }
                      }
                      else {
                        - chat "<red>I do not have any apples, you will have to bring me more to make potions with."
                      }
 
                'Leave':
                   Trigger: 'I want /nothing/...'
                   script:
                   - chat "<red>Come back again, I may have more tasks for you in future!"

        takeapple:
            click trigger:
            script:
            - if <global.flag[applejuice]> == started||complete {
                - if <player.item_in_hand.contains[apple]> {
                    - chat "<red>I see that you have some apples for me, thank you!"
                    - take iteminhand qty:1
                    - flag global "appleamt:++"
                    - narrate "<npc.name> now has <red><global.flag[appleamt]> apples.!"
                    - if <global.flag[appleamt]> == 20 {
                        - if <global.flag[applejuice]> != complete {
                            - flag global "applejuice:complete"
                            - narrate "<red>Thank you <gold><player><red>! Now I can finally sell apple juice as long I have apples!"
                            - wait 1s
                            - announce "<red> Thanks to <gold><player><red>, the Red Apple bartender now sells potions!"
                          }
                      }
                  }
                  else {
                      - if <global.flag[applejuice]> == complete {
                          - chat "<red>We only have our famous magical Apple Juice for sale now. It's only 20 coins for a bottle!"
                          - narrate "Please type 'apple juice' or 'leave'"
                        }
                  }
              }
              else {
                  - random 2
                  - chat "<red>I hope to make drinks to make people happy!"
                  - chat "<red>This inn is really my grandfather's. I really miss him..."
              }
            - zap 's@PM Chat' step:default




Comments
No one has posted a comment! Post one below: