Peace Keeper


Author: jstmemage
Created: 2013-06-10T03:18:13-0400
Edited: 2014-01-09T23:25:43-0500
Denizen Version: 0.8.8
Views: 54
Downloads: 1283
Likes: 2


WGET
Description: This is a script that I run on a few of my NPC guards so that they check to see if you are walking around with a weapon and if so they will warn you and attack, else (see what I did there?) welcome you to town.

#
#
# This is my script I run on the guards for my servers spawn city welcoming players to the city
# if they are not bearing a weapon.
# This Script is supposed to be placed on a Sentry type NPC
# Author [email protected]
# Creation Date 6/10/2013
# Version Denizen 0.8.8
#

"PeaceKeeper":

    type: assignment
    
    default constants:
        # Name of the Town used for NPC text option.
        town: Havengard
        # List of all weapon ID numbers used in the script for guard recognition
        weapons: 267|268|272|276|283|271|275|258|279|286|261
        
    interact scripts:
    - 10 Peace Keeper
    
    actions:
        on assignment:
        # These are the basic triggers used in most NPC's.
        - trigger name:chat toggle:true
        - trigger name:click toggle:true
        - trigger name:proximity toggle:true
        
"Peace Keeper":
    
    type: interact
    
    steps:
    # This step is a Jumping off point for ways the NPC interacts with you. By placing different types of triggers
    # inside of the steps it can be a way to make One character more varried.
        '1':
            proximity trigger:
                entry:
                    script:
                    # When a player enters the Proximity Range it will fire a script located lower down.
                    - runtask "script:welcome check"
                    
            click trigger:
                script:
                - random 4
                - chat "Good Day <player.name>."
                - chat "Hello."
                - chat "Is everything alright?"
                - chat "<player.name> can I help you?
 
#
#
# This is the start of the task script section for the weapons check.
#
#
"welcome check":
    type: task
    script:
    # In this section the NPC uses the constant list of weapons to identify if a player is armed and then runs another set of scripts containing a warning.
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:warning"
        else runtask "script:welcome"
 
#
# Here is the welcome that you would recieve if you do not have a weapon when approaching the NPC.
#
"welcome":
    type: task
    script:
    - random 5
    - chat "Welcome to <cons:town> <player.name>."
    - chat "<cons:town> welcomes you <player.name>."
    - chat "<cons:town> is a peaceful place, please keep it that way."
    - chat "<player.name> are you enjoying <cons:town>?"
    - chat "Welcome <player.name>."
 
#
# This is the alternate welcome you recieve if you put away a weapon that was held when approached
#
"thank":
    type: task
    script:
    - random 3
    - chat "Thank you and Welcome to <cons:town>."
    - chat "<cons:town> thanks you for your compliance."
    - chat "I appreciate your honor <player.name>."
 
#
# This script is the start of the warning you get for having a weapon.
#
"warning":
    type: task
    script:
    - chat "<player.name> be warned, <cons:town> does not allow weapons in the streets."
    - wait 1
    - chat "You have 5 seconds to put it away."
    - runtask "script:5"
 
"5":
    type: task
    script:
    - chat "5"
    - wait 1
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:4"
        else runtask "script:thank"
 
"4":
    type: task
    script:
    - chat "4"
    - wait 1
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:3"
        else runtask "script:thank"
 
"3":
    type: task
    script:
    - chat "3"
    - wait 1
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:2"
        else runtask "script:thank"
 
"2":
    type: task
    script:
    - chat "2"
    - wait 1
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:1"
        else runtask "script:thank"
 
"1":
    type: task
    script:
    - chat "1"
    - wait 1
    - if <cons:weapons> contains <player.item_in_hand.id> runtask "script:0"
        else runtask "script:thank"
 
"0":
    type: task
    script:
    - chat "Have at thee!"
    - attack




Comments
2013-06-11 05:44:14 - jstmemage:

I would like to Thank Mythanical for his awesome scripts, they enabled me to write this one.
2013-08-05 06:02:39 - auron117:

Hey so i set this using /npc create PeaceKeeper --trait Denizen. Then /npc assign --set Peackeeper. and it worked but the skin would not change from steve. So i fiddled a bit tried reloading scripts and i got the skin to change however i could not assign Peacekeeper script to make him into the guard. So i reloaded the script completly by redownloading it and now the skin wont change again. Any sugestions.. Thanks
2013-08-06 14:04:19 - mythanical:

jstmemage, no problem man, glad it was of use!
2013-08-06 14:09:58 - mythanical:

auron117 - the NPC name determines the skin of the NPC. So, if you created an NPC and gave it your name, it'll retrieve the same skin you've currently got. If you use my name, it'll have my skin and so on. Go to "mcskinsearch.com", sort from Old to New, and find a good skin and name combination you like and use that. To get this to work, create the NPC with "/npc create Peacekeeper". Then type in "/npc assign --set "PeaceKeeper"". That should be all there is to it.
2013-08-06 14:11:51 - mythanical:

On mcskinsearch.com, click the button at the bottom to go to the last page and work your way forward. Go for oldest first because those are least likely to change. Names are CASE SENSITIVE.