Conditions

Legacy Conditions (2.5.11 and below) can be found here.

Conditions are used to determine whether or not an action may execute. These conditions are placed under the Condition section in the configuration as shown below (bottom of page).

Conditions can be used on 1):

When applying multiple conditions, all of them must be met in order for the action to be executed. Some conditions allow arrays that can be split by commata. These conditions only require one of the strings in the arrays to match.

How do Conditions work?

Condition Types:
Conditions can be broken into two types-

  1. General conditions: Those that can be used on entities and locations or on entities only.
  2. Compare conditions: Those that need two entities or two locations. This conditions only make sense if used in TargetConditions section in the skill yamls. See CompareConditions!

Conditions that are used in the Conditions node of the skill:

  • Every condition can be used.
  • The caster is ALWAYS the entity that will be checked. All conditions can be used but conditions that compare 2 entities do not make sense here.

Conditions that are used in the TargetConditions node of the skill:

  • Every condition can be used.
  • TargetConditions node can only be used in skills.
  • The compare entity depends on the targeter of the skill. If the skill use @self the compare entity is the caster if the skill use any other targeter the compare entity/location is the entity given in the targeter.

Some example:

Conditions:
- globalscore{objective=Test;v=>10}

This condition is used under Conditions node and will always use the caster as compare entity. No matter what the targeter of the skill is.

  TargetConditions:
  - globalscore{objective=Test;v=>10}
This (the same) condition is used under TargetConditions node and will check the entity that is given by the targeter.

NOTE: CompareConditions only make sense in the TargetConditions node because they compare 2 entities where 1 of them is always the caster and the other one is the entitiy of the targeter. If they are used in the Conditions node the caster and the target are always the same.


Format:
Since 4.0.0, all conditions now have a new format.

Conditions:
- condition [variable]
- condition [variable] [action]
- condition [variable] [action] [action_variable]
- condition{variable1=value;variable2=value} [action] [action_variable]

These new “actions” control how the skill acts when a condition is met or not met. Here are some examples:

Conditions:
- day required
- stance defensive power 0.5
- stance{stance=defensive} power 0.5
- score{objective=test;value=>20} cancel
- haspotioneffect{type=POISON;level=>0;duration=0 to 100} true

Ranged Values:
Ranged values use either the format #to# or #-#. You must use “to” instead of “-” if you want to use negative numbers in the range. Here for example the distance condition:

Conditions:
- distance{d=1to10} true
Conditions:
- altitude{a=1-5}


Condition Actions
Condition Actions are a new feature that allow you to do additional things based off of conditions. Before conditions were always a “requirement”, but now you can specify other meanings for them.

Here is a list of actions being added:

  • required (or true) (default) - The condition is required for the skill to run.
  • cancel (or false) - The skill will not run if this condition is met.
  • power [power multiplier] - Modifies the skill's power (e.i. power 2.0 would double the skill's power)
  • cast [skill] - Casts an additional skill if the condition is met.
  • castinstead [skill] - Casts a different skill instead if the condition is met.

CompareConditions (TargetConditions that compare the caster and the target)

  • distance{d=[value]}
    • Executes the skill if the target falls within the specified distance from the entity
    • Can be a single number, a ranged value (20to40), or >10 <5, etc.
    • distance{d=<2}
  • fieldofview{angle=[double]}
    • Executes the skill if the target is in the range of vision angle of the caster.
    • fov{a=90}
  • lineofsight
    • Executes the skill if the mob has or does not have line of sight to the player.
    • targetinlineofsight true
  • owner
    • Executes the skill if the target is or is not the owner of the mob.
    • Must be set using the Set Owner mechanic.
    • owner true

General Conditions

  • altitude{a=[number]}
    • Available for entity targeters.
    • Tests how far above the ground the caster/target is.
    • Can be ranged values (10-405), single numbers or >10 <77 etc.
    • Use the ranged value format with “-” and not “to”!
    • altitude{a⇒1}
  • biome{b=[biome]}
    • Available for entity & location targeters.
    • Tests what biome the caster/target is in.
    • Its possible to use a list separated by “,”
    • Defaults to Plains
    • biome{b=DESERT,PLAINS,RIVER} true
  • blocktype{t=[Material_Name]}
  • crouching
    • Available for player targeters.
    • Tests if the target is crouching.
    • crouching false
  • cuboid
    • Checks if a target entity is within the defined cuboid represented by location1 and location2.
    • cuboid{location1=x,y,z;location2=x,y,z;world=world}
  • dawn
    • Available for entity & location targeters.
    • Time in world of location is > 22000 and < 2000.
    • dawn true
  • day
    • Available for entity & location targeters.
    • Time in world of location is >= 2000 and ⇐ 10000.
    • day true
  • distancefromspawn{distance=[ranged_value]
    • Available for entity & location targeters.
    • Tests for the distance from the world spawn point.
    • Can be ranged values (10-300), single numbers or >10 <77 etc.
    • Use the ranged value format with “-” and not “to”!
    • distancefromspawn{distance⇒100} true
  • dusk
    • Available for entity & location targeters.
    • Time in world of location is > 18000 or < 14000.
    • day true
  • fallspeed{speed=[number/number range]}
    • Available for entity targeters.
    • Can be ranged values (10-405), single numbers or >10 <77 etc. Can be negative. (For jumping.)
    • Note that you always seem to be falling while standing, at a speed of about 0.785.
    • fallspeed{speed⇒0.7845} true
  • gliding
    • Available for entity targeters.
    • Detects if the mob/entity is gliding with elytra.
    • You can trigger gliding on mobs using the Set Gliding mechanic.
    • gliding true
  • hasbuff{buffname=[string]
    • Checks if the caster have at least one buff with name buffname running.
    • hasbuff{buff=whatever}
  • hascurrency
    • Available for player targeters.
    • Checks if the player has enough money.
    • Needs Vault enabled in config.yml and installed and a economy plugin installed
    • hascurrency{a=20} true
  • hasinventoryspace
    • Available for player targeters.
    • Checks if there is a free slot in targets inventory.
    • hasinventoryspace true
  • hasparent
    • Available for mythicmobs mobs.
    • Checks if the mythicmobs mob have a living parent entity.
    • hasparent true
  • haspermission
    • Available for player targeters.
    • Checks if the player has that permission.
    • haspermission{p=apermission} true
  • haspotioneffect{type=[potion type];level=[level];duration=[duration start] to [duration end]}
    • Available for entity targeters.
    • Detects if the mob/entity has a potion effect, what level that effect is, and how long it'll last.
    • For level, you can specify a level, or a comparable. (>1 for greater than level 1)
    • The below example only runs if the target has the poison effect, stronger than level 1, and between 0 and 100 ticks. (5 seconds)
    • haspotioneffect{type=POISON;level⇒1;duration=0to100} true
  • hastag{tag=[tag name]}
    • Available for entity targeters.
    • Detects if the mob/entity has a scoreboard tag.
    • You can add tags to an target using the Add Tag mechanic.
    • hastag{tag=test} true
  • height [number_range]
    • Available for entity and location targeters.
    • Execute the skill if the mob is within a particular height range
    • Can be a single number, a ranged value (20-40), or >10 <5, etc.
    • Pressing F3 will show you your height for reference.
    • height 0-20
  • heightabove / heightbelow [number]
    • Available for entity and location targeters.
    • Execute the skill if the mob is above or below a particular height.
    • Pressing F3 will show you your height for reference.
    • heightabove 0
  • holding [itemname] NOT IMPLEMENTED
    • Executes the skill if the casting mob is holding [itemname].
    • Must be a Bukkit material name. Can't be a mythic item.
    • Due to a mysterious bug this condition can't test for items with durability (as of 2.2.1 and before).
    • holding STICK
  • inblock [material_type]
    • Available for entity and location targeters.
    • Execute the skill if the mob is in a particular block material.
    • Useful generally to check if a mob is in water, air, lava, etc rather than a solid material.
    • Allows arrays/data splits
    • Note that for mobs inside water blocks, you want STATIONARY_WATER instead of just WATER.
    • inblock WATER
  • incombat
    • Available for entity targeters.
    • Execute the skill if the mob is currently in combat (mob has a target).
    • Only available for mobs with enabled threattable!
    • incombat true
  • itemrecharging
    • Available for players.
    • Execute the skill if the item in hand of player is reloading.
    • itemrecharging true/false
  • lastsignal{s=[signal]}
    • Available for entity targeters.
    • Execute the skill if the last signal received matches [signal] - see signal-skill
    • Unlike the stance condition, the lastsignal condition checks for perfectly matching data.
    • lastsignal{s=ping}
  • level [number_range]
    • Available for entity targeters.
    • Execute the skill if the mob is of a particular level range.
    • Can be a single number, a ranged value (20-40), or >10 <5, etc.
    • level >3
  • lightlevel{l=[ranged_value]}
    • Available for entity and location targeters.
    • Execute the skill if the mob in a light level within a certain range.
    • Must be a number between 0 and 15.
    • lightlevel{l=0to3}
  • lunarphase{p=[days]}
    • Available for entity and location targeters.
    • Execute the skill if it is a particular day.
    • Comma separated list of game days (0*7) representing the lunar phase.
    • lunarphase{p=4,5,6}
  • mobsinchunk{a=[ranged_value]}
    • Available for entity and location targeters.
    • Execute the skill if a certain amount of mobs are present in the chunk.
    • Can be a single number, a ranged value (20to40), or >10 <5, etc.
    • mobsinchunk{a=<5} true
  • mobsinworld [ranged_value]
    • Available for entity and location targeters.
    • Execute the skill if a certain amount of mobs are present in the world.
    • Can be a single number, a ranged value (20to40), or >10 <5, etc.
    • mobsinworld{a⇒100}
  • Mounted
    • Available for entity targeters.
    • Check if the entity has a vehicle.
    • mounted true
  • MythicMobType{t=mythicmobinternalnames}
    • Available for entity targeters.
    • Check if the entity is a mythicmobs mob of type.
    • Allows multiple types by “,”
    • mythicmobtype{types=TheSkeletonKing,Another7331Mob} true
  • Night
    • Available for entity and location targeters.
    • Time in world of location is >= 14000 and ⇐ 22000.
    • night true
  • NotInRegion{region=WORLDGUARD_REGION_NAME}
    • Available for entity and location targeters.
    • Check if the target is not in the region.
    • notinregion{r=spawn} true
  • offgcd
    • Available for entity targeters.
    • Executes the skill if the mobs global cooldown is 0.
    • The mobs global cooldown is a time period or delay during which the mob can not execute any skills (if defined as such using this condition)
    • Must use the GCD skill to set the global cooldown in a skill or the global cooldown will always be 0.
    • Frequently used for mobs that have more than one spell or skill to keep them from casting them simultaneously which generally is not preferred.
    • offgcd
  • onground
    • Available for entity targeters.
    • Execute the skill if the caster is on the ground.
    • onground true
  • outside/inside [true/false]
    • Available for entity and location targeters.
    • Execute the skill if location is either inside or outside.
    • Outside is defined by the location having a clear line of sight to the sky. Inside is the opposite.
    • outside true
  • ownerisonline
    • Available for mythicmobs mobs with a player as owner.
    • Checks if the mobs owner is online.
    • ownerisonline true
  • pitch
    • Checks the target entity's pitch.
    • pitch 20to40
    • pitch <100
  • PlayerKills{kills=[number]}
    • Available for entity targeters.
    • Execute the skill if the mob's playerkill-count matches.
    • Ranged values are allowed. > or < or = or (0to20).
    • playerkills{kills⇒2} true
  • playernotwithin/targetnotwithin{d=[distance]}
    • Available for entity targeters or player targets only if playerwithin is used.
    • Execute the skill if the player is not within a certain amount of blocks.
    • Accepts a single number. If you wish to use a range, use targetdistance condition instead.
    • playernotwithin{d=5}
    • targetnotwithin{d=2}
  • playerwithin/targetwithin{d=[distance]}
    • Available for entity targeters or player targets only if playerwithin is used.
    • Execute the skill if the player/entity is within a certain amount of blocks.
    • Accepts a single number. If you wish to use a range, use targetdistance condition instead.
    • Frequently used along with targetinlineofsight condition to keep mobs from using skills on players that they can't see or are too far away.
    • playerwithin{d=15}
    • targetwithin{d=2}
  • raining
    • Available for entity and location targeters.
    • Executes the skill if it is raining or not.
    • raining false
  • Region{r=[region_name]}
    • Available for entity and location targeters.
    • Check if the location is in the worldguard region or not.
    • region{r=spawn} true
    • region{r=spawn} false
  • score{objective=[objective name];entry=[entry];value=[value]}
    • Available for entity targeters.
    • Tests the value of the entry in scoreboards objective objective.
    • If entry is not given, the player name (if the target is a player) or the uuid (if target is a entity) will be used as entry.
    • score{objective=test;v⇒20} true
    • This check if the value of entry [player_name/entity_uuid] in objective test is greater 20.
    • score{o=test;entry=counter;value=<20} true
    • This check if the value of the entry counter in objective test is smaller than 20.
  • scoreglobal{objective=[objective name];value=[value]}
    • Available for entity targeters.
    • Tests the value of the GLOBAL entry in scoreboards objective objective.
    • scoreglobal{objective=test;v⇒20} true
  • stance{s=[string]}
    • Available for entity targeters.
    • Executes the skill if the mob is in a particular stance.
    • Stance variable must be defined previously using the setstance skill and can be any string that makes sense to the player for the skill being designed.
    • The stance condition will check for the given string being contained in the current stance. This allows complex usage of the condition. For instance if your mob's stance is AGGRO and your stance condition only checks for GG the stance will match.
    • stance{s=defensive} true
  • sunny
    • Available for entity and location targeters.
    • Executes the skill if it is sunny or not.
    • sunny true
  • targetinlineofsight/targetnotinlineofsight
    • Check if the entity has its target in sight or not.
    • targetinlineofsight true
  • targetwithin/targetnotwithin{d=[value]}
    • Executes the skill if the target falls within/not within the specified distance from the entity
    • Can be a single number, >10 <5 or = etc.
    • targetwithin{d=2}
  • tcbiome{biome=[string];strict=[boolean]
    • Available for entity and location targeters.
    • Executes the skill if the caster is in the TerrainControl biome
    • Can be matched strictly or loosely
    • tcbiome Forest (Matches any TerrainControl biome whose name contains FOREST)
    • tcbiome{biome=TropicalDesert;strict=true} Would match only TropicalDesert, not TropicalDesertBorder
  • thundering
    • Available for entity and location targeters.
    • Executes a skill if it is thundering or not.
    • thundering false
  • wearing
    • Condition to check the armor slots of living entities for normal or mythic items.
    • wearing{slot=helmet;material=DIAMOND_HELMET} true
    • wearing{slot=chestplate;mmitem=AnItem}
  • world [worldname]
    • Available for entity and location targeters.
    • Executes a skill if in a particular world.
    • Can be single world or a comma separated list.
    • Allows arrays/data splits
    • world snowyworld,lavaworld,islandworld
  • worldtime [number_range]
    • Available for entity and location targeters.
    • Executes a skill if during a particular time of day.
    • Valid values are between 0 and 24000. (/time will tell you the time of day in ticks)
    • 0-12000 is the minecraft day. 12001-13800 is dusk, 13801-22200 is night, 22201-24000 is dawn
    • worldtime 0-12000
  • yaw [number_range]
    • Checks the target entity's yaw.
    • yaw >50
    • yaw 50to100

Examples

FlameShock:
  Cooldown: 1
  Conditions:
  - targetwithin 15
  - targetinlineofsight true
  - incombat
  - stance aggressive
  - onblock GRASS
  - offgcd
  Skills:
  - gcd{t=60}
  - message{m="<mob.name> begins casting a spell"}
  - potion{t=SLOW;d=60;l=7}
  - delay 60
  - message{m="<target.name> &ecombusts"}
  - effect:particles{p=flame;a=20;hS=3;vS=1;s=0;y=2}
  - potion{t=HARM;d=1;l=1}

1)
Not all conditions may be applicable everywhere.
conditions/start.txt · Last modified: 2018/12/18 20:23 by xikage
GNU Free Documentation License 1.3
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0