Upgradeable bodyguard
Author: Zer0HD
Created: 2013-02-14T17:01:32-0500
Edited: 2013-02-14T17:06:40-0500
Denizen Version: 0.7.6-FINAL
Views: 56
Downloads: 851
Likes: 1
Description: There are a few bugs in this, such as the fact that it seems every NPC with the same name gets flagged as already upgraded, but it's a very basic bodyguard upgrading script.
Also includes telling the bodyguard to stay, follow you and target a player.
If anyone has any improvements or suggestions, feel free to post them in the comments - this is only the first version.
NOTE: The three different money checking methods are unneeded, I know. I originally planned to have different prices to upgrade each stat and was too lazy to make a more efficient way.
MercenaryTarget:
Type: Interact
Requirements:
Mode: All
List:
- OWNER
Steps:
'1':
Click Trigger:
Script:
- ENGAGE DURATION:12
- CHAT "What do you need?"
- NARRATE "Say <RED>target<WHITE>, <RED>stay<WHITE>, <RED>follow<WHITE> or <RED>upgrade<WHITE>."
- ZAP 2
- ^DISENGAGE
'2':
Chat Trigger:
'1':
Trigger: I want you to add a new /target/.
Script:
- ENGAGE NOW
- CHAT "Who do you want me to target?"
- NARRATE "Type a <RED>player's name<WHITE> or <RED>cancel<WHITE>."
- ZAP 3
- ^DISENGAGE
'2':
Trigger: /Stay/ here and guard the area.
Script:
- ENGAGE NOW
- CHAT "Ok, I'll be here if you need me."
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry guard"
- ZAP 1
- ^DISENGAGE
'3':
Trigger: /Follow/ me.
Script:
- ENGAGE NOW
- CHAT "Alright, lead the way."
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry guard <PLAYER>"
- ZAP 1
- ^DISENGAGE
'4':
Trigger: I want you to /upgrade/.
Script:
- ENGAGE NOW
- CHAT "What do you want me to upgrade?"
- NARRATE "<RED>Strength<WHITE>, <RED>health<WHITE> or <RED>armour<WHITE>."
- FLAG "MercUpgrade"
- ZAP 4
- ^DISENGAGE
'3':
Chat Trigger:
'1':
Trigger: Target /*/ for me.
Script:
- ENGAGE NOW
- FLAG "PlayerTarget:<*>"
- CHAT "<FLAG.PLAYER:PlayerTarget>, eh? Alright, I'll keep an eye out for them."
- NARRATE "Your guard is now targetting <FLAG.PLAYER:PlayerTarget>"
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry target add PLAYER:<FLAG.PLAYER:PlayerTarget>"
- ZAP 1
- RESET FLAG:PlayerTarget
- ^DISENGAGE
'2':
Trigger: /Cancel/ that, keep your eyes open.
Script:
- ENGAGE NOW
- CHAT "Alright then."
- ZAP 1
- ^DISENGAGE
'4':
Chat Trigger:
'1':
Trigger: Upgrade your /armour/.
Script:
- ENGAGE NOW
- IF DENIZEN FLAG:MercArmourUpgraded 'SCRIPT:AlreadyUpgraded' ELSE 'SCRIPT:CheckMoneyAr'
- DISENGAGE
'2':
Trigger: Upgrade your /strength/.
Script:
- ENGAGE NOW
- IF DENIZEN FLAG:MercStrengthUpgraded 'SCRIPT:AlreadyUpgraded' ELSE 'SCRIPT:CheckMoneyStr'
- DISENGAGE
'3':
Trigger: Upgrade your /health/.
Script:
- ENGAGE NOW
- IF DENIZEN FLAG:MercHealthUpgraded 'SCRIPT:AlreadyUpgraded' ELSE 'SCRIPT:CheckMoneyHe'
- DISENGAGE
AlreadyUpgraded:
Type: Task
Script:
- ENGAGE NOW
- CHAT "I can't upgrade this any more, sorry"
- ZAP 1 'SCRIPT:MercenaryTarget'
- ^DISENGAGE
UpgradeArmour:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Give me a second here..."
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry armor 4"
- TAKE MONEY QTY:5000
- CHAT "Done! My armour is now upgraded!"
- RESET FLAG:MercUpgrade
- FLAG MercArmourUpgraded DENIZEN
- ZAP 1 'SCRIPT:MercenaryTarget'
- ^DISENGAGE
UpgradeHealth:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Give me a second here..."
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry health 60"
- TAKE MONEY QTY:5000
- CHAT "Done! My health is now upgraded!"
- RESET FLAG:MercUpgrade
- FLAG MercHealthUpgraded DENIZEN
- ZAP 1 'SCRIPT:MercenaryTarget'
- ^DISENGAGE
UpgradeStrength:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Give me a second here..."
- EXECUTE ASSERVER "npc select <NPCID>"
- EXECUTE ASSERVER "sentry strength 6"
- TAKE MONEY QTY:5000
- CHAT "Done! My strength is now upgraded!"
- RESET FLAG:MercUpgrade
- FLAG MercStrengthUpgraded DENIZEN
- ZAP 1 'SCRIPT:MercenaryTarget'
- ^DISENGAGE
CheckMoneyAr:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Alright, that'll be 5000 Gold..."
- FLAG 'CASH:<PLAYER.MONEY>' 'DURATION:30'
- IF 'FLAG:CASH:5000' 'SCRIPT:UpgradeArmour' ELSE 'SCRIPT:NotEnoughMoney'
- ^DISENGAGE
CheckMoneyStr:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Alright, that'll be 5000 Gold..."
- FLAG 'CASH:<PLAYER.MONEY>' 'DURATION:30'
- IF 'FLAG:CASH:5000' 'SCRIPT:UpgradeStrength' ELSE 'SCRIPT:NotEnoughMoney'
- ^DISENGAGE
CheckMoneyHe:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Alright, that'll be 5000 Gold..."
- FLAG 'CASH:<PLAYER.MONEY>' 'DURATION:30'
- IF 'FLAG:CASH:5000' 'SCRIPT:UpgradeHealth' ELSE 'SCRIPT:NotEnoughMoney'
- ^DISENGAGE
NotEnoughMoney:
Type: Task
Script:
- ENGAGE NOW
- CHAT "Sorry, you need at least 5000 Gold for me to do that"
- ZAP 1 'SCRIPT:MercenaryTarget'
- ^DISENGAGE