# +---------------------------------- # | Character script # +---------------------------------- # Permissions # char.reset # char.name # flags # Characters - holds all your character names # Character - holds your current character's name # Gender - holds male or female # Jobs - holds all your jobs # Second_Jobs - holds all your second jobs # Race - holds all your races. # Character_Slots # +---------------------------------- # | Character YAML scripts # +---------------------------------- Character_World_Script: type: world events: on server start: - run Load_Characters instantly - run Save_Characters delay:5m Load_Characters: type: task Script: - if { - yaml "load:Characters.yml" id:Characters } else { - yaml create id:Characters } Save_Characters: type: task Script: - yaml "savefile:Characters.yml" id:Characters - announce "saving -Characters- data" to_ops - run Save_Characters delay:5m # +---------------------------------- # | Character Help # +---------------------------------- Character_Command: type: command name: char description: Handles most character commands usage: /char script: - if || == help { - narrate "--====|||| Arithia Characters ||||====--" - narrate "/char info - See information about your characters." - narrate "/char new - Create a new character." - narrate "/char [nickname] - Switches to the character with the nickname. (12 hours cooldown)" - narrate "/char kill <&4>- Kill the character you're currently playing as." # Checking if the command is run by a staff member - if || || || { - narrate "--====|||| Staff Character Commands ||||====--" - if { - narrate "/char name <<>Character Number<>> <<>player<>> <<>New Name<>> - set a character name." } } - queue clear } # +---------------------------------- # | Character Info # +---------------------------------- - if == info { - define Character - define Char_Number ].find[%Character%]> - narrate "You are currently playing as<&co> " - narrate "You have<&co> ].size> Characters" - narrate "].formatted>" - narrate "You are using Character slot<&co> %Char_Number%" - narrate "Race<&co> .%Character%.Race]>" - narrate "Gender<&co> .%Character%.Gender]>" - narrate "Jobs<&co> .%Character%.Jobs].formatted>" - queue clear } # +---------------------------------- # | Character Manual Name # +---------------------------------- - if == name { - if ! { - narrate "You don't have permission to use this command" - queue clear } # Check if the staff member have all the correct arguments - if ! { - narrate "You have missing arguments. /char name " - narrate "e.g /char name 1 wonderdude Mark_Lyck" - queue clear } # Check if they put a number for the character number. - if %Char_Number% matches number { } else { - narrate "Argument 2 has to be a number!" - narrate "e.g /char name 1 wonderdude Mark_Lyck" - queue clear } - define Target - define Char_Number - define New_Name # Check if the Target is currently playing as the character that's getting a name change. - if == { - execute as_server "removename %Target%" - execute as_server "name %Target% %New_Name%" - flag Character:%New_Name% } - yaml id:Characters set players.%Target%[%Char_Number%]:%New_Name% - queue clear } # +---------------------------------- # | Character switch # +---------------------------------- - if == switch { - if ].size> != 2 { - narrate "You can only use the /char switch command if you have exactly 2 characters." - queue clear } # Check if they are currently playing as character 2, if yes, force switch to 1, if not switch to 2. - if == ].get[2]> { - execute as_player "char 1" } else { - execute as_player "char 2" } - queue clear } # +---------------------------------- # | Character Kill # +---------------------------------- - if == kill { # Checking that they have a character to kill - if ].size> == 0 || ]> == null { - narrate "You don't have any characters to kill" - queue clear } - define Character - define Char_Number ].find[%Character%]> - yaml id:Characters set players..[%Char_Number%]:! - flag player Character_CD:! - flag player Character:! - if ].size> > 0 { - execute as_player "char 1" } else { - execute as_player "char new" } - flag player Character_CD:! } # Checking for jobs to remove # - execute as_server "manudelsub .%Character%.Jobs].get[1]>" # - execute as_server "manudelsub .%Character%.Jobs].get[2]>" # - yaml id:characters set players..%Character%.jobs:<-:Miner:Lumberjack:Farmer:Hunter:Engineer:Cook:Alchemist:Blacksmith:Leader # - if 1 > 2 # - flag player Character_CD:! # - yaml id:characters set players..%Character%.Gender:<-:Male:Female # - if 1 > 2 # - yaml id:characters set players..%Character%.Race:<-:Human:Elven:Barbarian:Halfling:Dwarven:Undead # - if 1 > 2 #players..character_name.jobs:|:engineer|miner or :->:miner and :->:engineer # +---------------------------------- # | Character New # +---------------------------------- - if == new { - if >= ].size> { - narrate "You don't have any open character slots, you can purchase more on the store or kill one of your current characters." - queue clear } # Make a new character. Giving it a temporary name so we can switch to it. - if ].contains[Unnamed]> { - narrate "You can only make 1 new character at a time" - queue clear } # Check if they have other characters. If they do they much be playing one of them, and we can simply switch to it. - if ].size> > 0 { - execute as_player "char ].find[Unnamed]>" } else { # If they don't have any characters, we need to create a blank one. - yaml id:Characters set players..Unnamed.Gender - yaml id:Characters set players..Unnamed.Race - yaml id:Characters set players..Unnamed.Jobs - yaml id:Characters set players..Unnamed.City - yaml id:Characters set players..Unnamed.Mamed # Teleport the player to the first quest - execute as_server "tppos 0 100 0" } - narrate "You succesfully created a new Character!" - queue clear instantly } # +---------------------------------- # | Character manual Switch # +---------------------------------- # Checking if trying to switch character with a valid number or a valid name - if matches number && <= ].size> || ].contains[]> { - if 1 > 2 # Checking if the player is currently playing as the character they want to switch to. - if == { - narrate "You are already playing as " - queue clear } - if matches number { - define Char_Number } else { - define Char_Number ].find[]> } - flag player Character:].get[%Char_Number%]> # Changing the name - execute as_server "removename " - execute as_server "name " # Leaving the town for good measure - execute as_player "town leave" # Saving the character's items in a list - define Char_Items_Li li@ - foreach { - define Char_Items_Li } - flag player Char_%Char_Number%_Items:%Char_Items_Li% # Saving the character's location - flag player Char_%Char_Number%_Location: # Adding them to their town. - execute as_server "manuaddsub Cora" - execute as_server "townyadmin town Cora add " - execute as_player "accept" # Teleporting them to their new location. - teleport # Changing the items - give # Resetting thee No-Character Group - execute as_server "manudelsub No-Character" - execute as_server "manuaddsub No-Character" # Setting a 12 hour cooldown. - flag player Character_CD duration:12h - queue clear } else { - narrate "You don't have a character with that name or number" } #This is used to set data # - yaml id:characters set players.:character_name # - yaml id:characters set players..character_name.gender:male #This is used to load data # This should list all the players character names (because the next "entry" is the character names) # - yaml ]> #players..character_name.jobs:|:engineer|miner or :->:miner and :->:engineer #set replaces! #[17:06] if you'd do entry:value #[17:06] and then entry:->:value2 #[17:06] your value 1 would have been erased #[17:06] due to yaml restrictions #[17:06] sooo be sure to do entry:->:value #[17:07] even if it's the first one #[17:07] if there should be the ability to add more later #[17:07] wonderdude, also note that - value #[17:07] can't have any sub values anymore (i think) #[17:08] i may be wrong #[17:08] idk