Status
Not open for further replies.

dombo813

Veteran
Veteran
Joined
May 3, 2014
Messages
42
Reaction score
3
First Language
English
Primarily Uses
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".
 

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
579
First Language
Norwegian
Primarily Uses
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.
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
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.
 

dombo813

Veteran
Veteran
Joined
May 3, 2014
Messages
42
Reaction score
3
First Language
English
Primarily Uses
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"?
 

dombo813

Veteran
Veteran
Joined
May 3, 2014
Messages
42
Reaction score
3
First Language
English
Primarily Uses
Fantastic, thanks! Solves some other issues I didn't know I was going to encounter too.
 

---

-
Member
Joined
Sep 15, 2017
Messages
26
Reaction score
5
First Language
-
Primarily Uses
RMMV
@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.
 
Last edited:

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
579
First Language
Norwegian
Primarily Uses
As an experiment, did you try without the color?
True, it shouldn't necessarily affect things, but you never know...
 

---

-
Member
Joined
Sep 15, 2017
Messages
26
Reaction score
5
First Language
-
Primarily Uses
RMMV
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

 

---

-
Member
Joined
Sep 15, 2017
Messages
26
Reaction score
5
First Language
-
Primarily Uses
RMMV
@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".
 

Kevin Hirst

Veteran
Veteran
Joined
Sep 28, 2017
Messages
81
Reaction score
10
First Language
English
Primarily Uses
RMMV
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
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@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);
 

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
579
First Language
Norwegian
Primarily Uses
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.
 

ty66kill

Villager
Member
Joined
Sep 12, 2013
Messages
22
Reaction score
1
Primarily Uses
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 ???
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,880
Reaction score
14,706
First Language
English
Primarily Uses
RMVXA

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.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit
some test stuff. Empty for now. My other project (this project) needs more attention. The lagging really kicks up when I try to capture gameplay. ✨
Real-Time Battles, Pixel Filter, Animate Cursor & Menus & Windows | RPG Maker News #114

When your side job becomes more interesting than your dayjob and you think "do I quit again or finally actually do the same thing for more than five consecutive years..." I don't think I'll ever be able to say that though, I just cannot stick with one thing like you're 'supposed to'.

Forum statistics

Threads
113,884
Messages
1,078,179
Members
147,973
Latest member
Absent_Dreamer
Top