Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Custom Action Start Effect>
- //store current action and define skill types to trigger Wild Magic
- var magicSkills = [a, b, c, ...]; //replace [a, b, c, ...] with an array of skill types to trigger Wild Magic
- var action = user.currentAction();
- //if the skill can trigger Wild Magic...
- if (action && action.isSkill() && magicSkills.contains(action.item().stypeId)) {
- //define which Wild Magic effect will take
- user._randomRoll = 4 + Math.floor(Math.random() * 10); //replace these numbers as you see fit
- //apply the selected Wild Magic effect on the user
- user.addState(user._randomRoll);
- }
- </Custom Action Start Effect>
- //this part is optional, or can have if-else clauses for a case-by-case basis if you wish
- <Custom Action End Effect>
- //if the Wild Magic effect ID was defined earlier...
- user._randomRoll = user._randomRoll || 0;
- if (user._randomRoll !== 0) {
- //remove the Wild Magic effect
- user.removeState(user._randomRoll);
- }
- //remove Wild Magic effect ID
- user._randomRoll = undefined;
- </Custom Action End Effect>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement