Random mp or Tp cost?

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
Is there any plugin to make a skill cost a random amount of mp or tp? I know i can do it with variable (the only thing that can be random), but it's getting complicated.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
415
First Language
English
Primarily Uses
RMMV
When do you want the randomness to happen?

For instance, do you want to make sure that every turn the cost changes before casting (so if you have 60 MP, on turn one you can use the skill because it costs 50, but on turn two you cannot because it costs 100)?

Or do you want the skill to be usable with a flat base cost, and take off some extra on top (so you always need 50 MP to activate the skill, but it might take anywhere from 50 to 100 mp when actually used)?

Or do you want the skill to have a random MP cost when initially learned, which stays fixed (so heal might always cost 57 MP, or 42, and you just have to live with it)

Or something else?
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
it will be a fluctuation. Some skill will cost 1-8 tp for exemple, and some will gain 1-8 tp. Why is that, it's because when you reach a certain amount of TP, an event will occur giving you some bad status effect if you desequilibrate too much your chi (I named my TP chi). So you start at 50 but if you go down to 40 or up to 60, something bad might randomly happen. So i need to have the cost of skill to be random between +X and +Y or -X and -Y that i will determine for the skill itself! Using multiple time the same skill will boost it, but might cause bad effects on you. Yin and yang ;)
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
This doesn't answer the original question. When do you want the randomisation to occur? Do want the cost randomised every turn in battle, at every actors input, at the start of battle, when the skill is learned, when the game is created, on moving to a new map, on a day/night cycle basis? Is this to be shown in the actual skills cost? If it isn't, what do you do when the skill fluctuates to cost more than originally displayed base cost?
There's too many unknowns for anyone to answer your question.
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
This doesn't answer the original question. When do you want the randomisation to occur? Do want the cost randomised every turn in battle, at every actors input, at the start of battle, when the skill is learned, when the game is created, on moving to a new map, on a day/night cycle basis? Is this to be shown in the actual skills cost? If it isn't, what do you do when the skill fluctuates to cost more than originally displayed base cost?
There's too many unknowns for anyone to answer your question.
Every time the skill is used, it will be a random tp cost (determine with the specific skill like skill JUMP always cost 1 to 8 tp each time it s used) for the charactwr who used it.
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
So still no one knows a pluggin that can do that? I am really surprise to not find that.

Having the possibility to make a skill cost x to y mp or tp might be really usefull for full of things.

I can do the same with variable and a common event attach to a character but it gives so much work and it needs to be repeated for each character instead of just a script line in the skill making the skill cost change.

Would be nice at the same time that the skill might cost x to y hp or x% to y% hp mp or tp
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
415
First Language
English
Primarily Uses
RMMV
You still haven't explained when you want the skill cost to be randomized.

Let's say I'm Bob The Fighter. I have 50 TP and open my skill menu and look at Jump.

Do I see the randomized cost of Jump right now (so Jump might cost 12 tp or 6 tp or negative 7 tp), and then choose whether I want to use the skill?

Do I just see 'Jump - varies between plus or minus 12', and get to select the skill (and have to gamble on the unknown results of it)?
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
The second one. You have 50 TP, you want to use jump (not sure how i will write how much tp it use, maybe just a yin or yang simbol to say that the cost is low or 3 yin or yang symbol to say thst the cost might be high...) and you dont really know how much it will cost, just have average idea, and thats when youcast it that you can see how much ot costed you. Next time it might be more or less.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,118
Reaction score
1,526
First Language
EN
Primarily Uses
RMMZ
I think Yanfly's Skill Core plugin may be able to do what you want:
  • <Custom Cost Display>
    Lets you specify how to display the skill cost via message codes, so you could have a yin/yang icon or whatever instead of showing the actual cost. [Edit: actually looks like it just adds text, see follow-up posts for potential workaround.]
  • <Custom TP Cost>
    Lets you customise the cost of the skill directly, e.g.
    Code:
    <Custom TP Cost>
    // Add a random number 0~5 to the skill cost
    cost += Math.randomInt(6);
    </Custom TP Cost>
    I think this will prevent the skill being used if the user doesn't have enough TP.
  • <Before Eval> - in case <Custom TP Cost> doesn't work out right...
    This runs before checking if the skill hits, you may be able to use it to fake an increased skill cost, e.g.
    Code:
    <Before Eval>
    var skillCost = Math.randomInt(6);
    user.gainTp(-skillCost);
    </Before Eval>
    This won't reduce the user's TP below zero.
If you want something special to happen when the skill is used but the user doesn't have enough TP to pay the cost, that'll be more complicated.
 
Last edited:

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
I should really try to learn lunatic code. I really dont understand anything to it ^^

Anyway, i will try these codes, thanks.

I need the tp to not go below 0 and an event will trigger when a character reach a certain amount of tp so i dont need anything else for the skill. And i need the tp to not exceed 100 for exemple. So even if the player has 96 tp and the cost would generste 12 tp, it will just cap at 100. Same for 0. Cant wait to try it ^^
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
Unfortunatly, when I put the code, I can't hide the skill cost. I can put a picture, but still a "random" skill cost will appear since I set it to be random


<Custom Cost Display>

\i[4]

</Custom Cost Display>



<Custom TP Cost>

cost += Math.randomInt(6)+1;

</Custom TP Cost>

And also, it really helps for the cost, but how does it work for the GAIN? Instead of losing TP, you gain them.
 

bgillisp

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

I've moved this thread to Plug-In Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,118
Reaction score
1,526
First Language
EN
Primarily Uses
RMMZ
Unfortunatly, when I put the code, I can't hide the skill cost. I can put a picture, but still a "random" skill cost will appear since I set it to be random
Oh yes, whoops. Looks like <Custom Cost Display> adds text rather than replacing it. :kaoslp: In that case maybe the <Before Eval> thing would be worth a try?
And also, it really helps for the cost, but how does it work for the GAIN? Instead of losing TP, you gain them.
gainTp can accept negative values; as you see in my example I've put a minus in front of the input:
Code:
user.gainTp(-skillCost);
Basically, that means "lose TP equal to the value of skillCost". :)
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
The before eval wont change the cost display in the menu for exemple.

The code you put, i havent tried it yet but it looks more like i would pay the tp cost then gain back the same amount of tp isnt it? It s getting conplicated haha maybe i will just work with the event and variable
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
In the example @caethyril provided the code functions like so:

Code:
var skillCost = Math.randomInt(6);
This makes a new variable, a thing that holds information, and says that it equals a random number between 0 and 5. This line has no affect on the actors TP.

Code:
user.gainTp(-skillCost);
This line says run the script user.gainTp(value) with the negative value of skillCost (the variable we made in the line above), so a random number between -5 and 0. Once the script runs, it looks at the actors tp then adds the value that was provided (-5 to 0). Because we're adding a negative number this acts like subtracting a positive. As such, this line is saying reduce the actors tp by a random number between 0 and 5, which I believe is the desired effect.

If you'd prefer to just have one line you can use this, it will have the same effect:

Code:
user.gainTp(-Math.randomInt(6));
 

Keruwb

Villager
Member
Joined
Jun 19, 2016
Messages
16
Reaction score
0
First Language
French
Primarily Uses
sweet thanks. Just need to fix the problem to delete the TP cost on the skill menu and battle box to replace it by a picture or a text that i choose!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,118
Reaction score
1,526
First Language
EN
Primarily Uses
RMMZ
Given the cost thing only seems to add extra text, you might need to set the skill cost to zero in the database (should remove the TP cost text) and use another notetag to limit when the skill is usable, so your skill's notebox may end up looking like this:
Code:
<Custom Cost Display>
\i[4]
</Custom Cost Display>

<Before Eval>
var skillCost = Math.randomInt(6);
user.gainTp(-skillCost);
</Before Eval>

<Custom Requirement>
if (user.tp >= 5) {
  value = true;
} else {
  value = false;
}
</Custom Requirement>
I.e. if the skill user has at least 5 TP, the skill is usable, otherwise it isn't. :kaothx:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top