Formulas in skill descriptions

● ARCHIVED · READ-ONLY
Started by dombo813 20 posts View original ↗
  1. Is it possible to have a calculated number in a skill description, similar to the way League of Legends does? For example, I could have a spell that deals 4x Magic Attack + 10 damage, and applies the state "On Fire" to the target. I would like to display this to the user as "Deals (X) Fire Damage, and may set the target on fire". So if the player had 16 Magic Attack, it would say "Deals 74 Fire Damage", and if they had 24 Magic Attack it would say "Deals 106 Fire Damage".
  2. I do believe so, yes; pretty certain I've seen a script do precisely that - I thought it was one of Yanfly's plugins, but I can't seem to find it right now... but I'm pretty sure there's such a script out there in the more easily available collections.
  3. You can use my WAY_EvalText plugin for that. With that plugin, you put a ${ } in any kind of textbox. Between the brackets you can input any JavaScript Code.
    You can use the following variables as well:
    a - references the current selected actor (or the leader if there is no)
    p - game party
    s - switch
    v - variable
    item , skill - refers to the actual item or skill you are in. (If you are inside
    the description box of skill or item)

    You find the plugin file here: https://github.com/waynee95/mv-plugins/blob/master/dist/WAY_EvalText.js
    You also need my WAY_Core: https://github.com/waynee95/mv-plugins/blob/master/dist/WAY_Core.js

    To download both plugin, just right click on "raw" and then "save as". Save both plugins as a .js file and add them to your plugins folder. Then import them in the plugin manager. Make sure that WAY_Core is above WAY_EvalText.
  4. I went through Yanfly's stuff cos it felt like something someone would have already done but I didn't notice anything like that. Same for Hime and VE. I don't know any other easily available collections.

    @waynee95 that sounds like it'll do the job! I have very little confidence in my javascript abilities so this is probably wrong but... for the above example would I do "Deals ${a.mat * 4 + 10} Fire damage"?
  5. Fantastic, thanks! Solves some other issues I didn't know I was going to encounter too.
  6. @waynee95 I tried to use your plugins to do a "League of Legends description" but I have no idea where I'm wrong.

    U6Pou

    Description of the skill: \c[50] ${a.mat * 4 + 10} \c[0]... [Rest of the description]

    93XUUBk

    I switched off the rest of the plugins, but nothing changed.
  7. @El Dragón Blanco
    I can't see the images.

    What is the issue exactly? That the color gets not applied?
  8. waynee95 said:
    @El Dragón Blanco
    I can't see the images.

    What is the issue exactly? That the color gets not applied?

    @waynee95

    I need more classes about forums >.<

    The order of the plugins:




    I put this in the editor:




    and ingame happened this:

  9. As an experiment, did you try without the color?
    True, it shouldn't necessarily affect things, but you never know...
  10. Yes, I tried it....

    Oh, I think I found the problem. I copied wrong the file of the plugin.

    ---

    Edit: Yes, I copied wrong. Now its fine

  11. waynee95 said:
    @El Dragón Blanco
    So it's all working? :)

    Yes. Now yes. Yesterday I was trying to write these numbers with other plugin and I got crazy. Normally I revised the plugins to verify that all is correct, but no yesterday...

    Thanks for the plugin. Now, I can continue with my League of Legends RPG Maker with more "LoL".
  12. This is a great plugin, but I have a few questions.

    Question 1 (not that important)
    It doesn't work with my formula that calls upon the target stat, say b.def. I'm not sure if it can can work with that as you would have to be targeting something. Either way, I can use the actor def as a workaround and just add that the damage may vary depending on target defense.


    Question 2
    I am also trying to get it to work for a skill that has a complex formula. It uses a different plugin where I wrote some javascript code in the notetag. Here is the notetag for the complex skill that I want to use.
    [It adds barrier points to the target based on the formula, (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*b.mdf))*1)), but it capped at the target's max HP value]

    <custom target barrier>
    if (target.barrierPoints(-1) == null)
    {
    var currentbarrier = 0;
    }
    else
    {
    var currentbarrier = target.barrierPoints(-1);
    }
    var maxbarrier = (target.mhp);
    if((target.mhp - currentbarrier) >= (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*b.mdf))*1)) {
    var barrierHP = (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*b.mdf))*1);
    }
    else {
    var barrierHP = (target.mhp - currentbarrier);
    };
    value = barrierHP;
    </Custom Target Barrier>

    Since the description box is only 2 lines, that won't fit. So I removed all the line breaks from the code and tried both the following. I'm guessing if it does work, I probably broke the code by changing the format. I also changed any reference to the target to user (a).

    So my question here is would code that use the notetags like this work in the description?
    If so, would anyone have any idea how to format such a code onto a single line?
    I can try play around with the spaces, but I didn't want to waste my time unless I can confirm that it can work and it is just a broken code in this format.


    ${<custom target barrier>if (a.barrierPoints(-1) == null){var currentbarrier = 0;}else{var currentbarrier = a.barrierPoints(-1);}var maxbarrier = (a.mhp);if((a.mhp - currentbarrier) >= (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*a.mdf))*1)) {var barrierHP = (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*a.mdf))*1);}else {var barrierHP = (a.mhp - currentbarrier);};value = barrierHP;</Custom Target Barrier>}

    ${if (a.barrierPoints(-1) == null){var currentbarrier = 0;}else{var currentbarrier = a.barrierPoints(-1);}var maxbarrier = (a.mhp);if((a.mhp - currentbarrier) >= (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*a.mdf))*1)) {var barrierHP = (((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*a.mdf))*1);}else {var barrierHP = (a.mhp - currentbarrier);};value = barrierHP;}



    Question 3
    A workaround to question 2 is to just use my actual formula ${(((-304.08163)+(40.40816*a.atk))*(0.99606+(0.00394*b.mdf))*1);}else {var barrierHP = (target.mhp - currentbarrier)} and just add in the description that it caps at the user HP.

    This works, but the number returned goes to 9 decimal points, because of the nature of the formula. Is there anyway that I can get the number to be returned rounded to the nearest integer?


    Again, thanks for the great plugin
  13. @Kevin Hirst
    Thanks! :)

    There is no "target" variable, because when that code is evaluated there is no target yet even if it would be a skill description shown in battle. I would just say either use a static number or make it base of a.def

    You can't input a notetag into the ${}.

    To round a number you can use Math.floor(value);
  14. Awesome, thanks!
  15. Question 1 (not that important)
    It doesn't work with my formula that calls upon the target stat, say b.def. I'm not sure if it can can work with that as you would have to be targeting something. Either way, I can use the actor def as a workaround and just add that the damage may vary depending on target defense.
    I'd just omit the part of the formula that holds the target's defense calculation and state that the skill does "X damage to a defenseless target". Simple, honest and the player should know to expect to see lower output in battle.
  16. waynee95 said:
    You can use my WAY_EvalText plugin for that. With that plugin, you put a ${ } in any kind of textbox. Between the brackets you can input any JavaScript Code.
    You can use the following variables as well:
    a - references the current selected actor (or the leader if there is no)
    p - game party
    s - switch
    v - variable
    item , skill - refers to the actual item or skill you are in. (If you are inside
    the description box of skill or item)

    You find the plugin file here: https://github.com/waynee95/mv-plugins/blob/master/dist/WAY_EvalText.js
    You also need my WAY_Core: https://github.com/waynee95/mv-plugins/blob/master/dist/WAY_Core.js

    To download both plugin, just right click on "raw" and then "save as". Save both plugins as a .js file and add them to your plugins folder. Then import them in the plugin manager. Make sure that WAY_Core is above WAY_EvalText.


    ->

    show us a example line please...

    ${$gameActors.actor(actorId).param[2]} = a.atk ???
  17. ty66kill, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


    Odds are high the posters are not watching this thread when it is that far back and will never see the post or reply. Best to start a new thread to inquire.