RMMV [YEP Buff & States Core] Passive state that adds state to ally with highest parameter

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hello everyone, I have a passive state that's supposed to check the battle party's ATK when the condition is fulfilled, then automatically apply to the battle ally with the highest ATK.
I see there's the whole 'i' loop stuff, but that's not really in my expertise - combined with getting the highest atk ally's id, etc.

The state in question does something akin to:
"When attacked, 20% chance to grant the ally with the highest ATK parameter Energized, increasing TP Regen+10% and ATK+10% for 3 turns."

So I'd imagine it'd be something like:
JavaScript:
<Custom React Effect>
if (Math.random() <= 0.2){
[thing to check current party's atk, then get id of ally with highest parameter]{
target.startAnimation(x); //show buff anim
target.addState(y); //add energized state
}
}
</Custom React Effect>

Bonus question, how can I check if anyone is inflicted with the state so the passive doesn't trigger again until it wears off?


Thank you ahead of time!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,791
Reaction score
1,637
First Language
English
Primarily Uses
RMMV
Hello everyone, I have a passive state that's supposed to check the battle party's ATK when the condition is fulfilled, then automatically apply to the battle ally with the highest ATK.
I see there's the whole 'i' loop stuff, but that's not really in my expertise - combined with getting the highest atk ally's id, etc.

The state in question does something akin to:
"When attacked, 20% chance to grant the ally with the highest ATK parameter Energized, increasing TP Regen+10% and ATK+10% for 3 turns."

So I'd imagine it'd be something like:
JavaScript:
<Custom React Effect>
if (Math.random() <= 0.2){
[thing to check current party's atk, then get id of ally with highest parameter]{
target.startAnimation(x); //show buff anim
target.addState(y); //add energized state
}
}
</Custom React Effect>

Bonus question, how can I check if anyone is inflicted with the state so the passive doesn't trigger again until it wears off?


Thank you ahead of time!
Math.random() returns a value from 0-0.9, so <= 0.2 is actually a 30% chance.

Code:
<Custom React Effect>
// 20% chance and no one in the party has state id X
if (Math.random()<0.2 && !$gameParty.aliveMembers().some(member => member.isStateAffected(X)))
{
    var memberOld=$gameParty.aliveMembers()[0];

   for (var i=0; i<$gameParty.aliveMembers().length; i++)
    {
        if ($gameParty.aliveMembers()[i].param(2)>memberOld.param(2))
            memberOld=$gameParty.aliveMembers()[i];
    }
    memberOld.startAnimation(Y);
    memberOld.addState(X);
}
</Custom React Effect>
Make sure to replace all instances of X and Y with the appropriate IDs.
 

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Excellent, thank you very much!

Thread is solved.
 

Latest Threads

Latest Posts

Latest Profile Posts

I think it's ready - Chapter Selection:
unknown.png
On another more gaming topic, I paid 20 bucks for a visual novel to emotionally destroy me. I may write an entry about that.
1638611395177.png
Reading about metaverses recently. I can totally imagine myself in the future, logging in with VR glasses to a virtual beach villa sitting in a virtual chair, with a virtual laptop facing the sea...coding 16-bit RM.
Mod name: "[Game name] Gameplay Overhaul"
What they actually mean: "Here is a mod that makes the game harder."
I decided to reinstall one of my most favourite game of all times, Gothic 2. Time to get back to Khorinis!

Forum statistics

Threads
117,174
Messages
1,105,152
Members
153,280
Latest member
MrDansv
Top