Chance Random Targeting - Yanfly's Buffs & State Core

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Link to Yanfly's Plugin: http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/

I'm trying to create a state that confuses the victim and has a chance of randomly targeting an ally or foe.
So, for example:

Roy uses a Fire Spell and selects Enemy A.
There is a 50% chance of avoiding the confusion effect.

Roy is unlucky and becomes confused.
He randomly casts the Fire Spell at Enemy A, Enemy B, Enemy C, himself, Ally B or Ally C.

Is this possible?

I know it would need to run at the action's start hence <Custom Action Start Effect>

Code:
<Custom Action Start Effect>
var confuseRate = 0.50;
if (Math.random() < confuseRate) {
 // Insert code
}
</Custom Action Start Effect>

And well, I know this piece of code which causes the user to consume the skill's resources (This can be utilized for Paralysis-based Status Ailments):

Code:
  user.useItem(user.currentAction().item());

Is there something like user.currentAction(). "determine target here" ?

What I am currently thinking of trying is using:

Code:
subject.forceAction(skillId, $gameParty.battleMembers().indexOf(X));

subject.forceAction(skillId, $gameTroop.members().indexOf(X));

The confusion state would obtain the current skill's ID and execute a Forced Action using that skill ID. It would randomly choose between targeting the party and or enemy troop. Then it would target a random (applicable) index.

I'm not sure if that would be efficient though.
I'd also have to include conditions for when skills with User or All scopes are used.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
@shockra that's where part of the code I linked came from, lol.
I left out the part that specifies a specific skill to be used.
 

Latest Threads

Latest Posts

Latest Profile Posts

I finally got the ships and water to flow like I wanted to~ the canals are a success. Now to loop the animation for the kites. So many kites.
Bendyizzt wrote on staggqueen's profile.
Hello Newcomer...
I haven't make anything new yet, but I'm back addicted to writing some MZ plugins. Man, I wish I have more free time like I did 5 years ago.
Holy cow... work is demanding and I'm back in college. I'm kind of scared of my dad right now after the incident, but at least I don't live with him all the time. Anyway, working on Fandom Scouts and my FNAF character set. The FNAF sprites are actually going to be used in the game... unfortunately the enemy sprites are FNAF World traces, so no sharing those.

Forum statistics

Threads
107,691
Messages
1,031,479
Members
139,815
Latest member
noelyumishi
Top