Ally Follow up attacks

I was wondering how I would go about implementing a passive ability that gives the user of it a chance to follow up with a basic attack after an ally makes one. For example:

Actor A has follow up passive
Actor B attacks the enemy with the attack command
Actor A has a 25% chance to also use the attack command immediately afterwards if the target isn't dead.

The second thing would be a skill that can cause a follow up attack on demand.

Actor A uses attack command skill on an enemy.
Ally with the highest ATK stat attacks the target.
Are you willing to use Yanfly Plugins? If you are, I think I can help you to develop that mechanic.
Yeah. I have some Yanfly stuff already.
Ok, cool. I think we will need the following plug ins:

http://yanfly.moe/2015/10/11/yep-4-action-sequence-pack-1/
http://yanfly.moe/2015/10/12/yep-5-action-sequence-pack-2/
http://yanfly.moe/2015/10/12/yep-6-action-sequence-pack-3/
http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/

Now, what I understand is, you want a passive state that gives the actor a chance of making a basic attack after another actor has done one. My questions here are, this state can be given to any actor? or you plan to have it on a specific actor? and, the actor with the possibility of the follow up attack, is he doing it after a SPECIFIC actor did the basic attack, or it will be after any actor(excluding him) have done a basic attack?

For the skill that invokes a basic attack of the actor with the highest ATK, will it be also a 25% chance or its a 100% guaranteed?

Im no scripter but I´ve done a lot of things like this, so Ill try my best to help you, I think its pretty doable.
Got the plugins.

I'm currently using Olivia's OTB. It functions mostly like Yanfly's STB at a base.
https://fallenangelolivia.itch.io/order-turn-battle-system

As for more specifics, the passive state will be applicable for any actor. I plan to have it be a passive skill(Suppressing Fire) a bow class can learn that gives them a chance to attack with a basic attack after any ally does a basic attack. It'd probably be for the best for follow up attacks not to be able to trigger off of each other to avoid the possibility of a follow up attack loop until an enemy is dead.

The skill that invokes a basic attack trigger from the ally with the highest ATK is 100%.
Ok, got it. Yes, dont worry, the follow up basic attack will not be triggered by another follow up basic attack. So, lets say 2 actors have the passive skill, if both pass the 25%, both will be doing the follow up attack or you want to limit only one follow up basic attack?

Ill start with it and if I have any doubts, I will ask you.
Only one of them should do the follow up attack.

Thanks a lot for your help!
Only one of them should do the follow up attack.

Thanks a lot for your help!
did you ever manage to solve your problem? i was lookign for the samething.
Thanks to @Magusalfador I was able to! I'll share the code below:

Required plugins:

http://yanfly.moe/2015/10/11/yep-4-action-sequence-pack-1/
http://yanfly.moe/2015/10/12/yep-5-action-sequence-pack-2/
http://yanfly.moe/2015/10/12/yep-6-action-sequence-pack-3/
http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
http://www.yanfly.moe/wiki/Weapon_Unleash_(YEP) (for the ability to give each weapon type its own attack, which is how mine is built)



The script uses a state to determine if a party member is able to perform follow up attacks. If the party member has the state, they'll have a 25% chance to follow up a basic attack with their own basic attack. The basic code uses state 10 but you can obviously change that to anything. My code is currently built around having multiple weapon types but you can remove parts of the code if you don't use it. The second half of the code in parts 1 and 3 just checks weapon types. If an actor is using weapon type 1(dagger), it follows up with skill X or if it's weapon type 2(sword), it follows up with skill Y. If you don't care about weapon types you can just remove the weapon type checks.

It comes in 3 parts(everything goes in the notetag section)

Part 1:

Put this inside of the basic attack skill. This is what triggers a follow up attack from another party member. It needs to point to a another skill that has part 2 of the code. This is to prevent follow ups to folow ups aka loops.

Part 2:

Make a second skill and put this code in it. This is the actual skill that an actor follows up with. It can be any skill.


Part 3:

This part is entirely optional. It's just a skill an actor can use that forces the party member with the highest attack to do a basic attack. Put this in a skill an actor can use.


did you ever manage to solve your problem? i was lookign for the samething.

I sure did thanks to magusalfador. Let me get the code and I'll share it.

Hey!
Ok this was super hard but I think I got it. All skill code was updated , so here they are:

Basic attack
Code:
Skill #1 will be used when you select
the Attack command.

<Setup Action>
//Make sure the target is an enemy
if target.isEnemy()
//Get the index position of the user.
eval: userS = $gameParty.allMembers().indexOf(user);
//Generate a number between 1 and 4.
eval: randomN = Math.floor((Math.random() * 4) + 1);
eval: userT = 0;
//Make an array that will hold all the indexes of all the party members that has State 10.
eval: pool = [];
//Iterate all party members and place their indexes (if they have State 10)in variable pool.
eval: for(i=0;i<$gameParty.battleMembers().length;i++){if($gameParty.members()[i].isStateAffected(10)){pool.push(i)}}
display action
Wait: 40
else
eval: userS = 0;
end
</Setup Action>

<Whole Action>
</Whole Action>

<Target Action>
move user: target, front base, 13
wait for movement
wait: 5
MOTION ATTACK: user
Wait: 20
ACTION ANIMATION: target
wait: 20
action effect
Wait: 20
MOVE user: return, 13
CLEAR BATTLE LOG
</Target Action>

<follow action>
//Make sure the target is an enemy
if target.isEnemy();
//Set the target so the follow up attack targets the same target.
eval: targetT = $gameTroop.allMembers().indexOf(target);
// Choose one attacker at random from variable pool.
eval: randomAttacker = pool[Math.floor(Math.random()*pool.length)];
// If the random attacker is the same as the actor attacking, choose another one.
if userS == randomAttacker && $gameParty.battleMembers().length >= 2 && $gameParty.aliveMembers().length >= 2
eval: do{randomAttacker=pool[Math.floor(Math.random()*pool.length)]}while(randomAttacker==userS)
end
// If variable randomN number is 4(25%) and the index of user is not the same as the random´s attacker
if randomN == 4 && userS != randomAttacker
 //Skill used if Weapon Type 1 is equiped.
 if $gameParty.members()[randomAttacker].isWtypeEquipped(1)
eval: $gameParty.members()[randomAttacker].forceAction(10, targetT);
eval: BattleManager.forceAction($gameParty.members()[randomAttacker]);
//Skill used if Weapon Type 2 is equiped.
else if $gameParty.members()[randomAttacker].isWtypeEquipped(2)
eval: $gameParty.members()[randomAttacker].forceAction(11, targetT);
eval: BattleManager.forceAction($gameParty.members()[randomAttacker]);
end
end
end
</follow action>

<Finish Action>
</Finish Action>

Follow Up Attack(WeaponTypes)
Code:
Skill #1 will be used when you select
the Attack command.

<Setup Action>
</Setup Action>

<Whole Action>
</Whole Action>

<Target Action>
//Making sure the follow up will not trigger if the same actor is the one activating it.
if userT != user.actorId();
display action
Wait: 40
move user: target, front base, 13
wait for movement
wait: 5
MOTION ATTACK: user
Wait: 20
ACTION ANIMATION: target
wait: 20
action effect
Wait: 20
MOVE user: return, 13
CLEAR BATTLE LOG
end
</Target Action>

<follow action>
</follow action>

<Finish Action>
</Finish Action>

Skill that summons a basic attack from strongest character.
Code:
<Setup Action>
// Get the user ID
eval: userF = user.actorId();
// Get the user index position
eval: userS = $gameParty.allMembers().indexOf(user);
// Get the user index position
eval: userI = $gameParty.aliveMembers().indexOf(user)
// Get the target index position
eval: targetT = $gameTroop.allMembers().indexOf(target);
// Get the user ID
eval: userT = user.actorId();
//Make an array that will hold all the indexes of all the alive party members.
eval: hPool = [];
//Iterate all alive party members and place their indexes (if they are alive)in variable hpool.
eval: for(i=0;i<$gameParty.aliveMembers().length;i++){hPool[i]=$gameParty.aliveMembers()[i].atk}
// Get the actor index with the highest attack.
eval: highestAtt = hPool.indexOf(Math.max.apply(null, hPool));
eval: hPool[highestAtt] = 0;
// Get the actor index with the secondhighest attack.
eval: highestAtt2 = hPool.indexOf(Math.max.apply(null, hPool));
</Setup Action>

<Whole Action>
</Whole Action>



<Target Action>
action animation
Wait: 40
action effect
</Target Action>



<follow action>
// Check that target is enemy and user is no the one with the highest attack.
if target.isEnemy() && userI != highestAtt
// Get Target index so follow up will attack the same target.
eval: targetT = $gameTroop.allMembers().indexOf(target);
eval: userT = user.actorId();
//Skill used if Weapon Type 1 is equiped.
if $gameParty.aliveMembers()[highestAtt].isWtypeEquipped(1)
eval: $gameParty.aliveMembers()[highestAtt].forceAction(10, targetT);
eval: BattleManager.forceAction($gameParty.aliveMembers()[highestAtt]);
//Skill used if Weapon Type 2 is equiped.
else if $gameParty.aliveMembers()[highestAtt].isWtypeEquipped(2)
eval: $gameParty.aliveMembers()[highestAtt].forceAction(11, targetT);
eval: BattleManager.forceAction($gameParty.aliveMembers()[highestAtt]);
end
// Check that target is enemy and user is the sameone as the actor with highest attack.
else if target.isEnemy() && userI == highestAtt
eval: targetT = $gameTroop.allMembers().indexOf(target);
eval: userT = user.actorId();
//Skill used if Weapon Type 1 is equiped.
if $gameParty.aliveMembers()[highestAtt2].isWtypeEquipped(1)
eval: $gameParty.aliveMembers()[highestAtt2].forceAction(10, targetT);
eval: BattleManager.forceAction($gameParty.aliveMembers()[highestAtt2]);
//Skill used if Weapon Type 2 is equiped.
else if $gameParty.aliveMembers()[highestAtt2].isWtypeEquipped(2)
eval: $gameParty.aliveMembers()[highestAtt2].forceAction(11, targetT);
eval: BattleManager.forceAction($gameParty.aliveMembers()[highestAtt2]);
end
end

</follow action>



<Finish Action>
</Finish Action>
Thanks to @Magusalfador I was able to! I'll share the code below:

Required plugins:

http://yanfly.moe/2015/10/11/yep-4-action-sequence-pack-1/
http://yanfly.moe/2015/10/12/yep-5-action-sequence-pack-2/
http://yanfly.moe/2015/10/12/yep-6-action-sequence-pack-3/
http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
http://www.yanfly.moe/wiki/Weapon_Unleash_(YEP) (for the ability to give each weapon type its own attack, which is how mine is built)



The script uses a state to determine if a party member is able to perform follow up attacks. If the party member has the state, they'll have a 25% chance to follow up a basic attack with their own basic attack. The basic code uses state 10 but you can obviously change that to anything. My code is currently built around having multiple weapon types but you can remove parts of the code if you don't use it. The second half of the code in parts 1 and 3 just checks weapon types. If an actor is using weapon type 1(dagger), it follows up with skill X or if it's weapon type 2(sword), it follows up with skill Y. If you don't care about weapon types you can just remove the weapon type checks.

It comes in 3 parts(everything goes in the notetag section)

Part 1:

Put this inside of the basic attack skill. This is what triggers a follow up attack from another party member. It needs to point to a another skill that has part 2 of the code. This is to prevent follow ups to folow ups aka loops.

Part 2:

Make a second skill and put this code in it. This is the actual skill that an actor follows up with. It can be any skill.


Part 3:

This part is entirely optional. It's just a skill an actor can use that forces the party member with the highest attack to do a basic attack. Put this in a skill an actor can use.




I sure did thanks to magusalfador. Let me get the code and I'll share it.
thank you so much for your generosity friend, i appreciate it.

Original thread: https://forums.rpgmakerweb.com/threads/ally-follow-up-attacks.107169/