EllTipprro

Villager
Member
Joined
Apr 14, 2021
Messages
10
Reaction score
5
First Language
Hungarian
Primarily Uses
RMMZ
Hi everyone!
Im new to this thing, so I need some help. The base idea is to have some skills increase a variable than once its high enough other skills become usable that would use the variable as the cost. - Somewhat like TP
I have Visustella core plugins. So far I was able to define the variable maximum and how to increase it, the bar in the ui also works as intended, the skill that TEMPORARY unlocks itself is also ready.
The problem: Once the bar is full the variable is still increasing and the unlocked skill does not use the up any of it. It needs 4 points to unlock, this part is ok, and it should spend all that you have, it does not.
Thanks for the help, guys!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,567
Reaction score
3,630
First Language
English
Primarily Uses
RMMV
I assume you're using JS Skill Visible or Enable to unlock the skill.

Skills (and games/code in general) don't do anything you don't tell them to. So if you haven't configured your thing to work with the built-in cost system, you need to tell the game to deplete it.

So possible solutions are:
1 - Change your cost from a variable to an item. You could make it a Hidden Item so the player doesn't see it in the party inventory, but then it would work with the plugin parameters and you could use the Type Cost notetags to do all of this automatically.

2 - Add code to decrease the variable when you use the skill. Looking at VisuStella's Battle Core, you could put:
Code:
<JS Post-Damage>
$gameVariables._data[X]-=Y;
</JS Post-Damage>

where X is the ID of the variable and Y is the cost.
 

EllTipprro

Villager
Member
Joined
Apr 14, 2021
Messages
10
Reaction score
5
First Language
Hungarian
Primarily Uses
RMMZ
I assume you're using JS Skill Visible or Enable to unlock the skill.

Skills (and games/code in general) don't do anything you don't tell them to. So if you haven't configured your thing to work with the built-in cost system, you need to tell the game to deplete it.

So possible solutions are:
1 - Change your cost from a variable to an item. You could make it a Hidden Item so the player doesn't see it in the party inventory, but then it would work with the plugin parameters and you could use the Type Cost notetags to do all of this automatically.

2 - Add code to decrease the variable when you use the skill. Looking at VisuStella's Battle Core, you could put:
Code:
<JS Post-Damage>
$gameVariables._data[X]-=Y;
</JS Post-Damage>

where X is the ID of the variable and Y is the cost.
OMG, Thank you!
It finaly works as intended. If I can bother you with just one last thing, how can I prevent the base skills from increasing the resource variable above a specific number? I want to have a maximum of points at a time at the start, than increase it with miles stone progression later, but right now there isnt a cap.
 

EllTipprro

Villager
Member
Joined
Apr 14, 2021
Messages
10
Reaction score
5
First Language
Hungarian
Primarily Uses
RMMZ
I solved it. If anyone plans to do something like this here is how to do it.
#1 Create 2 variables; one that is the maximum "charges" you can reach and one which is the current one
#2 Create 2 skills; one that deals damage and another that drains youre mp and calls a common event
#3 Create a common event that calls the damageing skill and adds to the current value x with an if statement which resets current value to maximum value if current would be higher than max
#4 Create a 3rd skill with damage formula 'base formula * v[2]' and add to the note box:

Skill Require Enable>

<JS Skill Enable>

enabled = $gameVariables.value(2) >= 4;

</JS Skill Enable>

<JS Pre-End Action>

$gameVariables._data[2]=0

</JS Pre-End Action>

#5 If you want to have bar showing the charges use the skillstatescore pugin; create a new resource type for maximum add the 1st variable abd for current the 2nd one


Im sure there are more effective ways to do this if you know how to code, but I dont
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,567
Reaction score
3,630
First Language
English
Primarily Uses
RMMV
#1 Create 2 variables; one that is the maximum "charges" you can reach and one which is the current one
#3 Create a common event that calls the damageing skill and adds to the current value x with an if statement which resets current value to maximum value if current would be higher than max
I don't understand why you need two variables here. In your common event, just say:
Conditional Branch -> Variable 2 < 4
--Control Variable -> 2 -> +1

So you only increase the variable if it's under your maximum. If your maximum is always the same value, then there's no reason for it to be a variable - variables are, by definition, things that can change.
 

Latest Threads

Latest Posts

Latest Profile Posts

Sometimes I wonder why I still try and recruit others to help with my games. It never works.
ScreenShot_10_3_2022_4_27_17.png
welp, thanks to Luna MV, I was able to add the Balloon as a window... thus allowing me to edit the font color and outline... so now it looks like comic bubbles above characters. I have NO idea why I couldn't get this to work through more conventional means, but here we are.
CUTE CUTE CUTE.gif
I cannot cease doing cute art
War and Wonder is a 100% choice-based open-world visual novel.
1664821313732.png
1664821466359.png
1664821547746.png
Going live soon on Twitch, and will continue Fortunastreet's game "Verloren". For those who are curious, you are welcome to join ;)

-> Franz' Twitch channel

Forum statistics

Threads
125,749
Messages
1,173,227
Members
164,911
Latest member
KyzerKiba
Top