Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I'm trying to add a check for three separate states (that cannot be used together) :


Power tactics : Reduces the hit and adds damage


Precision tactics : Increases hit and reduces damage


Speed tactics : Reduces Eva but increase every skill's SPD


Modifying Hit is easy (traits), but damage, on a global scale.... well i could add a conditionnal check on EVERY skill, but that would be clunky


Alternative would be using YF's damage core, it offers a hand in the game's "phases" of damage calculation, in which one could "easily" add a check.


After the line on physical damage calculation for exemple :


baseDamage = this.modifyBaseDamage(value, baseDamage, target);


INSERT LINE HERE (because the - or + damage would be affected by potential element resistances)


baseDamage *= this.calcElementRate(target);


Question  :


Any way to add 2 conditional checks for : If a state from 99 to 103 (Precise tactics) is present on initiator, add - Math.ceil (a.level * 0.5)


And  : If a state from 93 to 97 (Power tactics) is present on initiator, add + Math.ceil (a.level * 0.5)


Bonus question :


Any way to modify SPD without changing parameters ? (My Agi doesnt just add speed, but also Hit, Eva and more, so i can't modify it freely)


Thanks for reading
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Sooooo


I added on line 53 (under physical damage)


if (baseDamage > 0 && user.isStateAffected(93,94,95,96,97)) {value = baseDamage + Math.ceil(user.level * 0.5);}


Is that good ? is this how you handle multiple states ?


Edit : I'm at :


if (this.isPhysical()) {


if (baseDamage > 0 && user.isStateAffected(93)|| user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97)) {


(baseDamage = baseDamage + Math.ceil(user.level * 0.5));}


value = this.applyPhysicalRate(value, baseDamage, target);


}


In Bold, what i added


Still doesn't work
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Bump, I tried base damage += baseDamage + Math.ceil(user.level * 0.5)


Doesnt work, probably because i'm using baseDamage again ?


Anyway, still interested in a tip : )
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Still looking


The syntax isnt wrong, so it has to be sequence, or logic i'm missing out on
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,693
Reaction score
3,030
First Language
Tagalog
Primarily Uses
RMVXA
Try this condition instead


baseDamage > 0 && (user.isStateAffected(93)|| user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97) )


Also, where are you modifying that? The only places I found this.isPhysical on Damage Core was on the params... Or are you modifying the base script and not Damage Core?
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Are you telling me to remove the if ?


I kinda need the conditional check though no ? Yanfly used one for his initial runic blade tips


(He used : if (baseDamage > 0 && target.isStateAffected(13)) { value = 0; target.gainMp(item.mpCost) } )


I'm editing the Damage Core plugin of Yanfly, the steps of damage calculation, around lign 50 in his plugin (when right clicking on the plugin)


Sorry for the delay in answering
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,693
Reaction score
3,030
First Language
Tagalog
Primarily Uses
RMVXA
No, not remove the if but rather change the condition that you used to the one I posted. I'm not sure if it will work with that but at least, the groupings would be correct. 

I'm editing the Damage Core plugin of Yanfly, the steps of damage calculation, around lign 50 in his plugin (when right clicking on the plugin)



That means you're editing the plugin parameters :)  
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Interestingly enough, something CHANGED !


I got a proper adult-like error this time, instead of nothing


Damage overflow :

baseDamage = this.modifyBaseDamage(value, baseDamage, target);


baseDamage *= this.calcElementRate(target);



critical = this.modifyCritical(critical, baseDamage, target);
target.result().critical = critical;
value = baseDamage;


if (baseDamage > 0) {
value = this.applyDamageRate(value, baseDamage, target);



}


if (baseDamage < 0) {
value = this.applyHealRate(value, baseDamage, target);



}


if (critical) {
value = this.applyCriticalRate(value, baseDamage, target);



}


if (this.isPhysical()) {
if baseDamage > 0 && (user.isStateAffected(93)|| user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97)) {
(baseDamage += Math.ceil(user.level * 0.5));}
value = this.applyPhysicalRate(value, baseDamage, target);


value = this.applyFlatPhysical(value, baseDamage, target);
}


if (this.isMagical()) {
value = this.applyMagicalRate(value, baseDamage, target);


value = this.applyFlatMagical(value, baseDamage, target);
}


if (baseDamage > 0) {
value = this.applyFlatDamage(value, baseDamage, target);



}


if (baseDamage < 0) {
value = this.applyFlatHeal(value, baseDamage, target);



}


if (critical) {
value = this.applyFlatCritical(value, baseDamage, target);



}


value = this.applyVariance(value, item.damage.variance);



value = this.applyGuard(value, target);


value = this.applyFlatGlobal(value, baseDamage, target);
value = this.applyMinimumDamage(value, baseDamage, target);



EDIT :


Using base damage += baseDamage + Math.ceil(user.level * 0.5)


Got me a SyntaxError: Unexpected identifier
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,693
Reaction score
3,030
First Language
Tagalog
Primarily Uses
RMVXA
I'm pretty sure this 

if baseDamage > 0 && (user.isStateAffected(93)|| user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97)) 



should be

if (baseDamage > 0 && (user.isStateAffected(93)|| user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97)) )



coz the format is "if (conditions) {actions}" and not "if conditions {actions}"

base damage += baseDamage + Math.ceil(user.level * 0.5)



You placed a space there, base damage.
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
God this feels so basic yet so hard ^^


I removed user.level in case it was unrecognized, and replaced it with "5" to make checking easier


I'm at that now :


if (this.isPhysical()) {
if (baseDamage > 0 && (user.isStateAffected(93) || user.isStateAffected(94) || user.isStateAffected(95) || user.isStateAffected(96) || user.isStateAffected(97))); {
baseDamage += 5;}
value = this.applyPhysicalRate(value, baseDamage, target);


I still get unexpected token, oddly enough, on auto passive states,


And said error appears wether i have the "Power attack" state turned on or off


Edit : turning of Autopassive States removed the error, but still no damage increase


Edit 2 : turning it back on doesnt prompt an error anymore, but still no damage increase


Edit 3 : I replaced all the "user." with "a.", and got the auto passive error again.


Turned autopassive Off, retried


Got Equip requierement error, turned it off, retried


now its Equip core that has a problem, i think it's endless (not to mention I use those plugs for a reason)


All three errors were almost identical :


Yanfly.Util.displayError = function(e, code, message) {
  console.log(message);
  console.log(code || 'NON-EXISTENT');
  console.error(e);
 
Last edited by a moderator:

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
706
Reaction score
638
First Language
German
Primarily Uses
RMMV
You have a semicolon after your second condition (after the three closing brackets) that shouldn't be there. Also, in the last code you posted, you never close the block of the first if-statement (closing curly bracket is missing), but that might just be not copied correctly.
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I tried both with and without semi colons (i tried a lot of things, i've been on this for a month)


and yeah the bracket is just part of YF's code


Im using the a.level instead of user.level, and i get a damage flow error, unexpected identifyer, and this error in statusCore


Yanfly.Util = Yanfly.Util || {};


Yanfly.Util.displayError = function(e, code, message) {
  console.log(message);
  console.log(code || 'NON-EXISTENT');
  console.error(e);
  if (Utils.isNwjs() && Utils.isOptionValid('test')) {
    if (!require('nw.gui').Window.get().isDevToolsOpen()) {
      require('nw.gui').Window.get().showDevTools();
    }
  }
};


Complete code :

aseDamage = this.modifyBaseDamage(value, baseDamage, target);


baseDamage *= this.calcElementRate(target);



critical = this.modifyCritical(critical, baseDamage, target);
target.result().critical = critical;
value = baseDamage;


if (baseDamage > 0) {
value = this.applyDamageRate(value, baseDamage, target);



}


if (baseDamage < 0) {
value = this.applyHealRate(value, baseDamage, target);



}


if (critical) {
value = this.applyCriticalRate(value, baseDamage, target);



}


if (this.isPhysical()) {
if (baseDamage > 0 && (a.isStateAffected(93)|| a.isStateAffected(94) || a.isStateAffected(95) || a.isStateAffected(96) || a.isStateAffected(97))) {
baseDamage += Math.ceil(a.level * 0.5);}

value = this.applyPhysicalRate(value, baseDamage, target);


value = this.applyFlatPhysical(value, baseDamage, target);
}


if (this.isMagical()) {
value = this.applyMagicalRate(value, baseDamage, target);


value = this.applyFlatMagical(value, baseDamage, target);
}


if (baseDamage > 0) {
value = this.applyFlatDamage(value, baseDamage, target);



}


if (baseDamage < 0) {
value = this.applyFlatHeal(value, baseDamage, target);



}


if (critical) {
value = this.applyFlatCritical(value, baseDamage, target);



}


value = this.applyVariance(value, item.damage.variance);



value = this.applyGuard(value, target);


value = this.applyFlatGlobal(value, baseDamage, target);
value = this.applyMinimumDamage(value, baseDamage, target);



Short snippet of what i'm modifying (in bold)

}


if (this.isPhysical()) {
if (baseDamage > 0 && (a.isStateAffected(93)|| a.isStateAffected(94) || a.isStateAffected(95) || a.isStateAffected(96) || a.isStateAffected(97))) {
baseDamage += Math.ceil(a.level * 0.5);}

value = this.applyPhysicalRate(value, baseDamage, target);


value = this.applyFlatPhysical(value, baseDamage, target);
}

Thank you all for your time, i clearly can't handle it alone, or bypass it
 
Last edited by a moderator:

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
706
Reaction score
638
First Language
German
Primarily Uses
RMMV
Could you specify again which plugins you are currently using and where exactly you are modifying the code? I think I lost track.


EDIT: Nevermind, I just replicated the problem. Starting bughunting now.


EDIT2: Try this, @Nol:

Code:
if (this.isPhysical()) {
if (baseDamage > 0 && (a.isStateAffected(93)|| a.isStateAffected(94) || a.isStateAffected(95) || a.isStateAffected(96) || a.isStateAffected(97))) {
value += Math.ceil(a.level * 0.5);}
value = this.applyPhysicalRate(value, baseDamage, target);
value = this.applyFlatPhysical(value, baseDamage, target);
}
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
While this is closer than anything i have ever dreamt of achieving, and i thank you for that, the slight problem is that now the bonus damage isnt modified by the target's


physical resistance, (which i was hoping to get by playing with baseDamage).


Any idea about that would creating a new variable in between baseDamage and value work ?
 
Last edited by a moderator:

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
706
Reaction score
638
First Language
German
Primarily Uses
RMMV
If you use the Physical Damage Sp-Parameter for physical resistance, it should actually work this way (note that this.applyPhysicalRate is called after the extra value is added).


If you're working with Element rates instead, you can do this:

Code:
if (this.isPhysical()) {
if (baseDamage > 0 && (a.isStateAffected(93)|| a.isStateAffected(94) || a.isStateAffected(95) || a.isStateAffected(96) || a.isStateAffected(97))) {
var plus = Math.ceil(a.level * 0.5);
plus *= this.calcElementRate(target);
value += plus; }
value = this.applyPhysicalRate(value, baseDamage, target);
value = this.applyFlatPhysical(value, baseDamage, target);
}
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Congratulations, you just solved 2/3 of a problem that held me for over a month !


Thanks a lot, it's very satisfying to be unstuck :)


Should i keep the thread open for my bonus question (-which doesnt relate-) or leave this one in use ?

Bonus question :


Any way to modify SPD without changing parameters ? (My Agi doesnt just add speed, but also Hit, Eva and more, so i can't modify it freely)

I'm missing the state that buffs your spd


Waiiiiiiiiit a minute, i might be able to do that with simple traits !
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

MaryFaces.png
Finally drew a face for my character Triple M, aka, Mary Mars McQueen. She's only ever had the TV thing on here head for her wrestling gimmick.
I have a screenshot from my Legend of Zelda: Breath of the Wild fan remake:
screenshot.png
I wish I'd been able to take a photo of the kittens at work. I love working at the pet shop... also those kittens just wanted my attention all day, but I had to stock the cat food and stick stickers on pet beds.
Of course, I did make some time for those sweet little kitties. They just wouldn't stop meowing!
Slightly late due to PC issues, but come and join me for Throwback Thursday! Tonight we'll be continuing Beneath a Steel Sky. https://twitch.tv/trihanstreams

Forum statistics

Threads
127,111
Messages
1,184,107
Members
167,061
Latest member
aaaaaagf2
Top