Builder/Builder and Denizen: Difference between revisions

From Citizens Wiki
(Created page with "==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 playe...")
 
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Joe the Builder==
Examples of things to do combining Denizen and 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.
== Continuous Rebuilding ==
{| class="wikitable collapsible collapsed"
If you want a builder to look busy and continuously rebuild and destroy a schematic, you would use a setup like this.
! Joe the Builder Script and Assignment
|-
| <pre>
---- assignments.yml ----
Denizens:                       
  'Steve':    #This is the name of the Denizen             
    Interact Scripts: #These are the assigned interact scripts. The number before the script is the priority.                     
      - 0 Regular Joe
      - 10 ^Joe the Builder 


Create a Task script in any yml file the denizen scripts folder like the following.


<pre>
---- script.yml ----
---- script.yml ----
'Regular Joe':
Rebuild:
   Type: Interact 
   Type: Task
   Requirements: #There is no list of requirements, so this script can always be picked. That's why we assign it with low priority.
   Script:
     Mode: None
     - execute as_npc "builder <npc.id> build excavate oncomplete:Rebuild"
  Steps:
    1:
      Click Trigger:
        Script:  #This sends a basic message to the interacting player.
        - CHAT "Hello <PLAYER>! I supply builders only!" 
      Proximity Trigger:
        Script:  #This sends a basic message to the player when he walks near.
        - CHAT "Hello <PLAYER>! Welcome to <WORLD>!" 
       
'Joe the Builder':
  Type: Interact 
  Requirements:
    Mode: All
    List: #Here we check if the player has this permission. If he does, this script is selected because it is higher priority.
    - PERMISSION modifyworld.
  Steps:
    1:
      Click Trigger:
        Script:
        - ENGAGE 
        #Engage prevents all interaction with this NPC until DISENGAGE is called.
        - CHAT "Hello <PLAYER> the Builder! Take this shovel!"
        - GIVE WOOD_SPADE
        - WAIT 1     
        - CHAT "If you have any questions, just say 'help'"
        - FINISH
        #This increments the number of times this script (Joe The Builder) has been completed by this player.
        - DISENGAGE 
        #This sets the NPC Interactable again.
      Chat Trigger: #There can be multiple entries under a Chat Trigger or Location Trigger node. Hence the 1: on the next line.
        1:
          Trigger: I need some /help/
          Script:
          - CHAT "Press 'e' to open your inventory, and drag the shovel to your item bar"
          - CHAT "Press the number 1-9 to select the shovel, then start digging!"
</pre>
</pre>
|}
 
Now create a builder, load the desired schematic, set an origin, and call ''/builder build oncomplete:Rebuild''
 
The builder will build the schematic, and then run the task, which will build it again with the ''excavate'' option that will tear it down first, and the cycle will continue forever.
 
You can use this script for as many builders/schematics you want without having to change anything.

Latest revision as of 02:10, 9 August 2013

Examples of things to do combining Denizen and Builder

Continuous Rebuilding

If you want a builder to look busy and continuously rebuild and destroy a schematic, you would use a setup like this.

Create a Task script in any yml file the denizen scripts folder like the following.

---- script.yml ----
Rebuild:
  Type: Task
  Script:
    - execute as_npc "builder <npc.id> build excavate oncomplete:Rebuild"

Now create a builder, load the desired schematic, set an origin, and call /builder build oncomplete:Rebuild

The builder will build the schematic, and then run the task, which will build it again with the excavate option that will tear it down first, and the cycle will continue forever.

You can use this script for as many builders/schematics you want without having to change anything.