Advertisement
CtelinAjira

Wild Magic Notetags

Aug 7th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <Custom Action Start Effect>
  2. //store current action and define skill types to trigger Wild Magic
  3. var magicSkills = [a, b, c, ...]; //replace [a, b, c, ...] with an array of skill types to trigger Wild Magic
  4. var action = user.currentAction();
  5.  
  6. //if the skill can trigger Wild Magic...
  7. if (action && action.isSkill() && magicSkills.contains(action.item().stypeId)) {
  8. //define which Wild Magic effect will take
  9. user._randomRoll = 4 + Math.floor(Math.random() * 10); //replace these numbers as you see fit
  10. //apply the selected Wild Magic effect on the user
  11. user.addState(user._randomRoll);
  12. }
  13. </Custom Action Start Effect>
  14.  
  15. //this part is optional, or can have if-else clauses for a case-by-case basis if you wish
  16. <Custom Action End Effect>
  17. //if the Wild Magic effect ID was defined earlier...
  18. user._randomRoll = user._randomRoll || 0;
  19. if (user._randomRoll !== 0) {
  20. //remove the Wild Magic effect
  21. user.removeState(user._randomRoll);
  22. }
  23.  
  24. //remove Wild Magic effect ID
  25. user._randomRoll = undefined;
  26. </Custom Action End Effect>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement