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,459
Reaction score
3,536
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,459
Reaction score
3,536
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


Clarn Hold
(No storylines)
There was a tutorial on how to draw anime eyes. Just draw Among Us. So I tried.
Screenshot_107.jpg
DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.

Forum statistics

Threads
125,540
Messages
1,171,816
Members
164,613
Latest member
dulichvungtaudl3m
Top