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
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.
Edit;

Alright, so it works like a charm! I'm playing with the formula right now, to see if I get a damage conversion value based on the amount spent, instead of it being a 1 for 1 conversion. Thanks a lot for your help so far.


Still need to figure out something for debuffs and armor breaks, but I think I can wing it. Thank you to all of you!
 
Last edited by a moderator:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
So, I liked that idea and I was toying with it but wasn't satified with my solution using 2 skills, a common event and multiple variables.


Here is a solution that requires only one skill, one variable, no common event and doesn't require yanfly's skill core to boot:




Notetag:



<setup action>
eval: $gameMessage.setBackground(1)
eval: $gameMessage.setPositionType(1)
eval: $gameMessage.add("How much HP do you want to spend?")
eval: $gameMessage.setNumberInput(3, 1);
if $gameVariables.value(3) >= user.hp
break action
else
HP -VARIABLE 3: user, show
end
</setup action>


This will display a message, ask for player input, and, if the player has enough hp, go through with the spell, and abort if he doesn't.



The downside is that because it doesn't go through a common event it's much less intuitive for a game developper unfamiliar with action sequences and javacript, both to use and to modify.
 
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
So, I liked that idea and I was toying with it but wasn't satified with my solution using 2 skills, a common event and multiple variables.


Here is a solution that requires only one skill, one variable, no common event and doesn't require yanfly's skill core to boot:




Notetag:




<setup action>
eval: $gameMessage.setBackground(1)
eval: $gameMessage.setPositionType(1)
eval: $gameMessage.add("How much HP do you want to spend?")
eval: $gameMessage.setNumberInput(3, 1);
if $gameVariables.value(3) >= user.hp
break action
else
HP -VARIABLE 3: user, show
end
</setup action>


This will display a message, ask for player input, and, if the player has enough hp, go through with the spell, and abort if he doesn't.



The downside is that because it doesn't go through a common event it's much less intuitive for a game developper unfamiliar with action sequences and javacript, both to use and to modify.
So by what you're saying, if I wanted something that was easier to tether to action sequences, I'd use the old style, but if I wanted to optimize my skill/menu useage, I'd use this style?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
If your game is massive, the number of skills and common events could be a limiting factor.


Having a self contained skill is also less error prone, and is easier to copy paste should you need several skills based on this one.


Lowering plugin requirements is also better in terms of possible incompatibilities.


On the other hand, having a common event called allows you to use the event commands to make your skill effects and calcultations for more advanced skills.


Action sequences allow you to do the same, but require a specific syntax to be learnt or straight up to know javascript.


You could probably do an hybrid of the two possibilites too, calling a common event to do the display and calculations but keeping it contained to a single skill.


Use whatever you're most comfortable with is my advice. I'm just providing another way to do such a skill.
 

40Flashkick

The Motivated and Too Ambitious
Member
Joined
Dec 26, 2016
Messages
14
Reaction score
2
First Language
English
Primarily Uses
If your game is massive, the number of skills and common events could be a limiting factor.


Having a self contained skill is also less error prone, and is easier to copy paste should you need several skills based on this one.


Lowering plugin requirements is also better in terms of possible incompatibilities.


On the other hand, having a common event called allows you to use the event commands to make your skill effects and calcultations for more advanced skills.


Action sequences allow you to do the same, but require a specific syntax to be learnt or straight up to know javascript.


You could probably do an hybrid of the two possibilites too, calling a common event to do the display and calculations but keeping it contained to a single skill.


Use whatever you're most comfortable with is my advice. I'm just providing another way to do such a skill.
Alright, I'll keep all this in mind. Thanks again man.
 

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