Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
72
Reaction score
26
First Language
Français
Primarily Uses
N/A
Hello,
I have a little problem which I think the solution is very simple, but I can't solve it alone. I apologize in advance for opening a topic for this.

I use a state that causes the target affected by this state to always suffer a critical hit (we'll call it state A for the example).
Here is the script for this state:

Code:
<Custom Select Effect>
// Get the current skill
var skill = this.item();
// Check if the skill exists and can deal critical damage
if (skill && skill.damage.critical) {
  // Get the previous Critical Hit settings
  this._prevForcedCriticalHit = $gameSystem._forceCritical;
  this._prevForcedNoCriticalHit = $gameSystem._forceNoCritical;
  // Force the hit to be a critical hit
  BattleManager.actionForceCritical();
}
</Custom Select Effect>

<Custom Deselect Effect>
// Check if the previous settings exist
if (this._prevForcedCriticalHit !== undefined) {
  // Revert the Critical Hit settings to what they were before
  $gameSystem._forceCritical = this._prevForcedCriticalHit;
  $gameSystem._forceNoCritical = this._prevForcedNoCriticalHit;
}
</Custom Deselect Effect>

My problem is that in my game there is also a state that prevents the player from inflicting a critical hit (state B ).
For this one, I just changed the critical hit rate to -1000%.

As you will have understood, these two states come into conflict.
I would like to prioritize state B, but state A currently wins.
I think there is only one line to add, like "if the attacker is not affected by state B" but I really don't know javascript. I tried to get by with similar effects found on the internet, but it doesn't work.
Can somebody help me please ?
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
72
Reaction score
26
First Language
Français
Primarily Uses
N/A
Nobody ?
However, I had the impression that the solution was easy for someone who knows JavaScript.
Did I explain my problem incorrectly?
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,810
Reaction score
5,852
First Language
english
Primarily Uses
RMMZ

@Jay19, please do not bump your topic unless it has been 72 hours later since your last post. You can review our forum rules here. Thank you.

Please have patience, it's likely that members who could help you just haven't been online since you posted.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,226
First Language
English
Primarily Uses
RMMV
Code:
<Custom Select Effect>
// Get the current skill
var skill = this.item();
// Check if the skill exists and can deal critical damage
if (skill && skill.damage.critical && !target.isStateAffected(n)) {
  // Get the previous Critical Hit settings
  this._prevForcedCriticalHit = $gameSystem._forceCritical;
  this._prevForcedNoCriticalHit = $gameSystem._forceNoCritical;
  // Force the hit to be a critical hit
  BattleManager.actionForceCritical();
}
</Custom Select Effect>

<Custom Deselect Effect>
// Check if the previous settings exist
if (this._prevForcedCriticalHit !== undefined) {
  // Revert the Critical Hit settings to what they were before
  $gameSystem._forceCritical = this._prevForcedCriticalHit;
  $gameSystem._forceNoCritical = this._prevForcedNoCriticalHit;
}
</Custom Deselect Effect>
Replace n with the id of "state B".
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
72
Reaction score
26
First Language
Français
Primarily Uses
N/A
Hiddenone I'm really sorry. I will avoid doing this in the future.

Frostorm thank you very much for your reply. It works correctly, I just had to replace "target" with "user" (I never know which way to understand it but I know at least that when it's not one, it's the other ^^")
Thanks again =)
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,226
First Language
English
Primarily Uses
RMMV
Ah sorry, I did it in a hurry. I had a hunch it was "user" but I posted that while driving.
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
72
Reaction score
26
First Language
Français
Primarily Uses
N/A
No worries, you helped me a lot. And I now know that "!" means negation
 

Latest Threads

Latest Posts

Latest Profile Posts

By far, the weirdest flex I've ever seen on the internet is "I don't have the attention span to read what you wrote, but I REALLY want the world to know I don't have that attention span!".
Why... the FACK... do I work in customer service?!?!
Excuse me while I go question allllll my life choices.
DamageEvil_6.png added!
index.php

Sometimes I wonder why I still try and recruit others to help with my games. It never works.

Forum statistics

Threads
125,777
Messages
1,173,412
Members
164,930
Latest member
alantangyl
Top