Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:commandskillsold [2019/01/24 18:50] (current)
rickyling created
Line 1: Line 1:
 +====== Using command-skills ======
 +
 +**This page is for Minecraft 1.12 and below, the tutorial for 1.13+ can be found [[https://​www.mythicmobs.net/​manual/​doku.php/​tutorials/​commandskills|here]]**
 +
 +This tutorial will teach you how to make use of the command-skills in MythicMobs.
 +
 +First off, a few preparations are to be made to ensure everything will be running correctly. Understand that the contents of the command-skill are run from the servers console, but for some reason are also affected by minecrafts command blocks. Thankfully though, no command block useage is neccessary at all!
 +
 +===== Preparations =====
 +
 +==== Step 1: ====
 +
 +Go to your server.properties file and enable command blocks. All you have to do for that is setting the line "​enable-command-block="​ to "​true":​
 +
 +<​file>​
 +enable-command-block=true
 +</​file>​
 +
 +==== Step 2: ====
 +
 +Since we're using Bukkit/​Spigot we have to deal with Bukkit forcing their own version the minecraft command block onto us by default. We don't want that, so we're going to go into the commands.yml and make sure Bukkit isn't interfering with our work by overriding all command blocks like this ('<​nowiki>​*</​nowiki>'​ is an alias for **//​all//​**):​
 +<​file>​
 +command-block-overrides:​
 +- '​*'​
 +</​file>​
 +
 +==== Step 3: ====
 +
 +To make sure the changes just made are taking effect, restart or reload the server. Either is fine. Once done with that you're good to go to actually start working with command skills!
 +
 +===== General functionality =====
 +
 +Command skills are capeable of doing anything an admin could do on the server. They also able to create effects/​make changes that currently (any point in time) are not available by standard MythicMobs configurations or skills. For instance, you could make certain mobs temporarily invulnerable or de/​-activate their AI.
 +
 +If not specified otherwise, command skills will be executed inside of the servers console. That is fine for some commands like setting the time or weather on the server to something specific. Any command that doesnt affect a specific player, entity or location is fine like this. For instance:
 +
 +<​file>​
 +Skills:
 +- command{c="​time set 0"}
 +- command{c="​weather clear"​}
 +- command{c="​gamerule doMobSpawning false"​}
 +</​file>​
 +
 +Complications may arise, when you have multiple plugins using the same syntax - which is actually the case for some of the above examples!
 +
 +Lots of Bukkit/​Spigot servers run the plugin "​Bukkit Essentials"​ which has its own version of the /time and /weather command. If the above skills were to be executed on a server that has said plugin installed on it, the server might execute the essentials version of the command although you meant to use vanilla mincraft version of it. How the server decides which of the commands has priority is unknown to me.
 +
 +To prevent such issues, we simply have to be a little more detailed when writing our command-skills:​
 +
 +<​file>​
 +Skills:
 +- command{c="​minecraft:​time set 0"}
 +- command{c="​mincraft:​weather clear"​}
 +- command{c="​minecraft:​tp player1 player2"​}
 +- etc...
 +</​file>​
 +
 +I highly want to encourage using the above method. I've worked on some server which had such an overflow amount of plugins, that certain commands wouldn'​t work/​respond at all if you didn't provide the //​minecraft://​ -prefix.
 +===== Executing the command from X =====
 +
 +Some commands must be executed from a specific entity in order to get the desired effect. This is necessary for all mobs that do not spawn in a predetermined,​ unique location. I like to call such mobs //dynamic mobs//.
 +
 +Let's assume, for the sake of realistic examples, you wanted your mob to encase itself in a box of white wool when it spawns. First off, an approach that would not work:
 +
 +<​file>​
 +Skills:
 +- command{c="​minecraft:​fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:​wool 0 replace"​}
 +</​file>​
 +
 +The above cannot work, because the way it is formatted it will attempt to run that command from the console. Since the console does not have a location of its own in the mincraft world, it cannot fill an area of a 2 block radius around itself with white wool. The command will fail, or if youre unlucky will create a box of wool at the coordinates of the world spawn.
 +
 +We must use an approach that forces the casting mob to execute that command at its own location. What we need for that is the "​execute"​-command. Here's how it looks:
 +
 +<​file>​
 +Skills:
 +- command{c="​minecraft:​execute <​mob.uuid>​ ~ ~ ~ minecraft:​fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:​wool 0 replace"​}
 +</​file>​
 +
 +Now we're talking - that approach will work. The <//​mob.uuid>//​-part is a [[:​skills:​stringvariables|MythicMobs message variable]] and will paste the casting mobs UUID in the command as soon as the command is run. This way, the command is no longer run from the console but rather from the location of the casting mob, which is exactly what we needed.
 +
 +The same could be achieved like this:
 +
 +<​file>​
 +Skills:
 +- command{c="​minecraft:​execute **<​target.uuid>​** ​ ~ ~ ~ minecraft:​fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:​wool 0 replace"​} **@self**
 +</​file>​
 +
 +<//​target.uuid>//​will always relate to the targeter used on the skill. In this case, the //@self// targeter at the very end of the line. However, you can also make certain mobs or any other targets for that matter execute the above skill!:
 +<​file>​
 +Skills:
 +- command{c="​minecraft:​execute **<​target.uuid>​** ​ ~ ~ ~ minecraft:​fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:​wool 0 replace"​} **@MobsInRadius{r=10;​t=BAT}**
 +</​file>​
 +
 +The above will encase all bats in a 10 block radius from the casting in 2-block radius white wool box. As i said, best example.
 +
 +Here's some more examples of whats possible. The below skills are randomly scrambled, but that might give you an idea of what can be done.
 +
 +<​file>​
 +  - command{c="​minecraft:​execute <​mob.uuid>​ ~ ~ ~ minecraft:​scoreboard objectives add mrjlmmw1b dummy mrjlmmw1b"​}
 +  - command{c="​minecraft:​execute <​mob.uuid>​ ~ ~ ~ minecraft:​scoreboard players set @a[x=-16,​y=104,​z=-60,​dx=-3,​dy=3,​dz=9] mrjlmmw1b 0"}
 +  - command{c="​minecraft:​execute <​mob.uuid>​ ~ ~ ~ minecraft:​scoreboard players set @a[x=-16,​y=104,​z=-60,​dx=-3,​dy=3,​dz=9] mrjlmmw1b 1 <&​lc>​Inventory:​[<&​lc>​id:​minecraft:​paper,​tag:<&​lc>​display:<&​lc>​Lore:​[0:,​1:&​7Can be used once for any,​2:&​7monorail on Jaygrounds.,​3:&​8Absolutely no refunds.,​4:​],​Name:&​fMonorail Ticket&​r<&​rc><&​rc>,​Damage:​0s<&​rc>​]<&​rc>"​}
 +  - command{c="​minecraft:​execute <​mob.uuid>​ ~ ~ ~ minecraft:​scoreboard players set @a[x=-16,​y=104,​z=-60,​dx=-3,​dy=3,​dz=9,​score_donators_min=1] mrjlmmw1b 2"}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​tp @a[team=!pve_ruins_1,​r=50] 366.5 71 487.5 0 0"}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​scoreboard teams join pve_ruins_1 @a[r=50]"​}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​scoreboard objectives remove pve_ruins_cur"​}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​scoreboard teams remove pve_ruins_2"​}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​scoreboard teams remove pve_ruins_3"​}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ minecraft:​fill 368 71 494 364 72 494 minecraft:​acacia_fence 0 replace minecraft:​air"​}
 +  - command{c="​minecraft:​execute <​target.uuid>​ ~ ~ ~ mm m s pve_ruins_sign_arena_ready 1 world,​366.5,​71,​493.5"​}
 +</​file>​
 +
 +Tutorial created by [[http://​www.mythicmobs.net/​forum/​memberlist.php?​mode=viewprofile&​u=159|jaylawl]],​ 19.01.16
 +
 +Might be expanded in the future.
  

tutorials/commandskillsold.txt · Last modified: 2019/01/24 18:50 by rickyling