OnApply Command

Makes the console execute a command when an item is dragged and dropped on another item by a player.

Basically like you'd apply Gem Stones or identify items with Identify Scrolls.

Tips

  • To restrict the command to only run when the item 'is applied to' certain item types, use an onApply Mask.

    • This is replaced, when the onApply command is in a Gem Stone, by the Gem Stone successfully fitting into the item.


  • Consumables and Gem Stones will be consumed when applied. All other types can be applied infinitely.


  • Because this command supports PAPI placeholders, you must use <$pc> to specify % signs that wont be taken as placeholders.

    • Also you may use <$nd> to specify &s that wont become color codes.


  • BE WARY of specifying a slot (for GooP commands). mainhand will always target what the player is physically holding, you must use %provided-slot% placeholder to target the slot of the item this was applied to.

  • When using the runSkillAs command to run a mythic skill, you must use the placeholder <goop.slot.provided> instead.

Simple Examples:

goop nbt adamage %player% %provided-slot% +10%

When applied, will basically 'sharpen' an item, giving it extra 10% attack damage relative to what it already has.

This command, however, can be applied repeatedly; potentially causing unbalancing. You must use a mythic skill to set a limit.


goop mythicmobs runSkillAs MRBM_FlameRing %player%

This way, you can use the power of MythicMobs as if you were applying a Gem Stone to an item.


goop nbt cModelData %player% %provided-slot% 30

Supposing it is in a Gem Stone called 'ice gemstone;' Will change the texture of the item it is applied to (presumably, to an icy look)!

Example: A weapon that allows players to craft special arrows (MythicMobs)

This weapon, meant for mage class, has the unique ability of 'blessing' spectral arrows into magical arrows; at the cost of some crafting ingredients that the Mage who is using it must have in their inventories.

  • This will execute a Mythic Skill upon being 'applied' (GooP)

  • Will target the item being applied to using <goop.slot.provided> (GooP)

  • The Mythic Skill will run a series of GooP commands to check for ingredients (MythicMobs)

  • The commands will consume ingredients if the player has enough, and craft the arrows (MythicMobs)

1: Getting the items ready

The very first thing to do is have the sword, the arrow, and the crafting ingredient(s) ready.

2: The OnApply Command

Simply enough, it forces the player to run a mythic mobs skill.

goop mythicmobs runSkillAs Polarstar_Conversion %player%

3: The Mythic Skill

Sometimes you want to target a very specific item (in this case, vanilla spectral arrows) so that you cannot use an OnApply Mask. This is the case, so it checks that the target item is specifically what we are searching for.

You can add as many crafting ingredients, each must be bound to their own scoreboards though.

# Skill called by the OnApply command. Will test for crafting ingredients first.Polarstar_Conversion: Cooldown: 0.2 Skills:
# Starts with fresh scoreboards - settargetscore{objective=acraft;value=0} @Self{targetcreative=true} - settargetscore{objective=sarrow;value=0} @Self{targetcreative=true}
# Count the number of RARE_ESSENCE in the player's inventory. Set this to their acraft score. - command{c="goop testinventory <target.name> any m MATERIAL RARE_ESSENCE acraft amount"} @Self{targetcreative=true}
# The target item must be a vanilla SPECTRAL_ARROW - command{c="goop testinventory <target.name> <goop.slot.provided> v SPECTRAL_ARROW 0 sarrow 4"} @Self{targetcreative=true}
# Allow the commands to run to completion (not 100% sure if necessary?) - delay 1
# Run the next skill to evaluate the scoreboards - skill{s=Polarstar_Conversion_Exec}
# Will only run if enough ingredients are therePolarstar_Conversion_Exec: Conditions:
# The player must be applying onto a SPECTRAL ARROW (in which case the score will be 4 instead of 0) - score{objective=sarrow;v=>1}
# Must have more than 15 RARE_ESSENCEs (at least 16) - score{objective=acraft;v=>15}
Skills:
# Transforms the spectral arrows into POLARSTAR_ARROWS (the +0 means that it will keep the count the same). - command{c="goop nbt setItem <target.name> <goop.slot.provided> m AMMO POLARSTAR_ARROW +0"} # Consumes 16 RARE_ESSENCES from the player's inventory - command{c="goop consumeitem <target.name> m MATERIAL RARE_ESSENCE 16"}

Undesirable double consuming (in consumables)

Sometimes MMOItems consumables apply themselves (Identify scrolls, Crushers...) and, if they have an OnApply command, end up consuming themselves twice (because the command runs and consumes one as well).

Enable the not-consume-on-apply stat to prevent this.

Comment from the Dev:

The Polarstar sword texture is 'Spark,' by Rose. Arrow and essence are my edits and recolours. Those magical arrows act like the magnet sphere from Terraria, it is just not relevant to the example, and that uses MythicMobs + XBow2RL.