Force Action Target Question.

Status
Not open for further replies.

dinhbat3

Veteran
Veteran
Joined
Feb 5, 2014
Messages
184
Reaction score
31
First Language
English
Primarily Uses
Hello RM Folks =D

I had a question that I hope is fairly simple to answer regarding Force Action Targeting options...

I currently have a duo of characters who use skills that force the other to do a skill immediately after. Forcing the actions is fine but the options of targeting with Forced Actions are a bit limited. What I would like to happen is that both actors attack the same target. Is there any way to set it so that the second actor will target the same enemy? 

The options for Forced Action are Random, Last Target and Troop Index numbers.

Random clearly wouldn't work.

Last Target forces the action on the last target of each Actor individually. So if Actor B hit enemy Index 3 for his last round, and I am initiating the Force Action by Actor A on Enemy Index 1, then Actor B will attack Enemy Index 3 (the last enemy that Actor B had targeted) instead of Enemy Index 1 who the skill was initiated on by Actor A.

The Troop Indexes might work, though the eventing behind it may be a bit cumbersome and ineffective, I imagine I would have to set a variable to the Troop Index targeted and then make conditional statements if the variable is 0, force action on Index 0. If the variable is 1 force action on Index 1, etc etc.  I plan for most of their skills to be like this and hope to avoid having to do this for each one...

A possible solution would be to use a variable as I mentioned in the Troop Index solution and script call a Forced Action...

and designating the target by $game_troop.members[$game_variables[x]]... I am not sure how I would do this in actual eventing though...

Hopefully that wasn't confusing and someone has an idea on how best to approach this.  Thanks in advance for any help!

~ Dinhbat
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
Well, there is something that can be done. Before calling force action, call this script:

battler1.last_target_index = battler2.last_target_indexChange battler1 and battler2 as necessary. Now battler1 has the same last target as battler2.

For example, if I want to enter this in damage formula of a skill targeting an enemy, I'll do 

$game_party.members[1].last_target_index = a.last_target_index; a.atk *4 - b.def * 2After that, I'll call the common event that will force action for my party's second member.
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
There is a bug in force action too. I'm not sure if you have Yanfly Core Script, but there is a bug in force actions too.

 Make sure to add this if you don't want to use Yanfly's core bug fixes. :wub:

Code:
class Game_Battler < Game_BattlerBase  def force_action(skill_id, target_index)      action = Game_Action.new(self, true)      action.set_skill(skill_id)      if target_index == -2        action.target_index = last_target_index      elsif target_index == -1        action.decide_random_target      else        action.target_index = target_index      end      @actions = [action] + @actions      @pctb_forced = true  endend
 
Last edited by a moderator:

dinhbat3

Veteran
Veteran
Joined
Feb 5, 2014
Messages
184
Reaction score
31
First Language
English
Primarily Uses
Thanks for the advice ShadowLurk and Archeia!

I do have Yanfly's Core, and I have been tweeking around with the idea, but am having a bit of difficulty.

When I put in the script as you had it I first got an error: "undefined local variable or method battler1"

First I attempted to swap them with Actor ID but got the error: "undefined method last_target_index"

I managed to get it to work with this code:

$game_party.members[0].last_target_index = $game_party.members[1].last_target_index

But this requires the particular characters to be in party member slot 0 and 1. So it seems I am only able to call the last_target_index method using party member index. I currently use Hime's Common Events Variables. And I have it setting a variable to the combo Initializing Actor's Party Member Index.

Now I just need to know how to script call the second Actor's own Party Member Index so it can look something like this:

Y = $game_party.members[$game_variables[x]].last_target_index

x  = Variable from Hime's Common Event's Variable Script assigned to the Initializing Actor's Party Member Index

Y = Following Actor's Party Member Index (Script call)

Anyone able to shed light on this script call?

Any and all help is appreciated! Thanks again for the direction so far!

~ Dinhbat
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
When I put in the script as you had it I first got an error: "undefined local variable or method battler1"
Sorry if I'm not clear enough, that battler1 is just a placeholder for battler object.

Attr_accessor of last_target_index exists in Game_Battler though, so all actors and enemies should have that.

Also, my bad, the last_target_index is updated after doing the attack (damage, effect, common event and all), so putting it inside damage formula won't work as expected. It's better (and should be faster to type, too) to use 

b.indexin damage formula. Or if you want to access the battler's action's target index,

battler.current_action.target_indexWell. If you use Princess' common event variable script then it's easy(er).

In the common event, call script (assuming the Actor is Ylva)

$game_actors[2].last_target_index = $game_temp.common_event_target.indexor 

$game_actors[2].last_target_index = $game_temp.common_event_user.current_action.target_indexthen call force action on Ylva, targeting last.
 

dinhbat3

Veteran
Veteran
Joined
Feb 5, 2014
Messages
184
Reaction score
31
First Language
English
Primarily Uses
Thanks ShadowLurk!

With your help I got it all figured out =D REALLY appreciate it!

This topic can be closed.
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top