BarkeepNPC
Author: PrimerBlock
Created: 2013-08-27T16:03:46-0400
Edited: 2014-01-29T23:02:49-0500
Denizen Version: 0.9.4
Views: 46
Downloads: 1413
Likes: 3
Description: Basically still working on this script but it is working on my server so I thought I would post it.
Next I intend to add a quest to the script.
Edited to run using the current version of Denizen 0.9.4-SNAPSHOT (build 1438)
# The barkeep will sell a player a selection of bar drinks and food from
# the bar menu of which each have a different effect on the player, but
# there is a limit to the number of drinks the player can consume. When
# the drink limit has been reached the player will become violently ill
# and will lose reputation.
# After buying an item from the bar the player can tip the barkeep and
# earn some reputation.
# The bartender can be attacked and will attack back, and after a short
# period of time the bartender will cool off.
# If the barkeep is killed he will respawn, attack the player, and
# the player will lose reputation.
# If the player is killed the barkeep will cool off.
# Use the NPC name "BarkeepNPC" if you want it has a bartender skin.
# I created it for this script or any other bartender script.
# Barkeep
#
# The barkeep will sell a player a selection of bar drinks and food from
# the bar menu of which each have a different effect on the player, but
# there is a limit to the number of drinks the player can consume. When
# the drink limit has been reached the player will become violently ill
# and will lose reputation.
# After buying an item from the bar the player can tip the barkeep and
# earn some reputation.
# The bartender can be attacked and will attack back, and after a short
# period of time the bartender will cool off.
# If the barkeep is killed he will respawn, attack the player, and
# the player will lose reputation.
# If the player is killed the barkeep will cool off.
# Use the NPC name "BarkeepNPC" if you want it has a bartender skin.
# I created it for this script or any other bartender script.
#
# Todo
# - Maybe refuse to serve people if they are below a certain rep.
# DONE - Add an option for the barkeep to describe the menu items.
# - If the player has high enough reputation a quest will be opened.
# - Create a questing option if the player tips the barkeep, maybe search
# for menu ingredients
# - Randomize the quests
# DONE (but need to test further) - Engage and disengage NPC during attack. Makes no sense to be
# attacking and serving drinks.
#
#
# Date Aug10-2013
# Author: PrimerBlock
#
# Attacking timeouts
# Player damages NPC - NPC attacks for 60 seconds
# Player kills NPC - NPC responds and attacks for 3600 seconds (1 hour)
# Player damages NPC and runs away - NPC - NPC attacks for 60 seconds
"The Bar Keep":
type: assignment
interact scripts:
- 10 First visit to the barkeep
- 20 Welcome back to the bar
- 30 Describe a menu item
- 40 Buy a bar item
- 50 Barkeep on the attack
default constants:
# This is the starting point for the NPC
# set it with the command /npc anchor --save BarkeepStart
BarkeepStart: <anchor:BarkeepStart>
DrinkLimit: 6
DrinkLimitWarn: 4
BarName: "The Blue Squirrel"
NPCclr: "<blue>"
# Change this to whatever you want to sell as a drink item 5 is food
# Remember you can use constants to change per-npc
# /npc cons --set "MenuItem1" --value "Squirrel Blood"
MenuItem1: "Zombie Mead"
MenuItem1Price: 50
MenuItem1Desc: "Zombie Mead is a jigger of fermented zombie drool poured into a dirty glass."
MenuItem2: "Apple Cider"
MenuItem2Price: 25
MenuItem2Desc: "Apple Cider contains freshly pressed digital apples. It may have side effects!"
MenuItem3: "Squid Juice"
MenuItem3Price: 40
MenuItem3Desc: "Squid ink topped with a layer of milled coco beans. Yum!"
MenuItem4: "Squirrel Milk"
MenuItem4Price: 30
MenuItem4Desc: "Fresh squirrel milk shaken with a dollop of fermented spider eye jelly over ice. It<&sq>s a house specialty"
MenuItem5: "Ham Sandwich"
MenuItem5Price: 60
MenuItem5Desc: "Zombie Pigman flank, thinly sliced on freshly baked bread."
actions:
on assignment:
- if '<cons:BarkeepStart>' matches location
runtask "script:Barkeep Init" instant
else runtask 'script:Template Invalid Init' instant
- if <flag.n:loaded> true
narrate "NPC Template '<npc.name>' is ready to go!"
on assignment:
- runtask "script:Barkeep Init" instant
on spawn:
- runtask "script:Barkeep Init" instant
on death:
# This statement checks to see if the reputation.yml script is running
# if it is the task Halve Rep can be run otherwise it just prints a message.
# note - Halve Rep is a task in reputation.yml
- if <global.flag[reputation]> != null ^runtask "script:Halve Rep"
else chat "<red>I will have my revenge!"
# Change AttackedTheBarkeep to a longer number here later like an hour or several hours
- ^flag player "AttackedTheBarkeep:true" duration:900
- ^execute as_server "denizen save"
- random 3
- chat "<red>Arrgghhh!"
- chat "<red>Blood on my best shirt!"
- chat "<red>I<&sq>ll kill ya for that!"
on damage:
- ^engage
- ^random 3
- chat "<red>Are you looking for a fight?"
- chat "<red>I<&sq>m going to take you out!"
- chat "<red>You have messed with the wrong guy buddy!"
# Change AttackedTheBarkeep to a longer number here later like an hour or several hours
- ^flag player "AttackedTheBarkeep:true" duration:60
- ^equip hand:276:20 chest:315 boots:317 head:314 legs:317
- ^attack
on exit proximity:
- ^disengage
- walkto location:<cons:BarkeepStart> speed:1.2
"First visit to the barkeep":
type: interact
requirements:
Mode: All
List:
- -flagged player "BarVisited:true"
- -flagged player "AttackedTheBarkeep:true"
steps:
'WelcomeFirstVisitToBar*':
click trigger:
script:
- chat "<cons:NPCclr>I don<&sq>t think I have seen you in here before."
- narrate "<cons:NPCclr>Well, welcome visitor to the <blue><cons:BarName><cons:NPCclr>. What will ya have today?"
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
- flag player "BarVisited:true"
proximity trigger:
entry radius: 6
entry:
script:
- random 3
- chat "<cons:NPCclr>Welcome, come on in!"
- chat "<cons:NPCclr>We<&sq>re open, have a seat."
- chat "<cons:NPCclr>Welcome visitor, best grub in town."
- ^attack stop
- ^disengage
"Welcome back to the bar":
type: interact
requirements:
Mode: All
List:
- flagged player "BarVisited:true"
- -flagged player "AttackedTheBarkeep:true"
steps:
'VisitingTheBarkeep*':
click trigger:
script:
- random 6
- chat "<cons:NPCclr>What can I do ya?"
- chat "<cons:NPCclr>How<&sq>s it going?"
- chat "<cons:NPCclr>Lil<&sq> hair o<&sq> the squirrel?"
- chat "<cons:NPCclr>Hey <light_purple><player.name><cons:NPCclr>! What will ya have?"
- chat "<cons:NPCclr>I don<&sq>t think I<&sq>ve seen you in here before??? Ah, I<&sq>m kidding <light_purple><player.name><cons:NPCclr>. I know who you are."
- chat "<cons:NPCclr>How<&sq>s it going <light_purple><player.name><cons:NPCclr>? What will you have today?"
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
proximity trigger:
entry radius: 6
exit radius: 9
entry:
script:
- lookclose toggle:true
- random 3
- chat "<cons:NPCclr>Hey <light_purple><player.name><cons:NPCclr>, come on in!"
- chat "<cons:NPCclr>Have a seat <light_purple><player.name><cons:NPCclr>."
- chat "<cons:NPCclr>Welcome back <light_purple><player.name><cons:NPCclr>."
exit:
script:
- random 3
- chat "<cons:NPCclr>See you later <light_purple><player.name><cons:NPCclr>."
- chat "<cons:NPCclr>Good seeing ya <light_purple><player.name><cons:NPCclr>."
- chat "<cons:NPCclr>Take it easy <light_purple><player.name><cons:NPCclr>."
- lookclose toggle:false
- flag player BuyABarItem:!
- flag player barkeepTip:!
- flag player TotalBarTab:!
- walkto location:<cons:BarkeepStart>
chat trigger:
'bar menu':
trigger: "What<&sq>s on the /menu/?"
script:
- chat "<cons:NPCclr>Here have a look."
- runtask "script:Bar Menu"
- chat "<cons:NPCclr>Let me know when you want to <light_purple>buy <cons:NPCclr>a menu item."
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
'buy from bar':
trigger: "I<&sq>m ready to /buy/ from the menu."
script:
- chat "<cons:NPCclr>Sure, just choose from the menu."
- runtask "script:Bar Menu"
- narrate "<dark_gray><&lb>Hint <&co> 1 - 5<&rb>"
- flag player "BuyABarItem:true" duration:300
'describe menu items':
trigger: "Can you /describe/ one of the menu items for me?"
script:
- chat "<cons:NPCclr>OK, just tell me the item number you want to know more about."
- runtask "script:Bar Menu"
- narrate "<dark_gray><&lb>Hint <&co> 1 - 5<&rb>"
- flag player "DescribeBarMenuItem:true" duration:300
'tip barkeep':
trigger: "Thanks for the service! Here<&sq>s a /tip/ for you."
script:
- if <flag.p:TotalBarTab> == true runtask "script:Calc Bar Tip"
- if !<flag.p:TotalBarTab.asint> == true narrate "<red>You need to buy something before you tip. If you walked away before leaving a tip your bar tab total was forgotten."
else if <player.money.asint> <= 0 narrate "<red>Oops! Your broke, you don<&sq>t have enough <player.money.currency> to leave a tip!"
else if <player.money.asint> < <flag.p:barkeepTip.asint> narrate "<red>Nice gesture, but your broke. You only have <player.money> <player.money.currency>.
else runtask "script:Give a tip to the barkeep"
## Working on enabling the barkeep to search for and use a chest as an ice-chest to pull drinks from.
## I think this may be too resource intensive so the search should be a one time event such as when assigning the script.
'What is your location Barkeep':
trigger: "What is your /location/ barkeep?"
script:
- narrate "<red> Debug code... remove before release"
- chat "My starting point is <blue><cons:BarkeepStart>"
- walkto location:<cons:BarkeepStart>
# standing_on now show location instead of materials
#- chat "I<&sq>m standing on <blue><npc.location.standing_on>"
- chat "I<&sq>m standing at <blue><npc.location>"
- chat "I<&sq>m standing at X <blue><npc.location.x.asint>"
- chat "I<&sq>m standing at Y <blue><npc.location.y.asint>"
- chat "I<&sq>m standing at Z <blue><npc.location.z.asint>"
- chat "<blue><util.substr[<thisisatest>].from[1].to[4]>"
- chat "I<&sq>m standing in world <blue><npc.location.world.name>"
#- chat "<blue><location.block.below>"
#- chat "<blue><location.find.blocks[54].within[5]>"
#- chat "<blue><location.block.54>"
#- chat "<location.block.x>"
- chat "Barkeep is standing on material <blue><location[<cons:BarkeepStart>].block.material>"
'I cant understand you':
trigger: /REGEX:\w+/
script:
- chat "<cons:NPCclr>Sorry, I don<&sq>t understand <white><player.chat_history><cons:NPCclr>. Why don<&sq>t you just <gold>buy <cons:NPCclr>something?"
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
"Calc Bar Tip":
type: task
script:
- flag player barkeepTip:<flag.p:TotalBarTab>
- flag player barkeepTip:*:0.1
"Describe a menu item":
type: interact
requirements:
mode: all
list:
- flagged player "BarVisited:true"
- flagged player "DescribeBarMenuItem:true"
steps:
'BarkeepDescribesItems*':
click trigger:
script:
- chat "<cons:NPCclr><player.name> just tell me what item you want to know more about."
- runtask "script:Bar Menu"
- narrate "<dark_gray><&lb>Hint <&co> 1 - 5<&rb>"
chat trigger:
'Menu Item 1':
trigger: "What is in item /1/?"
script:
- chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem1Desc>"
- ^flag player "DescribeBarMenuItem:!"
'Menu Item 2':
trigger: "Number /2/ looks good. Tell me about it?"
script:
- chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem2Desc>"
- ^flag player "DescribeBarMenuItem:!"
'Menu Item 3':
trigger: "Item /3/, <cons:MenuItem3>"
script:
- chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem3Desc>"
- ^flag player "DescribeBarMenuItem:!"
'Menu Item 4':
trigger: "Item /4/ looks interesting."
script:
- chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem4Desc>"
- ^flag player "DescribeBarMenuItem:!"
'Menu Item 5':
trigger: "What is item /5/?"
script:
- chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem5Desc>"
- ^flag player "DescribeBarMenuItem:!"
'We dont serve that':
trigger: /REGEX:\w+/
script:
- chat "<cons:NPCclr>Sorry, we don<&sq>t serve <white><player.chat_history><cons:NPCclr>."
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
- ^flag player "DescribeBarMenuItem:!"
"Buy a bar item":
type: interact
requirements:
Mode: All
List:
- flagged player "BarVisited:true"
- flagged player "BuyABarItem:true"
steps:
'OrderFromTheBarMenu*':
click trigger:
script:
- chat "<cons:NPCclr>You didn<&sq>t get a menu? Well, here you go <player.name>."
- runtask "script:Bar Menu"
- narrate "<dark_gray><&lb>Hint <&co> 1 - 5<&rb>"
chat trigger:
'Menu Item 1':
trigger: I<&sq>ll have a number /1/ <cons:MenuItem1> for <cons:MenuItem1Price> <player.money.currency>
script:
- ^flag player BarItemPrice:<cons:MenuItem1Price> duration:300
- ^flag player BarItemName:<cons:MenuItem1> duration:300
- ^flag player DrinkEffect:->:confusion
- ^flag player DrinkEffect:->:hunger
- ^flag player DrinkEffect:->:night_vision
- ^if <player.money> > <cons:MenuItem1Price> runtask script:CompleteMenuDrinkOrder
else if <player.money> = <cons:MenuItem1Price> runtask script:CompleteMenuDrinkOrder
else chat "<red>You don<&sq>t have enough for <cons:MenuItem1>. You need <cons:MenuItem1Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
- ^flag player "BarItemPrice:!"
- ^flag player "BarFoodItem:!"
- ^flag player "BarItemName:!"
- ^flag player "DrinkEffect:!"
- chat "<cons:NPCclr>Do you want anything else?"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
'Menu Item 2':
trigger: I<&sq>ll have a number /2/ <cons:MenuItem2> for <cons:MenuItem2Price> <player.money.currency>
script:
- flag player BarItemPrice:<cons:MenuItem2Price> duration:300
- flag player BarItemName:<cons:MenuItem2> duration:300
- flag player DrinkEffect:->:confusion
- flag player DrinkEffect:->:heal
- flag player DrinkEffect:->:blindness
- if <player.money> > <cons:MenuItem2Price> runtask script:CompleteMenuDrinkOrder
else if <player.money> = <cons:MenuItem2Price> runtask script:CompleteMenuDrinkOrder
else chat "<red>You don<&sq>t have enough for <cons:MenuItem2>. You need <cons:MenuItem2Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
- ^flag player "BarItemPrice:!"
- ^flag player "BarFoodItem:!"
- ^flag player "BarItemName:!"
- ^flag player "DrinkEffect:!"
- chat "<cons:NPCclr>Do you want anything else?"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
'Menu Item 3':
trigger: I<&sq>ll have a number /3/ <cons:MenuItem3> for <cons:MenuItem3Price> <player.money.currency>
script:
- flag player BarItemPrice:<cons:MenuItem3Price> duration:300
- flag player BarItemName:<cons:MenuItem3> duration:300
- flag player DrinkEffect:->:confusion
- flag player DrinkEffect:->:heal
- flag player DrinkEffect:->:poison
- if <player.money> > <cons:MenuItem3Price> runtask script:CompleteMenuDrinkOrder
else if <player.money> = <cons:MenuItem3Price> runtask script:CompleteMenuDrinkOrder
else chat "<red>You don<&sq>t have enough for <cons:MenuItem3>. You need <cons:MenuItem3Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
- ^flag player "BarItemPrice:!"
- ^flag player "BarFoodItem:!"
- ^flag player "BarItemName:!"
- ^flag player "DrinkEffect:!"
- chat "<cons:NPCclr>Do you want anything else?"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
'Menu Item 4':
trigger: I<&sq>ll have a number /4/ <cons:MenuItem4> for <cons:MenuItem4Price> <player.money.currency>
script:
- flag player BarItemPrice:<cons:MenuItem4Price> duration:300
- flag player BarItemName:<cons:MenuItem4> duration:300
- flag player DrinkEffect:->:confusion
- flag player DrinkEffect:->:jump
- flag player DrinkEffect:->:regeneration
- if <player.money> > <cons:MenuItem4Price> runtask script:CompleteMenuDrinkOrder
else if <player.money> = <cons:MenuItem4Price> runtask script:CompleteMenuDrinkOrder
else chat "<red>You don<&sq>t have enough for <cons:MenuItem4>. You need <cons:MenuItem4Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
- ^flag player "BarItemPrice:!"
- ^flag player "BarFoodItem:!"
- ^flag player "BarItemName:!"
- ^flag player "DrinkEffect:!"
- chat "<cons:NPCclr>Do you want anything else?"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
'Menu Item 5':
trigger: I<&sq>ll have a number /5/ - <cons:MenuItem5> for <cons:MenuItem5Price> <player.money.currency>
script:
- flag player BarItemPrice:<cons:MenuItem5Price> duration:300
- flag player BarItemName:<cons:MenuItem5> duration:300
- flag player BarFoodItem:->:320 duration:300
- flag player BarFoodItem:->:297 duration:300
- if <player.money> > <cons:MenuItem5Price> runtask script:CompleteMenuFoodOrder
else if <player.money> = <cons:MenuItem5Price> runtask script:CompleteMenuFoodOrder
else chat "<red>You don<&sq>t have enough for <cons:MenuItem5>. You need <cons:MenuItem5Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
- flag player "BarItemPrice:!"
- ^flag player "BarFoodItem:!"
- ^flag player "BarItemName:!"
- chat "<cons:NPCclr>Do you want anything else?"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
'Still ordering from the bar':
trigger: "/Yes/, I want something else from the menu."
script:
- chat "<cons:NPCclr>OK, here you go."
- runtask "script:Bar Menu"
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
'Im done ordering from the bar':
trigger: /no/
script:
- equip HAND item:0
- flag player "BuyABarItem:!"
- chat "<cons:NPCclr>OK just let me know when you are ready"
- narrate "<dark_gray><&lb>Hint <&co> menu, describe, buy<&rb>"
- ^zap "step:VisitingTheBarkeep" "script:Welcome back to the bar"
'Cant order that from the menu':
trigger: /REGEX:\w+/
script:
- chat "<cons:NPCclr>Sorry, I don<&sq>t have <white><player.chat_history><cons:NPCclr> on the menu."
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
'tip barkeep':
trigger: "Thanks for the service! Here<&sq>s a /tip/ for you."
script:
- flag player barkeepTip:<flag.p:TotalBarTab>
- flag player barkeepTip:*:0.1
# need to first determine if player bought anything and check that they have enough money to tip
- if <flag.p:TotalBarTab.asint> >= 0 && <player.money.asint> >= <flag.p:barkeepTip.asint> runtask "script:Give a tip to the barkeep"
else narrate "<red>Oops! you don<&sq>t have enough <player.money.currency> or you have not bought anything yet. Try buying something first."
# later this may be replaced with paying bar tab script
- narrate "<dark_gray><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
"Give a tip to the barkeep":
type: task
script:
- chat "<cons:NPCclr>Hey thanks!"
- ^narrate "Current bar tab paid<&co> <flag.p:TotalBarTab> <player.money.currency>."
- ^narrate "Tip given to <npc.name><&co> <flag.p:barkeepTip> <player.money.currency>. <gold>Your rep has gone up!"
- flag player TotalBarTab:!
- flag player barkeepTip:!
- flag player reputation:+:1
- execute as_server "denizen save"
"Barracho":
type: task
script:
- chat "<red>Hey buddy! You<&sq>re turning <dark_green>green<red>. Don<&sq>t get sick in here!"
- cast confusion
- narrate "<dark_green>You begin to feel violently ill as your stomach begins to turn!"
- cast blindness
- cast poison duration:10 power:1
- ^flag player reducedRep:<flag.p:reputation>
- ^flag player reducedRep:-:10
- ^if <flag.p:reputation.asint> <= 0 flag player reputation:0
else flag player reputation:<flag.p:reducedRep>
- narrate "<red>Getting <dark_green>sick <red>in public does not look good! You lost some reputation."
- ^execute as_server "denizen save"
"CompleteMenuFoodOrder":
type: task
script:
- equip hand:297
- chat "<cons:NPCclr>Here<&sq>s your <flag.p:BarItemName>."
- equip hand:0
- ^runtask 'loop through' "context:ServingBarFood|BarFoodItem|player"
- ^take money "qty:<flag.p:BarItemPrice>"
- ^narrate "<flag.p:BarItemPrice> <player.money.currency> have been removed from your account."
- ^flag player TotalBarTab:+:<flag.p:BarItemPrice>
- ^chat "Item Price <flag.p:BarItemPrice>"
- ^narrate "Paid bar tab total<&co> <flag.p:TotalBarTab>"
"ServingBarFood":
type: task
context: yumbarfood
script:
- give item:<context.yumbarfood> qty:1
"CompleteMenuDrinkOrder":
type: task
script:
- equip hand:384
- wait 1
- chat "<cons:NPCclr>Here<&sq>s your <flag.p:BarItemName>."
- equip hand:374
- ^runtask 'loop through' "context:ServingBarDrink|DrinkEffect|player"
- ^take money "qty:<flag.p:BarItemPrice>"
- ^narrate "<flag.p:BarItemPrice> <player.money.currency> have been removed from your account."
- ^flag player TotalBarTab:+:<flag.p:BarItemPrice>
- ^flag player TotalDrinksConsumed:+:1 duration:3600
- ^if <flag.p:TotalDrinksConsumed.asint> >= <cons:DrinkLimit.asint> runtask "script:Barracho"
else if <flag.p:TotalDrinksConsumed.asint> >= <cons:DrinkLimitWarn.asint>
chat "<red>Are you getting sick? Maybe you should quit?"
else chat "<cons:NPCclr>Enjoy <player.name>."
"ServingBarDrink":
type: task
context: BarDrinkItem
script:
- cast <context.BarDrinkItem> duration:20 power:1
"Bar Menu":
type: task
script:
- ^narrate "<light_purple><cons:BarName> Menu"
- ^narrate "<green>=========================="
- ^narrate "<light_purple>1<cons:NPCclr> - <cons:MenuItem1> -- <gold><cons:MenuItem1Price> <cons:NPCclr><player.money.currency>"
- ^narrate "<light_purple>2<cons:NPCclr> - <cons:MenuItem2> -- <gold><cons:MenuItem2Price> <cons:NPCclr><player.money.currency>"
- ^narrate "<light_purple>3<cons:NPCclr> - <cons:MenuItem3> -- <gold><cons:MenuItem3Price> <cons:NPCclr><player.money.currency>"
- ^narrate "<light_purple>4<cons:NPCclr> - <cons:MenuItem4> -- <gold><cons:MenuItem4Price> <cons:NPCclr><player.money.currency>"
- ^narrate "<light_purple>5<cons:NPCclr> - <cons:MenuItem5> -- <gold><cons:MenuItem5Price> <cons:NPCclr><player.money.currency>"
"Barkeep on the attack":
type: interact
requirements:
mode: ALL
list:
- flagged player AttackedTheBarkeep:true
steps:
'AngryBarkeep*':
proximity trigger:
entry radius: 5
exit radius: 6
entry:
script:
- engage
- random 3
- chat "<red>How dare you show your face around here <light_purple><player.name><red>!"
- chat "<red>I<&sq>ll kill you <light_purple><player.name><red>!"
- chat "<red>Do you think I am playing around? <light_purple><player.name><red>!"
- ^equip hand:276:20 chest:315 boots:317 head:314 legs:317
- attack
exit:
script:
- ^chat "<red>Ya better run <light_purple><player.name><red>!"
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
- ^disengage
- ^attack stop
- walkto location:<cons:BarkeepStart>
"Barkeep Init":
type: task
script:
- trigger name:chat toggle:true radius:5
- trigger name:click toggle:true radius:5
- trigger name:proximity toggle:true
- trigger name:damage toggle:true
- vulnerable toggle:true
- execute as_npc "npc select <npc.id>"
- execute as_npc "npc health --respawndelay 30s"
- health 50
- walkto location:<cons:BarkeepStart>
- ^equip hand:0 chest:0 boots:0 head:0 legs:0
"Barkeep Invalid Init":
type: task
script:
- narrate "<red>[X] <white>Oops! Barkeep failed to initialize<&cm> did you create the
anchors? Remember you need to create the NPC anchor before assigning the script.
Select the npc and run the following command at the location you want the NPC at<&co>
<green>/npc anchor --save BarkeepStart"
- narrate "<red>Assignment removed."
- assignment remove
- flag npc loaded:false
Well done. Seems to be working great! Didn't tell our players that he would fight back when we added the script in. So, it was a bit of a surprise for a few players, but they asked for it!
Thanks for the feedback. In the near future I want the Barkeep to be harder to kill or at least harder to kill progressively each time the Barkeep is killed. Currently, right now I can only set the health to 20 but in the next few Denizen updates that should be fixed.
@PrimerBlock # Should be able to set npc health to a larger number but keep getting errors! Use the command - health, not execute npc health EG: - health 50
Oh ew it deleted newlines... hopefully you can read that anyway...
mcmonkey - thanks added your fix a few months back, just tweaked it again to work on 0.9.4. Happy Barkeeping!
I have the barkeep running but no one can figure out how to see his menu and help?
Nm I had to re-log in to get a set at the bar lol My fault!
this breaking in later builds? getting a ton of errors when you leave the proximity, starting out by saying error in casino bar, constant tag is deprecated (use npc.constant[]) then it goes into a big dump of how "Tag 'anchor:BarkeepStart' is invalid!" thinking it just needs an update?