Need help adjusting Yanfly's Tips & Tricks "Freeze"

cekobico

Veteran
Veteran
Joined
May 8, 2015
Messages
352
Reaction score
151
First Language
Indonesian
Primarily Uses
Linked here for the page.

I would like to adjust this state to ensure some balance within the game, as an instant-death kind of state is definitely a very one-sided effect that gives more advantage to enemies against the players.

Below is the code:
Code:
<Custom Respond Effect>
// Get the fire element ID.
var fire = 3;
// Check if fire damage is dealt.
if (this.item().damage.elementId === fire) {
  // Get the Freeze status effect ID.
  var stateId = 110;
  // Remove the status effect from target.
  target.removeState(stateId);
// Check if physical damage is dealt.
} else if (this.isPhysical() && target.result().hpDamage > 0) {
  // Set the target's HP to 0.
  target.setHp(0);
}
</Custom Respond Effect>
The current effect is that, when the target is hit with physical damage, it instantly set the target HP to 0, effectively killing the target. Instead of that, I'd prefer to have the target being struck with an additional damage, (with half damage value of the attack, and then remove the state). However, I'm unsure what code I should write there to replace the "target.setHp(0);" line.

Any ideas? Thank you in advance :D
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
227
First Language
English
Primarily Uses
replace target.setHp(0) with
var damagePlus = Math.floor(target.result().hpDamage * 0.5);
target.gainHp(-damagePlus);
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
693
Reaction score
213
First Language
Vietnamese
Primarily Uses
RMMV
Here. It is not too hard to make a change:
<Custom Respond Effect>
// Get the fire element ID.
var fire = 3;
// Check if fire damage is dealt.
if (this.item().damage.elementId === fire) {
// Get the Freeze status effect ID.
var stateId = 110;
// Remove the status effect from target.
target.removeState(stateId);
// Check if physical damage is dealt.
} else if (this.isPhysical() && target.result().hpDamage > 0) {
var bonus = Math.ceil(value * 0.5); //value is equal to the damage dealt, so we take half of it and add it to itself.
value += bonus;

}
</Custom Respond Effect>
 

cekobico

Veteran
Veteran
Joined
May 8, 2015
Messages
352
Reaction score
151
First Language
Indonesian
Primarily Uses
Just the way I wanted. Thank you very much guys :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

sooo I'm making the music for my game and yeah... prepare for a very non typical rpg ost... I don't even know how to make typical sounding stuff. I can do D&B, hiphop, glitch, and whatnot all day tho lol.
It's interesting that the logic involved in skill range obstructions is also used for Tetris...
Saw a resource and was like "Oh, there was a request for that, I can help that person now!"... turns out, request was nearly two years ago. Welp.
My garbage collection service has the BEST hold music I've ever heard. Sometimes, I legitimately hope to be on hold for more than a few minutes just to hear the song to completion.
Streaming now, maybe it will work this time!

Forum statistics

Threads
103,070
Messages
997,043
Members
134,534
Latest member
Jacob0915
Top