Triggering the gaining of TP on critical hit.

Weremole

Veteran
Veteran
Joined
Jan 22, 2016
Messages
228
Reaction score
201
First Language
Swedish
Primarily Uses
I'm doing this as a universal passive state using Yanflys Buffs and States core and Passive States, I've tried several variations but I'm messing up somewhere.

<Custom Establish Effect>

if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical){



//If user TP is over 0.
if (user.tp >= 0){
/Calculate TP gain.
var value = Math.floor(user.tp * 2 * 0.25);
user.gainTP(value);
} else {
//If TP is at 0 add 25 TP.
var value = 25;
user.gainTP(value);

}



// Check if target is alive.

if (target.isAlive()) {

// Remove 25 TP from target.
if (target.tp >= 0){
var value = 25;
target.gainTP(-value);

}
}
}

</Custom Establish Effect>
 

Zerothedarklord

Veteran
Veteran
Joined
Jun 25, 2013
Messages
157
Reaction score
29
First Language
English
Primarily Uses
RMMV
this is mine that works perfect (this is in the State):


<Custom Establish Effect>

// Check if the attack is a physical attack that dealt HP damage from a critical hit.

if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {

user.gainTp(5);

}

</Custom Establish Effect>

It does exactly as your title asks, gaining additional TP when dealing a critical strike. by default in my game, attacking gives you 5 TP, so this passive state effectively means you get double TP when you deal a critical.
 

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

Latest Threads

Latest Profile Posts

This is on the Amazon page for the FF7 Remake: 'If you get the game early, please think of others and don't spoil it for them. Please don't post videos or screenshots of the game until it is officially on sale on April 10.'
Gave my avatar an update, stay safe, people!
I'm currently available for hire for scripting (and perhaps other things).
Also, don't worry, the Advanced Minimap plugin is a work in progress.
Hallelujah! Work is getting stricter on humans in the store.
Day 3 of mapping... at least the whole game its just one location :3 (Still taking forever...)

Forum statistics

Threads
95,622
Messages
930,500
Members
125,929
Latest member
RitBro
Top