Variable HP Costs to Increase Skill effectiveness.

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
Recently for the Dark Knight class I was working on, I was trying to ebb out a way to make it so the Dark Knight's abilities can be enhanced by spending an amount of HP not set in stone, but rather, variable based on the player's input.


Example;


Skill: Soul Eater


"A skill that uses some of the User's HP to deal damage to all targets."


Base damage Formula: A. Atk * 4 - B. Def * 2


HP Cost: 100


That's the atypical design, however, I wanted to make it so that when the player uses the skill, the Cost is a Variable amount (in increments of 100) that changed the damage multiplier. So, say, if for every 100 HP the player spent, the damage increased by 10%, the skill itself has a tactical useage. If the player wants to dump 1000 HP into an attack, they could make the damage output twice as high.


I was also thinking this could be applied to debuff skills too. Using higher HP values could increase the duration of the debuff, or the debuff's effectiveness.


For Example;


Dark Poison


"User spends HP to inflict damage and a Poison Debuff on the opponent."


Duration: 2 Turns.


But, say, they could spend 500 HP to increase the duration by a turn. So they apply a longer debuff in exchange for the HP they spend.


Shadow Breakdown


"User spends HP to lower enemy Armor and Spirit values."


Enemies lose 15% Armor and Spirit.


But by spending 100 HP, they increase the % by 1. Spending 3500 HP could lower the enemy Armor/Spirit by 50%.


Anyway, those are all the conceptual ideas, I'm just unsure how to code them to bring them to life in the game itself. If you could offer some pointers or links to appropriate information, I would be very grateful.


Have a nice day!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
"How do I...?" questions belong in the Support forum for the engine you are using.  So, based on the info under your avatar


I've moved this thread to RPGMaker MV Support. Please be sure to post your threads in the correct forum next time. Thank you.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
well first you'd need to modify the skill implementation code so that you will be able to show an input box where the player chooses how much HP to spend and make sure that the battle scene waits until this input is processed.. This is actually a bit big thing to do and might easily cause conflicts with other battle scripts..
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
well first you'd need to modify the skill implementation code so that you will be able to show an input box where the player chooses how much HP to spend and make sure that the battle scene waits until this input is processed.. This is actually a bit big thing to do and might easily cause conflicts with other battle scripts..
So it's not a simple matter of 'Download a plugin and replace values here and there'. Ah man. Who knew game design was so hard, eh?


So I guess the first step is finding out how to implement the Input Box before the skill comes out.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Well, if someone already made a plugin for that, then you can ofc just download it... I'm not really browsing the plugins already made in MV but even back in Ace I never seen a script made for that.
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
What you describe is kinda similar to how Wizardry 6 - 8 did spell powers, though they used MP instead. Maybe someone made one using MP and it could be modified to do HP instead? If so look and see if someone made a plug-in that emulates Wizardry 6 - 8 spell casting behavior.


Or, if you can wait 3 - 5 years, I've always wanted to write such a plug-in. Though I don't need it for any of my first three projects that are planned, hence why the long wait (that and I have to still learn JavaScript, I still only know C and Ruby).
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
What you describe is kinda similar to how Wizardry 6 - 8 did spell powers, though they used MP instead. Maybe someone made one using MP and it could be modified to do HP instead? If so look and see if someone made a plug-in that emulates Wizardry 6 - 8 spell casting behavior.


Or, if you can wait 3 - 5 years, I've always wanted to write such a plug-in. Though I don't need it for any of my first three projects that are planned, hence why the long wait (that and I have to still learn JavaScript, I still only know C and Ruby).
I'll try and look that up, and see if I can work it around to fit my needs. Thanks for the tip in the right direction!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Np. Now I have no idea if such a plug-in exists, so it might still might come down to requesting such a plug-in.
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
Np. Now I have no idea if such a plug-in exists, so it might still might come down to requesting such a plug-in.
I wonder if I could just make a suggestion to Yanfly and cross my fingers.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
GUI out of the question, you might be able to achieve something like your first skill with eventing and a few already available plugins.


The idea would be to use a first spell that calls a common event to ask for a number input. That number you will store in a variable.


Then, using a script call or a plugin to find who cast the spell, and another to allow for dynamic hp costs using variables you could force the battler to cast the actual skill.


You'd use the variable that contains the number input in damage formula and the spell hp cost notetag. I believe yanfly has such a plugin, but it wouldn't be too much of an edit if I'm wrong.


The eventing itself is going to be tricky or require script calls (mostly for the force action part), but it's doable.


So to recap:

  • Cast dummy spell to trigger common event
  • In common event ask for the player to input a number, store that number in a variable.
  • Force action the battler with the actual spell.

Assuming v[1] stores the number, the dmg formula could be something like (base formula)*((v[1] + 1)/10 + 1) and with a hp cost like (v[1] + 1) * 100. Ask for 1 digit, then the player can spend from 100 to 1000 hp to boost dmg from 10 to 100%.


Using actions sequences and javascript you could probably do it without a common event.


For a proper GUI however, there will be no way around a plugin.


As for debuffs/states, those are likely trickier/impossible depending on what plugins you use, so I can't say.
 
Last edited by a moderator:

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
GUI out of the question, you might be able to achieve something like your first skill with eventing and a few already available plugins.


The idea would be to use a first spell that calls a common event to ask for a number input. That number you will store in a variable.


Then, using a script call or a plugin to find who cast the spell, and another to allow for dynamic hp costs using variables you could force the battler to cast the actual skill.


You'd use the variable that contains the number input in damage formula and the spell hp cost notetag. I believe yanfly has such a plugin, but it wouldn't be too much of an edit if I'm wrong.


The eventing itself is going to be tricky or require script calls (mostly for the force action part), but it's doable.


So to recap:

  • Cast dummy spell to trigger common event
  • In common event ask for the player to input a number, store that number in a variable.
  • Force action the battler with the actual spell.

Assuming v[1] stores the number, the dmg formula could be something like (base formula)*((v[1] + 1)/10 + 1) and with a hp cost like (v[1] + 1) * 100. Ask for 1 digit, then the player can spend from 100 to 1000 hp to boost dmg from 10 to 100%.


Using actions sequences and javascript you could probably do it without a common event.


For a proper GUI however, there will be no way around a plugin.


As for debuffs/states, those are likely trickier/impossible depending on what plugins you use, so I can't say.
That's... Hella smart. Damn. I'll give this a shot and come back with my results later. Good lookin' out. 
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
Thinking about it, you could use the method I described above to modify states duration/effect too. You'd just have to create a bunch of states, one for each possibility of HP cost, and apply the one you want. So If you spend 100HP you inflict the poison that lasts 3 turn, but if you spend 1000HP, you inflict the poison that lasts 5 turns.


You'd have to event something to make sure two of those states don't overlap. You most likely don't want the 3 turn version to overlap with the 5 turn version. I'd say just remove every state possibility and apply the one that corresponds to the current HP cost, but that's a design decision, you can do as you want.


For armor/spirit debuffs nothing comes to mind right now, but perhaps something like for states can be made.


It's a much bigger hassle than for your first kind of skill, and should probably be done with a plugin, but it looks like it's doable.
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
Thinking about it, you could use the method I described above to modify states duration/effect too. You'd just have to create a bunch of states, one for each possibility of HP cost, and apply the one you want. So If you spend 100HP you inflict the poison that lasts 3 turn, but if you spend 1000HP, you inflict the poison that lasts 5 turns.


You'd have to event something to make sure two of those states don't overlap. You most likely don't want the 3 turn version to overlap with the 5 turn version. I'd say just remove every state possibility and apply the one that corresponds to the current HP cost, but that's a design decision, you can do as you want.


For armor/spirit debuffs nothing comes to mind right now, but perhaps something like for states can be made.


It's a much bigger hassle than for your first kind of skill, and should probably be done with a plugin, but it looks like it's doable.
I suppose a simple fix to the first problem would be giving a player a 'growing' skill type. Similar to how Final Fantasy has the multiple levels of spells (Fire, Fira, Firaga), I could include a kind of Growing Skill that costs more to use as it goes up. So, say for the Poison ability, one that lasts 3 Turns costs 500 HP, but the 5 Turn version costs 1500. I'd have to make multiples of the skills, but that's more cost efficient. Then for the states, as you said, I can create stronger states as they go up. Poison State that lasts 3 Turns, Poison State that lasts 4 Turns, and one for 5 turns. 
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You also need to save the actor that used the skill and the target so that you can use force action on that actor to be used on the target. You could do that in the damage formula of the dummy skill. Force action accepts a variable for choosing actor and target right? If not then you'd need a plugin for that. XD
 
Last edited by a moderator:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
True, and this is probably the trickiest part of that process. I'd use yanfly's action sequences to do it. At action startup, store user in a game variable and target in another one, then call the common event. In the common event use a script call to force action using those two variables, because you can't use variables in force action by default in editor.


Edit: using the dmg formula of the dummy skill is clever. I hadn't thought of that.


The script call for force action can be found in this thread:
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You'd still use force action on the common event no need for script call version I think, just set variables to the actor and target on DF so you can force action the correct pair XD
 
Last edited by a moderator:

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
I'm sitting here looking between everything everyone is saying, going 'Woah, what a bunch of great ideas! Now, how do I actually do anything they're saying....'
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
@Engr. Adiktuzmiko The problem is that you can't use variables for force action in editor. You have to select the actors or enemy indexes from a drop down menu. That's why you need to use the script call version. Or you could event something with a lot of conditionnals I guess.


@40Flashkick I'll try to make it happen tomorrow when I have some time. I'll share the screenshots.
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
@Engr. Adiktuzmiko The problem is that you can't use variables for force action in editor. You have to select the actors or enemy indexes from a drop down menu. That's why you need to use the script call version. Or you could event something with a lot of conditionnals I guess.


@40Flashkick I'll try to make it happen tomorrow when I have some time. I'll share the screenshots.
You are a god send my friend.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
So, I got it to work:


Skill 1:




Skill Notetag:



<setup action>
eval: $gameVariables.setValue(1,user)
eval: $gameVariables.setValue(2,target)
common event: 1
break action
</setup action>


1: store user in variable 1


2: store target in variable 2


3: call common event1


4: stop action execution



Common Event:




Script call:



var user = $gameVariables.value(1);
var target = $gameVariables.value(2);
user.forceAction(21, $gameTroop.members().indexOf(target));
BattleManager.forceAction(user);


21 is the ID of Skill2 in my game.


Input is the name of variable 3.



Skill2:




3 is the variable id in which we stored the number.



Result:

Input:





Dmg + Cost:





9 hp is appropriately withdrawn from casting actor, and 9 damage is dealt to the appropriate target. Succes!



This example requires: Yanfly Core engine, Yanfly Battle Engine Core, Action sequence Pack 1, Yanfly skill core.


All script calls used in this screenshot can be found in the "RMMV script call equivalent of event commands" google doc I linked to earlier.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,238
Members
137,608
Latest member
Arm9
Top