Custom Abilities: Targeters - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

Targeters are a vital component of functions. They allow you to enter a placeholder value that changes based on the context of the ability being fired. For example, when you want to use the damage keyword to damage a player, the amount of damage stays the same but the targeted player changes based on the context of the execution.

Please keep in mind that every targeter must start with a "?", that is how the interpreter recognises targeters.

Example

Let's say for example we have a keyword by the name of test with two arguments, the first is a targeter that is expecting a living entity and the second is an integer. It would look something like this:

- 'test(?player, 5)'

This would pass the player that executed the ability and the number five. Keep in mind that not all targeters are valid with every ability trigger and every keyword. Please make sure that the targeter you use is both valid by the keyword and by the ability trigger.

If you make a mistake, it is possible that the interpreter will catch your mistake, but it will not correct you if you put a valid targeter in the wrong argument. In this case, an error will likely occur and a warning will appear in console.

List of Valid Targeters

Below is a list of all valid targeters that you may reference while writing new abilities:

(Remember, this is an incomplete list and targeters can be removed and added at any time)

Targeter Description
?player References the player that executed the ability
?entity References the entity involved with the ability
?block References the block involved with the ability