Writing effects¶
The shape¶
effects:
- id: <effect id> # from the effects page
args: # the effect's own args, plus the optional ones
amount: 5
chance: 50 # percent
cooldown: 3 # seconds, per player
delay: 1 # seconds
every: 3 # only every third firing
repeat: 2
triggers: [<trigger id>] # omit for a permanent effect
filters: # optional; keys from the filters page
blocks: [stone]
conditions: # optional; ids from the conditions page
- id: below_y
args: { y: 30, inverse: false }
mutators: # optional; run before the effect
- id: location_to_victim
Placeholders and maths¶
Any arg can use placeholders and arithmetic. The trigger's own facts come
free: %value% (damage, count, amount), %material%, %entity_type%,
%player_health%, %player_y%, %world%, %victim%. PlaceholderAPI
placeholders work too if it is installed. chance: "50 * (%player_health% / 20)"
is a chance that falls as health does.
Chains¶
Several effects that must fire together:
effects:
- triggers: [kill_boss]
args: { chance: 25 }
effects: # an inline chain: one roll, all run
- id: play_sound
args: { sound: ui.toast.challenge_complete }
- id: firework
- id: give_money
args: { amount: 500 }
Reusable chains live in Ember Fx Core's config.yml under chains: and are
called with run_chain: { chain: <id> } from any plugin.
From your own plugin¶
Ember Jobs Premium exposes the registry:
import com.themeanone.emberjobs.premium.JobsAPI;
import com.themeanone.emberfxcore.*;
JobsAPI.registerEffect(new Effect() {
public String id() { return "myplugin_reward"; }
public void run(Context ctx, Args args) {
MyPlugin.give(ctx.player, args.number("amount", ctx, 1));
}
});
From that moment - id: myplugin_reward works in every job file. Ids are
first-come; a built-in cannot be replaced.