Description: Hall Monitor is a customizable 'Hallway BOUNCER' script for Denizen 0.8.4
When set inside of a hallway, players cannot pass the NPC, they will be
'bounced' to an Anchor instead. To set up a hall monitor, simply spawn
an new npc and make two anchored positions.
Example: /npc anchor --save position (while standing in the desired location)
POSITION should be the 'guarding location' of the NPC
ENTRANCE should be where the player is kicked to if attempting to entry.
Note: If desired, the locations can be configured differently by constants.
Once the anchors are in place, use:
/npc assignment --set "hall monitor"
Thats it!
# Hall Monitor is a customizable 'Hallway BOUNCER' script for Denizen 0.8.4## When set inside of a hallway, players cannot pass the NPC, they will be# 'bounced' to an Anchor instead. To set up a hall monitor, simply spawn# an new npc and make two anchored positions.# Example: /npc anchor --save position (while standing in the desired location)# POSITION should be the 'guarding location' of the NPC# ENTRANCE should be where the player is kicked to if attempting to entry.## Note: If desired, the locations can be configured differently by constants.## Once the anchors are in place, use:# /npc assignment --set "hall monitor"# Thats it!# # @version 1.0.3# @author aufdemrand# @last-updated Jan 14 2013
"Hall Monitor":
type: assignment
default constants:
# Customizable texts. Contained here is what the NPC says in the # process of 'Bouncing.' Remember: These can be customized # per-npc by using the CONSTANTS command.# Example: /npc cons --set "Grave Consequences" --value "Now DIE!"
No Strangers Allowed 1: 'Members only, son.'
No Strangers Allowed 2: 'Turn around, or prepare to be bruised!'
Grave Consequences: 'I told you!'
Paid Consequences Narration: '<red>OUCH! <white>That hurt!'
Busted Sneaking: "<npc.name.nickname> shouts to you 'You thought you could get by? Hah!'"
Proximity Exit Narration: "<npc.name.nickname> shouts at you, 'You need an invitation! Don't come back until then!"# This NPC has some 'variables' that it uses for mechanics that# can be adjusted for optimal performance in different situations.
Guarding Position: <anchor:position>
Bounce To Position: <anchor:entrance>
Bounced Effect: blindness
Bounced Effect Duration: 8s
Guarding Radius: 4
Cooldown: 0.5s
# STOP!# # Unless you are doing some extra-ordinary customizing to this # script, which is definitely not discouraged in any way, there's # no need to modify anything beyond this point. The rest of the # script uses the information set in the Constants. Have fun!
interact scripts:
- 10 hall_mon Members Only
actions:
on spawn:
- runtask 'script:hall_mon Init' instant
on assignment:
- if '<cons:Guarding Position>' matches location
&& '<cons:Bounce To Position>' matches location
&& '<cons:Guarding Radius>' matches integer
&& '<cons:Cooldown>' matches duration
runtask 'script:hall_mon Init' instant
else runtask 'script:hall_mon Invalid Init' instant
- if <flag.n:loaded> true
narrate "Hall Monitor '<npc.name>' is ready to go!"# Configures the proximity trait, and teleports npc into guarding position upon 'initialization'
"hall_mon Init":
type: task
script:
- teleport npc 'location:<cons:Guarding Position>'
- trigger name:proximity toggle:true cooldown:<cons:Cooldown> 'radius:<cons:Guarding Radius>'
- flag npc loaded:true
# Called when a required constant is not int the correct format. Unassigns the assignment script# from the NPC and provides a little feedback.
"hall_mon Invalid Init":
type: task
script:
- narrate "<red>[X] <white>Oh no! Hallway monitor failed to initialize, perhaps some constants
are invalid? Check your configuration and try again. Use the command <green>/denizen --script
'hall monitor' -i<white> for more information."
- narrate "<red>Assignment removed."
- assignment remove
- flag npc loaded:false
# Provides the bouncing functionality through the use of a proximity trigger.
"hall_mon Members Only":
type: interact
steps:
'Bounce*':
proximity trigger:
entry:
radius: 4
script:
- ^follow
- ^flag npc in_pursuit:true duration:10s
- chat '<cons:No Strangers Allowed 1>'
- chat '<cons:No Strangers Allowed 2>'
- ^runtask 'script:hall_mon Bounced' delay:1 queue:<player.name>_bounced
exit:
radius: 4
script:
- ^narrate '<cons:Proximity Exit Narration>'
- ^follow stop
- ^teleport npc 'location:<cons:Guarding Position>'
# Task script that does the actual 'bouncing', keeps the proximity trigger
"hall_mon Bounced":
type: task
script:
- chat '<cons:Grave Consequences>'
- ^playsound sound:hurt location:<player.location>
- ^cast blindness duration:10s target:player
- ^narrate '<cons:Paid Consequences Narration>'
- ^follow stop
- ^teleport npc 'location:<cons:Guarding Position>'
- ^teleport location:<anchor:entrance>
I couldn't get this to work until I removed the "on assignment" section, assigned the script, then re-added the "on assignment" section. Also the - cast blindness command doesn't work unless the end is changed to "target:". Works great afterwards... Awesome script Auf.
I couldn't get this to work until I removed the "on assignment" section, assigned the script, then re-added the "on assignment" section. Also the - cast blindness command doesn't work unless the end is changed to "target: