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.
Random mp or Tp cost?
JS Plugin RequestsWhen 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?
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?
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 😉
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.
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.
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
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
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)?
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)?
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.
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.
I think this will prevent the skill being used if the user doesn't have enough TP.Code:<Custom TP Cost> // Add a random number 0~5 to the skill cost cost += Math.randomInt(6); </Custom TP Cost> - <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.
This won't reduce the user's TP below zero.Code:<Before Eval> var skillCost = Math.randomInt(6); user.gainTp(-skillCost); </Before Eval>
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 ^^
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 ^^
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.
<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.
I've moved this thread to Plug-In Requests. Thank you.
Oh yes, whoops. Looks like <Custom Cost Display> adds text rather than replacing it. 😴 In that case maybe the <Before Eval> thing would be worth a try?
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);
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
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
In the example @caethyril provided the code functions like so:
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.
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:
var skillCost = Math.randomInt(6);
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));
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!
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:
I.e. if the skill user has at least 5 TP, the skill is usable, otherwise it isn't. 🙏
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>
Original thread: https://forums.rpgmakerweb.com/threads/random-mp-or-tp-cost.106817/