Denizen/0.7/Example Scripts/Beginner Scripts: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
Line 119: Line 119:
   Type: Trigger   
   Type: Trigger   
   Requirements:
   Requirements:
     Mode: ALL
     Mode: All
     List: #Here we check if they are on the quest and have the items.
     List: #Here we check if they are on the quest and have the items.
     - FINISHED TestMan
     - FINISHED StartQuest
     - ITEM 42 1
     - ITEM 42 1
     - ITEM 288 1
     - ITEM 288 1
Line 139: Line 139:
         - CHAT "Bring me those items again, and I'll give you another!"       
         - CHAT "Bring me those items again, and I'll give you another!"       
         #Always disengagae after an Engage
         #Always disengagae after an Engage
        - DISENGAGE
</pre>
|}
==Basic Unrepeatable Fetch Quest==
By adding 3 lines to the script above, it becomes un-repeatable.
{| class="wikitable collapsible collapsed"
! Basic Repeatable Fetch Quest
|-
| <pre>
#--- assignments.yml ----
Denizens:
John Q QuestGiver:
  Interact Scripts:
    - 0 StartFetch
    - 1 EndFetch
#--- UnRepeatableFetchQuest.yml ----
   
StartQuest:
  Type: Interact
  Requirements:
    Mode: None
  Steps:
    1:
      Click Trigger:
        Script:
        - CHAT "Hey, you there!"
        - CHAT "I have a special request of you!"
        - CHAT "Will you help me?"
      Chat Trigger:
        1:
          Trigger: /Yes/. I will.
          Script:
          - CHAT "I need you to bring me some thing. For testing!"
          - WAIT 1
          - CHAT "I need: 1 Iron Block, 1 Feather, and 3 Eggs."
          - WAIT 1
          - CHAT "Come back when you have them and I will reward you!"
          - FINISH
          - ZAP
        2:
          Trigger: /No/. I will not.
          Script:
          - CHAT "Are you sure? OK. maybe later?"
    2:
      Click Trigger:
        Script:
        - CHAT "Come back you have 1 Iron Block, 1 Feather, and 3 Eggs!"
    3:
      Click Trigger:
        Script:
        - CHAT "Thanks for the help before!"
EndFetch:
  Type: Interact 
  Requirements:
    Mode: All
    List: #Here we check if they are on the quest and have the items, and haven't completed this yet.
    - FINISHED StartQuest
    - -FINISHED EndFetch
    - ITEM 42 1
    - ITEM 288 1
    - ITEM 344 3
  Steps:
    '1':
      Click Trigger:
        Script:
        #Engage is used to keep the player from clicking twice.
        - ENGAGE
        - TAKE 42 QTY:1
        - TAKE 288 QTY:1
        - TAKE 344 QTY:3
        - CHAT "Thank you so much! Here, take this as a reward!"
        - GIVE 133 QTY:1
        - WAIT 1
        - CHAT "Tbanks so much! see you around!" 
        #This handy command will move the first script to Step 3.
        - ZAP 3 SCRIPT:StartFetch
        - CHAT "Tbanks so much! see you around!" 
        #Mark this script as completed.
        - FINISH
         - DISENGAGE
         - DISENGAGE
</pre>
</pre>

Revision as of 23:50, 14 September 2012

Example scripts are provided with both the assignments and the scripts in the same box. Be sure and put the text in the correct file in your plugins folder.

  • Assignments should always be appended to plugins\Denizen\assignments.yml
  • Scripts can be placed in any .yml file in the plugins\Denizen\scripts\ directory



Joe the Builder

This is the script from the start-up kit. It's 2 interact scripts assigned to 1 Denizen named Steve. He will respond different to a right-click by a player depending on whether or not the player has the modifyworld.* permission.

Basic Repeatable Fetch Quest

Here is the fastest way to do a repeatable 'fetch' quest. Useful for custom crafting-type NPCs. Once the player agrees to help, he can turn in the items any time to receive the reward.

Basic Unrepeatable Fetch Quest

By adding 3 lines to the script above, it becomes un-repeatable.

The Race

Coach wants you to RUN, BOY! This script uses a TASK script and a Location trigger to make a timed race for the player. Good example of ZAP and RUNTASK/CANCELTASK command usage. Be sure and define a Location Bookmark called 'theTree' using the /denizen bookmark location command.