[Yanfly] JS Code Question(s) >>EASY<<

RetroBoy

Veteran
Veteran
Joined
Dec 16, 2016
Messages
378
Reaction score
261
First Language
English
Primarily Uses
Hey Folks,
Another newbie question from RetroBoy.


If I place this into the notebox of a skill, will it add a State prior to attacking and then remove the state after the attack is concluded, will that work?

I want to make a skill that has a higher critical chance. So, I have made a state which raises your critical chance. Will this work or is there a problem with it because of the code or a timing for when criticals are determined or something?

Code:
<Custom Pre-Damage Eval>
a.addState(161)
</Custom Pre-Damage Eval>


<Custom Post-Damage Eval>
a.removeState(161)
</Custom Post-Damage Eval>
Bonus Question: If I want to see if a Defender has one of the following states, is this how I do it?

Code:
<Select Conditions>
State: 84
State: 85
State: 86
</Select Conditions>
Or, would that mean to activate the skill the Defender would need to be afflicted with State 84, 85 and 86?

Sorry for asking all this stupid stuff but I am still learning.
 
Last edited:

Naveed

Veteran
Veteran
Joined
Nov 2, 2013
Messages
314
Reaction score
146
First Language
English
Primarily Uses
RMMV
For the first question, yes, your code is correct and do as you explained, but you used the wrong tags. You used <Custom Pre-Damage Eval> and <Custom Post-Damage Eval>, whereas the correct tags are <Pre-Damage Eval> and <Post-Damage Eval>

Code:
<Pre-Damage Eval>
a.addState(161);
</Pre-Damage Eval>


<Post-Damage Eval>
a.removeState(161);
</Post-Damage Eval>
Also, you do not need to apply a higher crit rate state just to have a skill have a higher chance of critically striking. The YEP_X_CriticalControl plugin has notetags that allow you to do just that.

On the skill notebox, you can use the following:

<Critical Rate: x%>

To set the critical rate to a flat value for that skill. If you want to use a formula instead (example taken from the plugin's help file):

<Critical Rate Formula>
rate = user.cri + 0.2;
rate -= 1 - target.cev;
</Critical Rate Formula>

The 'rate' variable that is returned will be the critical rate for that skill.


For the next question, that notetag will allow you to target an enemy only if they have all 3 states (84, 85 and 86). If you want to be able to target the enemy if they have any of the 3 states, you would use:

Code:
<Custom Select Condition>
var state1 = target.isStateAffected(84);
var state2 = target.isStateAffected(85);
var state3 = target.isStateAffected(86);
if (state1 || state2 || state3) {
  condition = true;
} else {
  condition = false;
}
</Custom Select Condition>
 

RetroBoy

Veteran
Veteran
Joined
Dec 16, 2016
Messages
378
Reaction score
261
First Language
English
Primarily Uses
Thanks Champ. Youre always helping. Its really kind of you.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top