forked from BerndiVader/MythicSkriptAddon
-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Mechanics
Yevhen Harasymchuk edited this page May 23, 2026
·
1 revision
The skfunction mechanic allows you to call a Skript function directly from your MythicMobs skill configuration. This provides immense flexibility, letting you handle complex logic (like checking regional data, database queries, or custom mathematical calculations) using Skript.
To use a Skript function as a mechanic, use the following syntax in your MythicMobs Skills.yml:
MySkill:
Skills:
- skfunction{name=my_skript_function} @target ~onAttack- name: The name of the Skript function you want to call.
In your Skript files, you define the function that MythicMobs will trigger. The function should accept skilldata as its first parameter to access skill metadata.
function my_skript_function(data: skilldata, target: entity, loc: location) :: boolean:
# Access metadata from the skill
set {_caster} to caster of {_data}
set {_power} to power of {_data}
# Perform custom logic
broadcast "The mob %{_caster}% is casting a skill!"
# Return true if the skill executed successfully
return trueWhen a skfunction is called, you can extract the following information from the skilldata object using expressions:
-
caster of {_data}: Returns the entity that cast the skill. -
cause of {_data}: Returns the internal trigger cause. -
trigger of {_data}: Returns the entity that triggered the skill (e.g., the player that right-clicked). -
entitytargets of {_data}: A list of all entities currently targeted by the skill's targeter. -
locationtargets of {_data}: A list of all locations currently targeted by the skill's targeter. -
origin of {_data}: The location from which the skill was cast. -
power of {_data}: The power value of the skill as a float.
-
Targeters: Depending on the targeter you use in MythicMobs (e.g.,
@self,@target,@location), theentityorlocationparameters in your function may benullif the targeter doesn't provide them. Always check if they are set before using them. -
Return Value: Your function must return a
boolean. Returningtruesignals to MythicMobs that the mechanic was processed successfully.
Home
Documentation
Advanced Integrations