I'm trying to make a skill that grabs an enemy and based on their weight, either throws them into another random enemy or if they are too heavy or the only member of the troop alive, they are just rammed into.
I yoinked the Custom Target Eval from Yanfly's Chain Lightning tutorial and added the first few lines myself, so I'm sure I did it wrong since my understanding of javascript is perfunctory at best.
To summarize, the issues I'm having is that I can't get the grabbed target to move to the randomly targeted 2nd enemy and also if a 'Heavy' enemy is selected as the 2nd target, I think that will ruin the action sequence as well. It would probably be a lot easier if action sequences could designate individual targets by 'target1' and 'target2' or something.
Code:
<Custom Target Eval>
if (target.isStateCategoryAffected('Heavy')) {
targets.push(member);
}
else
// Grab the group of alive foes as candidates.
var members = foes.aliveMembers();
// Remove the target from the group of candidates.
members.splice(members.indexOf(target), 0);
// This is the number of extra targets to select with Chain Lightning.
var extraTargets = 1;
// Loop the extra targets.
while (extraTargets--) {
// Grab a random foe from the alive foes.
var member = members[Math.floor(Math.random() * members.length)];
// Check to see if the member exists.
if (member) {
// Add the member to the group of targets.
targets.push(member);
// Remove the member as a viable candidate.
members.splice(members.indexOf(member), 1);
}
</Custom Target Eval>
Code:
<setup action>
MOVE user: target, front, 20, auto offset x -280,
wait for movement
</setup action>
<whole action>
motion sleep: user
animation 380: user, mirror
wait: 1
animation 443: user, mirror
animation wait: 9
if (target.isStateAffected(151)) || $gameTroop.aliveMembers().length <= 1
motion swing: user
Eval: StopAnimation(user)
move user: target, back center, 15
wait for movement
action effect: target
jump user: 200, 60
move user: home, 60
wait for movement
else
motion sleep: user
animation 388: target
wait: 4
animation 378: target
move user: forward, -50, 10
motion missile: user
move target: point, 400, 400, 20
motion guard: target
wait for movement
animation 377: target
hp -25%: target, show
wait: 20
motion guard: user
animation 379: target
move target: point, 300, 100, 10
wait for movement
move target: point, 600, 100, 60
wait for movement
jump user: 100, 20
motion evade: user
wait for jump
motion skill: user
move target: focus, front, 15
wait for movement
motion standby: user
animation 377: target
animation wait: 3
action effect: targets
motion damage: targets
animation 384: targets
wait for animation
</whole action>
<target action>
</target action>
<follow action>
wait: 30
</follow action>
<finish action>
<finish action>
immortal: target, false
clear battle log
tint screen: 52, 105, 88, 255, 30
remove state 39: user
remove state 37: user
change switch 92: off
battleback 3 remove
tint screen: normal, 60
opacity not focus: 255%, 1
show battle hud
perform finish
wait for movement
</finish action>
I yoinked the Custom Target Eval from Yanfly's Chain Lightning tutorial and added the first few lines myself, so I'm sure I did it wrong since my understanding of javascript is perfunctory at best.
To summarize, the issues I'm having is that I can't get the grabbed target to move to the randomly targeted 2nd enemy and also if a 'Heavy' enemy is selected as the 2nd target, I think that will ruin the action sequence as well. It would probably be a lot easier if action sequences could designate individual targets by 'target1' and 'target2' or something.