# Boss Fight / Event Organizer - 3 Events per NPC. # Citizens 2 (build #991) # Denizen 0.9.3 (build #1341) # # NOTE: Script may contain bugs. Let me know if you find any! # # To assign to an NPC, type: # /npc assign --set "Bossfight Organizer" # # Description: # # This script will allow an NPC to act as a middle-man for someone organizing players for an event. It is not the # event itself, in other words, it'll only take the players where they need to go as a group. You need to decide # where they get teleported to and how you trigger your own boss event. # # An Organizer (player) will need to assign themselves to an event and then other Players will be able to join in. # # The Organizer is automatically part of the event and will be teleported with the Players when the event is started. # Organizers and Players cannot belong to multiple events at the same time. # # Organizers can 'start' or 'cancel' their own event. When the Organizer uses the 'leave' command it also # cancels the event. # # Other Features: # * Set Min/Max group sizes # * OP's can 'Reset' or 'Lock' events. Reset will reset ALL events and Lock will allow OP to individually lock # specified events in case they are under construction. # * Events are automatically reset when the Organiser disconnects from the server, allowing new organisers # to take it over. # # Credit: The "Spleef Organizer" script by davidcernat was used as a template for this script. Thanks man! For this and # all the other help, bug fixes and new features you added for me. # # @author mythanical # @script version 1.1.2 # @last-updated October 23 2013 # @irc EsperNet IRC Network #denizen-dev # @Minecraft Server - minecraft.geek.nz # @Donate Bitcoin: 1Fzacc2gZ5NGRMXg5jWP6NcUkWei34xjzt # @Donate Litecoin: LhsaGa1QzmVLjMYwg4ZPTVnmSgnBDGc75U "Bossfight Organizer": type: assignment default constants: # Enter the Names of 3 Bosses on your Server Boss One Name: "Herobrine" Boss Two Name: "EnderDragon" Boss Three Name: "Aufdemrand" # This is purely for displaying a difficulty level next to each boss, it doesn't do anything other than that. Boss One Difficulty: "Easy" Boss Two Difficulty: "Hard" Boss Three Difficulty: "Insane" # Minimum number of players for each boss. Boss One Min Players: 2 Boss Two Min Players: 3 Boss Three Min Players: 6 # Maximum number of players for each boss. Boss One Max Players: 2 Boss Two Max Players: 7 Boss Three Max Players: 10 # These are the coordinates of where the Players will be teleported to for each event. Bossfight One Location: "106,64,296,world" Bossfight Two Location: "100,64,310,world" Bossfight Three Location: "61,68,329,world" actions: on assignment: # This enables interaction with NPC via clicking, chatting and entering/exiting proximity. - trigger name:chat toggle:true - trigger name:click toggle:true - trigger name:proximity toggle:true interact scripts: - 10 Bossfight Organizer Convo 'Bossfight Organizer Convo': type: interact steps: 'Organize*': proximity trigger: entry: script: # When player enters NPC proximity, run the specified script. - run "Bossfight General Chat" click trigger: script: # When the player clicks the NPC, run the specified script. - run "Bossfight Initiate Conversation" chat trigger: '1': trigger: "I want to /join/ a boss fight event." script: # There are 5 possibilities here, checked in sequence: # 1) Check if player is already an organizer for an event and tell them they can't join. # 2) Check if player already joined another event and tell them they can't join. # 3) Check if all events are locked, if so tell user to come back later. # 4) Check if any events are currently being organized, if not tell user to type 'organize'. # 5) Run a script asking them which event they would like to join, located much further down. - ^if "-Organizer]>" == narrate "You are the organizer of event '', you cannot join other events." else if "-Organizer]>" == narrate "You are the organizer of event '', you cannot join other events." else if "-Organizer]>" == narrate "You are the organizer of event '', you cannot join other events." else if "-Join].aslist>" contains narrate "You have already joined for event ''. You can only join one event at a time." else if "-Join].aslist>" contains narrate "You have already joined for event ''. You can only join one event at a time." else if "-Join].aslist>" contains narrate "You have already joined for event ''. You can only join one event at a time." else if "-Organizer]>" == "Locked" && "-Organizer]>" == "Locked" && "-Organizer]>" == "Locked" narrate "Sorry, all events are currently locked. Please come back later." else if "-Organizer]>" == null && "-Organizer]>" == null && "-Organizer]>" == null narrate "There are no events running. You will need to say 'organize' to create a new event for people to join." else run "Bossfight Join a Group" '2': trigger: "I would like to /leave/ a boss fight event." script: # There are 3 possibilities here # 1) If player is the organizer of an event, it will cancel the event and clear all participant flags. # 2) If player has joined an event, they will leave it and also clear participant flags used by the # 'player quits world event' to check if they are part of a group. # 3) Tell player they can't leave an event if they haven't joined one. - ^if -Organizer]> == { - announce "The boss event , organized by has been cancelled." - flag "-Organizer:!" - foreach "-Join].aslist>" { - flag %value% "BossFightJoined:!" - flag %value% "BossFightNPC:!" } - flag -Join:! - flag OrganizingBossFight:! } else if -Join].aslist> contains { - announce " has left the boss event for ''" - flag -Join:<-: - flag BossFightJoined:! - flag BossFightNPC:! } else narrate ", you cannot leave a group if you haven't joined one yet." '3': trigger: "Let's /start/." script: # There are 3 possibilities here # 1) If player is the organizer of an event and there are enough players, it will teleport the players to # the event and clear the event flags so a new one can be organised and also clear participant flags used by the # 'player quits world event' to check if they are part of a group. # 2) If player is the organizer and there aren't enough player, it will say what the current count and needed count is. # 3) Tell player they can't start an event unless they are the organizer. - ^if "-Organizer]>" == && "-Join].size>" >= "" { - announce "Teleporting players to the boss event ''." - narrate "5..." "targets:-Join].aslist>" - wait 1 - narrate "4..." "targets:-Join].aslist>" - wait 1 - narrate "3..." "targets:-Join].aslist>" - wait 1 - narrate "2..." "targets:-Join].aslist>" - wait 1 - narrate "1..." "targets:-Join].aslist>" - wait 1 - foreach "-Join].aslist>" { - teleport %value% "location:" - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Organizer:!" - flag "-Join:!" } else if "-Organizer]>" == && "-Join].size>" >= "" { - announce "Teleporting players to the boss event ''." - narrate "5..." "targets:-Join].aslist>" - wait 1 - narrate "4..." "targets:-Join].aslist>" - wait 1 - narrate "3..." "targets:-Join].aslist>" - wait 1 - narrate "2..." "targets:-Join].aslist>" - wait 1 - narrate "1..." "targets:-Join].aslist>" - wait 1 - foreach "-Join].aslist>" { - teleport %value% "location:" - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Organizer:!" - flag "-Join:!" } else if "-Organizer]>" == " && "-Join].size>" >= "" { - announce "Teleporting players to the boss event ''." - narrate "5..." "targets:-Join].aslist>" - wait 1 - narrate "4..." "targets:-Join].aslist>" - wait 1 - narrate "3..." "targets:-Join].aslist>" - wait 1 - narrate "2..." "targets:-Join].aslist>" - wait 1 - narrate "1..." "targets:-Join].aslist>" - wait 1 - foreach "-Join].aslist>" { - teleport %value% "location:" - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Organizer:!" - flag "-Join:!" } else if "-Organizer]>" == && "-Join].size>" < "" narrate "Not enough players to start event! -Join].size> of spots filled." else if "-Organizer]>" == && "-Join].size>" < "" narrate "Not enough players to start event! -Join].size> of spots filled." else if "-Organizer]>" == " && "-Join].size>" < "" narrate "Not enough players to start event! -Join].size> of spots filled." else narrate "Sorry , you cannot start an event unless you're the organizer of one." '4': trigger: "I want to /organize/ a boss fight." script: # There are 4 possibilities here # 1) If player is already the organizer of an event, tell them to leave that one first. # 2) If all events have been locked, tell player they are locked and to come back later. # 3) If all events are being organized, tell player they can't organize one right now. # 4) Run script asking them which boss to organize an event for - located much further down. - ^if -Organizer]> == narrate "You are already organizing the event for ''. Leave that one first before you create a new one." else if "-Organizer]>" == "Locked" && "-Organizer]>" == "Locked" && "-Organizer]>" == "Locked" narrate "Sorry, all events are currently locked. Please come back later." else if "-Organizer]>" != null && "-Organizer]>" != null && "-Organizer]>" != null narrate "Sorry, all events are currently being organized by other players. Please come back later." else run "Bossfight Organize a Boss" '5': trigger: "I want to /cancel/ a boss fight." script: # There are 2 possibilities here # 1) If player is the organizer of an event, it will cancel the event and clear all participant player flags. # 2) If player is not the organizer of any events, tell them they can't cancel. - ^if -Organizer]> == { - announce "The boss event , organized by has been cancelled." - flag -Organizer:! - foreach -Join].aslist> { - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag -Join:! - flag OrganizingBossFight:! } else narrate "You are not the organizer for any events and you cannot cancel events being organized by other players." '6': trigger: "I want to see the /events/ list." script: # This section simply shows which events have been booked, the organizer, # the number of players and the names of players that has joined for the event. # It uses a IF statements to figure out which information to return depending on the status of the event. # It decides on what to display depending on whether: # 1) the event has been locked # 2) the event has an organizer # 3) return a list of players if the event does have an organizer but it's not the organizer called 'Locked' - ^narrate "------------------------------------------------" - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^if "-Organizer]>" !contains null|Locked narrate " Players| -Join].formatted>" - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^if "-Organizer]>" !contains null|Locked narrate " Players| -Join].formatted>" - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^if "-Organizer]>" !contains null|Locked narrate " Players| -Join].formatted>" - ^narrate "------------------------------------------------" '7': trigger: "/reset/" script: # This is a hidden server OP feature that will reset all boss events and clear all flags. # When a player types this, it will check to see if they are an OP. If they are, it # will work through all 3 events, reset the NPC flags and also all the flags set # against the participants of the events. - ^if { - if "-Join].size>" >= 1 { - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } } - if "-Join].size>" >= 1 { - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } } - if "-Join].size>" >= 1 { - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } } - narrate "All Events Have Been Reset." - flag "-Join:!" - flag "-Organizer:!" - flag "-Join:!" - flag "-Organizer:!" - flag "-Join:!" - flag "-Organizer:!" } else narrate "You are not an OP, nice try." '8': trigger: "/lock/" script: # This is the hidden dialogue that shows if you are an OP and said 'lock' to the NPC. # It shows whether the event is 'locked' or not. It then zaps to the 'Lock Event' # step where its waiting for the OP to type in which boss they want to lock/unlock. - ^if { - ^narrate "Which event do you want to lock or unlock?" - ^narrate "Say<&co>" - if "-Organizer]>" == "Locked" narrate " - Locked" else narrate " - Unlocked" - if "-Organizer]>" == "Locked" narrate " - Locked" else narrate " - Unlocked" - if "-Organizer]>" == "Locked" narrate " - Locked" else narrate " - Unlocked" - ^zap "s@Bossfight Organizer Convo" "step:Lock Event" } else narrate "You are not an OP, nice try." '9': trigger: /REGEX:\w+/ # This is a catch-all trigger that will repeat what the player said if what they # typed didn't match any of the chat triggers above. script: - narrate "Sorry, I don't know what '' means." 'Create Group': chat trigger: 'Which Boss': trigger: I want to start a group for event '/REGEX:^\w+$/'. script: # There are 6 possibilities here # 1) If player is already the organizer of an event, tell them to leave that one first. # 2) If player has joined another event, tell them they can only be part of one event at a time. # 3) If the event has been locked by OP, tell player they can't create group because event is locked. # 4) If the event the player asked for is already being organized, tell them. # 5) If the event is available, create 2 flags on the NPC. One is to indicate this player is now the # the organizer and another to add them to the party. It'll create an additional 2 flags on the player which # is checked/used when they quit Minecraft to clear the event so other players can organise it. # 6) A catch-all telling player the NPC doesn't know what they said. - ^if != null narrate "You are already organizing the event for ''. Leave that one first before you create a new one." else if != null narrate "You have already joined for event ''. You can only partake in one event at a time." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Organizer]>" != null narrate "Sorry , but the boss fight event is already being organized by -Organizer]>." else if == "" && "-Organizer]>" != null narrate "Sorry , but the boss fight event is already being organized by -Organizer]>." else if == "" && "-Organizer]>" != null narrate "Sorry , but the boss fight event is already being organized by -Organizer]>." else if == "" { - flag "-Organizer:" - flag "-Join:->:" - flag "OrganizingBossFight:" - flag "BossFightJoined:" - flag BossFightNPC: - chat ", you are now the organizer for event ''. Tell players to come and talk to me and I'll add them to the group." - ^announce " is organizing a boss event for ." } else if == "" { - flag "-Organizer:" - flag "-Join:->:" - flag "OrganizingBossFight:" - flag "BossFightJoined:" - flag BossFightNPC: - narrate ", you are now the organizer for event ''. Tell players to come and talk to me and I'll add them to the group." - ^announce " is organizing a boss event for ." } else if == "" { - flag "-Organizer:" - flag "-Join:->:" - flag "OrganizingBossFight:" - flag "BossFightJoined:" - flag BossFightNPC: - narrate ", you are now the organizer for event ''. Tell players to come and talk to me and I'll add them to the group." - ^announce " is organizing a boss event for ." } else narrate "I'm sorry , but there is no event named ''." - zap step:Organize click trigger: script: # Run this script when the player click the NPC at any point during this step. - run "Bossfight Initiate Conversation" proximity trigger: exit: script: # When the player leaves the NPC proximity, this step here will put their dialogue back to the beginning so # they don't come back 2 days later and have to continue with an old dialogue. - zap step:Organize 'Join Group': chat trigger: 'Which Boss': trigger: I want to join the group for event '/REGEX:^\w+$/'. script: # There are 3 possibilities here # 1) If player wants to join an event that isn't being organized, tell them they can't. # 2) If the player is trying to join an event that has been locked, tell them they can't. # 3) If the event is available, add the player into the NPC flag so they become part of the event. Add # a couple of extra flags to the player that is used to automatically remove them from the event when # they quit Minecraft. # 4) Catch-all at the end that tells the player they entered an unexpected value. - ^if == "" && "-Organizer]>" == null narrate "Sorry , but the boss fight event doesn't currently have an organizer." else if == "" && "-Organizer]>" == null narrate "Sorry , but the boss fight event doesn't currently have an organizer." else if == "" && "-Organizer]>" == null narrate "Sorry , but the boss fight event doesn't currently have an organizer." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Organizer]>" == "Locked" narrate "Sorry , but the boss fight event is currently locked." else if == "" && "-Join].size>" >= "" narrate "You are unable to join the event because it is full." else if == "" && "-Join].size>" >= "" narrate "You are unable to join the event because it is full." else if == "" && "-Join].size>" >= "" narrate "You are unable to join the event because it is full." else if == "" && == null { - flag "-Join:->:" - flag "BossFightJoined:" - flag BossFightNPC: - announce " has joined the boss event " } else if == "" && == null { - flag "-Join:->:" - flag "BossFightJoined:" - flag "BossFightNPC:" - ^announce " has joined the boss event " } else if == "" && == null { - flag "-Join:->:" - flag "BossFightJoined:" - flag BossFightNPC: - announce " has joined the boss event " } else narrate "I'm sorry , but there is no event called ''." - zap step:Organize click trigger: script: - run "Bossfight Initiate Conversation" proximity trigger: exit: script: - zap step:Organize 'Lock Event': chat trigger: 'Which Event': trigger: '/REGEX:^\w+$/' script: # There are 3 possibilities here # 1) If the OP specifies the event and the event is not locked, flag the Organizer flag with the # value 'Locked' and remove all participants and their flags. # 2) If the OP specifies the event and the event is locked, clear the Organizer flag, making it # available again. # 3) Else, if nothing matches, assume the OP typed in something wrong and show them what they typed. - ^if == "" && "-Organizer]>" != "Locked" { - flag "-Organizer:Locked" - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Join:!" - announce "The event '' has been locked." } else if == "" && "-Organizer]>" == "Locked" { - flag "-Organizer:!" - announce "The event '' has been unlocked." } else if == "" && "-Organizer]>" != "Locked" { - flag "-Organizer:Locked" - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Join:!" - announce "The event '' has been locked." } else if == "" && "-Organizer]>" == "Locked" { - flag "-Organizer:!" - announce "The event '' has been unlocked." } else if == "" && "-Organizer]>" != "Locked" { - flag "-Organizer:Locked" - foreach "-Join].aslist>" { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag "-Join:!" - announce "The event '' has been locked." } else if == "" && "-Organizer]>" == "Locked" { - flag "-Organizer:!" - announce "The event '' has been unlocked." } else narrate "I am sorry, I don't know how '' is relevant to the context." click trigger: script: - run "Bossfight Initiate Conversation" proximity trigger: exit: script: - zap step:Organize "Bossfight General Chat": type: task script: # This script runs when the player enters the NPC proximity. It uses 'random' to pick # any one of the lines underneath it. - ^random 4 - ^chat "Hey , come talk to me if you're up for a challenge!" - ^chat "I've done my fair share of fighting, now I'm just helping to get groups together." - ^chat "I used to join in on the boss fights, but then I took an arrow in the knee." - ^chat "Ahh, nothing like the cheer of a successful party coming back with their spoils of war!" "Bossfight Initiate Conversation": type: task script: # Present the initial dialogue options to the player. # If player is an OP, also show the 'Lock' and 'Reset' options. - chat "Welcome . I organize group events for bosses , and ." - chat "What would you like to do?" - ^narrate "Say<&co>" - ^narrate " - 'Join' or 'Leave' a boss event." - ^narrate " - 'Organize' or 'Cancel' a boss event." - ^narrate " - 'Start' organized boss event or see current 'Events' list." - if == true narrate "Additional OP commands<&co> 'Lock' or 'Reset' events." - ^zap "s@Bossfight Organizer Convo" "step:Organize" "Bossfight Organize a Boss": type: task script: # This is another list that presents the available events to start a group for. It does some checks to decide # what data it should display for the user. Basically it checks: # 1) Is the event locked, if so display a 'Event Locked' after the event name. # 2) If there is no organizer, display some information about the event, like difficulty level, minimum players needed and the fact that there is no organizer assigned. # 3) Else display pretty much the same info but with the organizers name this time. - chat "Which boss event would you like to start a group for?" - ^narrate "Say<&co>" - ^narrate "------------------------------------------------" - if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" == null narrate " () - No Organizer - Min. . Max. ." else narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." - if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" == null narrate " () - No Organizer - Min. . Max. ." else narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." - if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" == null narrate " () - No Organizer - Min. . Max. ." else narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." - ^narrate "------------------------------------------------" - ^zap "s@Bossfight Organizer Convo" "step:Create Group" "Bossfight Join a Group": type: task script: # Present the player with a list of events and whether they are available or not, who is organizing them and the number of players joined. # Similar to 'Bossfight Organize a Boss' above. - chat "Which boss event would you like to join?" - ^narrate "Say<&co>" - ^narrate "------------------------------------------------" - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^if "-Organizer]>" == "Locked" narrate " - Event Locked" else if "-Organizer]>" != null narrate " () - Org. -Organizer]> Cur. -Join].size> Min. . Max. ." else narrate " () - No Organizer - Min. . Max. ." - ^narrate "------------------------------------------------" - ^zap "s@Bossfight Organizer Convo" "step:Join Group" "Cancel Bossfight on Logout": type: world events: on player quits: # This world event will run for every user that disconnects from the server. # 1) If they are part of an event: # a. Check to see if they are the organizer. If they are, then clear the flags for all other players that are part # of the event. Then clear the "organizer" and "join" flags set against NPC for the particular boss. # b. If they are not the organiser, simply clear the player flags and remove them from the list flag set against # the NPC. - if != null || != null { - if ].flag[-Organizer]> == { - announce "The boss event , organized by has been cancelled." - flag ]> -Organizer:! - foreach ].flag[-Join].aslist> { - flag %value% OrganizingBossFight:! - flag %value% BossFightJoined:! - flag %value% BossFightNPC:! } - flag ]> -Join:! } else { - announce " has left the boss event for ''." - flag ]> -Join:<-: - flag OrganizingBossFight:! - flag BossFightJoined:! - flag BossFightNPC:! } }