Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicMobs MythicMobs
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicMobsMythicMobs
  • Wiki
    • Skills
  • Dynamic Metaskills

Last edited by Lxlp 2 months ago
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Dynamic Metaskills

Normally, to execute a mechanic or a metaskill, you need to have that mechanic or metaskill written physically down in the config. But with Dynamic Metaskills this you are now able to:

  • execute single mechanics or entire metaskills even if they never existed before by dynamically constructing them.
  • bypass missing placeholder support in mechanics/inline conditions
  • store entire metaskills into variables or NBTs, enabling you to dynamically call them later
  • DISCLAIMER
  • How does this work?
  • What is happening?
  • Dynamic Creation of Metaskills
  • Bypassing Placeholder Support Limits
  • Storing Dynamic Metaskills
  • Limitations

DISCLAIMER

This is not an intended mechanic. It's just a happy accident that, somehow, consistently works. Do not expect this to be cutting edge, as, again, this is more of a convenient bug.

Since this is pretty much uncharted territory, if you have any information useful to further expand this page and, by proxy, the knowledge available to every other MythicMobs user, let me know: Lxlp's Discord Profile

How does this work?

Basically, it all boils down to two things:

  • The usage of the variableskill mechanic
  • The existence of inline metaskills

By combining those two things, it is now possible to do something like this

Testmob:
  Type: pig
  Skills:
  - skill{s=
    [
      - setvariable{var=skill.temp;type=STRING;val=glow} @self
      - setvariable{var=skill.testskill;type=STRING;
        val=
        [
          - message{m=hello} @World
          - message{m=world} @World
          - message{m=<skill.var.temp>} @World
        ]} @self
      - vskill{s=<skill.var.testskill>}
      - vskill{s=
        [
          - particle{p=<skill.var.temp>} @selflocation{y=2}
        ]} @self
    ]} @self ~onInteract

2024-08-17_17.54.14

What is happening?

The variableskill mechanic is a very interesting one: it executes the metaskill it finds in its skill attribute after parsing its content. While this is normally used only to execute metaskills whose name can depend on specifics of the mob or environment at the moment of the execution (making it very useful for templating) this also has an unexpected effect when combined with inline metaskills: as long as it's written as a inline metaskill, you can make the variableskill mechanic parse anything and expect it to get executed

Dynamic Creation of Metaskills

And now, we come to the crux of the matter: you are now able to make completely new and unique metaskills on the spot without having to physically configure them

Testmob:
  Type: pig
  Skills:
  - skill{s=
    [
      - setvariable{var=skill.temp;type=STRING;val=glow} @self
      
      - setvariable{var=skill.testskill2;type=STRING;val="["}
      - setvariable{var=skill.testskill2;type=STRING;val=<skill.var.testskill2> - message{m=aaa} @World} @self
      - setvariable{var=skill.testskill2;type=STRING;val=<skill.var.testskill2> - message{m=bbb} @World} @self
      - setvariable{var=skill.testskill2;type=STRING;val=<skill.var.testskill2>]} @self
      
      - vskill{s=<skill.var.testskill2>}
      - vskill{s=
        [
          - particle{p=<skill.var.temp>} @selflocation{y=2}
        ]} @self
    ]} @self ~onInteract

Bypassing Placeholder Support Limits

Not every attribute of every mechanic, condition or targeter has support for placeholders. This is often a limiting factor for a lot of advanced projects. But not anymore!
Let's look at the examples above: at the time of writing the particle mechanic does not have placeholder support for its particle attribute, and yet that works when used with the methods described here. How come? That is because the vskill mechanic itself is parsing the value of that placeholder before anything else is executed, and when the particle mechanic is called everything has already been parsed for it

One must then note that this operation is not exclusive to mechanic's attribute: you can literally use placeholders for every single character of the string that is being built, and, as long as the result after parsing can then be considered a proper inline metaskill, it will work!

Storing Dynamic Metaskills

As you already saw, the newly made metaskill is being stored inside a variable. The variable can have any scope you deem fit, persist for as long as you want and have all the other cool stuff variables have. You can also store these skills inside NBTs, making items of your making being able to have completely custom skills for them

Limitations

Since this is not a planned feature, its implementations do have some problems.

  • Usage of other "skill" mechanics inline: when using "skill", "sudoskills" or other such skill mechanics directly inline will result in a console error, without the mechanic being executed. To solve this, it is necessary to continue using the vskill mechanic in place of these other ones. For the skill mechanic a simple replace will work, but to use a sudoskill you will need to make a vskill mechanic call a metaskill that executes said sudoskill mechanic itself
ExampleWorkaround:
  Skills:
  - vskill{s=
    [
      - vskill{s=YourOtherMetaskill}
      - vskill{s=SudoskillWrapper;run=TheMetaskillToBeSudoed}
    ]}

SudoskillWrapper:
  Skills:
  - sudoskill{s=
    [
    - vskill{s=<skill.run>}
    ]} 

AnotherWorkaround:
  Skills:
  - vskill{s=
    [
      - vskill{s=YourOtherMetaskill}
      - vskill{s=SudoskillWrapper;run=
        [
        - message{m=<caster.name>} @World
        ]}
    ]}
Clone repository
Home
Changelogs
Premium Features
Commands and Permissions
Mythic Add-ons
Compatible Plugins
API Information
Guides
  • Troubleshooting
  • FAQ / Common Issues
  • Examples
Packs
Mobs
  • Mob Options
    • Display Options
  • Mob Levels
  • Mob Factions
  • Power Scaling
  • Damage Modifiers
  • Equipment
  • BossBar
  • Custom AI
  • Custom Kill Messages
  • Threat Tables
  • Immunity Tables
  • Templates
  • Vanilla Overrides
  • Extra: Disguises
  • Extra: ModelEngine
Skills
  • Mechanics
  • Targeters
    • Filters
  • Triggers
  • Conditions
    • In-line conditions
  • Metaskills
  • Placeholders
  • Variables
Items
  • Options
  • Attributes
  • Enchantments
  • Potions
  • Banner Layers
  • Firework
Drops & DropTables
  • Drops
  • DropTables
  • FancyDrops
Spawning
  • Spawners
  • Random Spawns
Stats
  • Custom Stat Options
  • Modifiers
  • Built in Stats
Technical
  • Math
  • Operations
    • Attribute Operations
    • Stats Modifiers
  • Particles Types
  • Audience
  • Equipment Slots
  • SkillTree
  • Intratick Scheduling
  • Dynamic Metaskills
Other
  • Pins