Force Action: Quick question using the script version

Theguysayshi

Villager
Member
Joined
Jul 18, 2018
Messages
27
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Would anyone mind showing me how is it called? I want to use the script version of "Force Action" as I want to call the command with variables.
I've tried:

$game_actors[0].force_action(1,0)/ $game_party[0].force_action(1,0)
for actors and
$game_troop.members[0].force_action(1,0)
for enemies, but it doesn't seem to work.

What am I missing?
 
Last edited:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
Game_Battler, line 335.

Code:
def force_action(skill_id, target_index)
    clear_actions
    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.push(action)
  end
 

Theguysayshi

Villager
Member
Joined
Jul 18, 2018
Messages
27
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Game_Battler, line 335.

Code:
def force_action(skill_id, target_index)
    clear_actions
    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.push(action)
  end
Thank you for clarifying, but I'd like to know how to execute it.
For example, I've also tried
$game_troop.members[0].force_action(4,-1)
$game_party.members[0].force_action(4,-1)
to force both parties to use skill 4 on a random target but sadly this does nothing.

Battle commands are also not listed in the script call collection so sadly I'm at a loss. If anyone could demonstrate how it works it would be much appreciated.
 
Last edited:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
it's been a while since I worked with the default system, but I believe forced actions are processed at the end of the turn.
do a broad search in the code, for "force_action", you'll get 4 or 5 results, one of them will be the Battle Manager, backtrack from there.
 

Theguysayshi

Villager
Member
Joined
Jul 18, 2018
Messages
27
Reaction score
2
First Language
English
Primarily Uses
RMVXA
it's been a while since I worked with the default system, but I believe forced actions are processed at the end of the turn.
do a broad search in the code, for "force_action", you'll get 4 or 5 results, one of them will be the Battle Manager, backtrack from there.
Looking up the code only yields the use of the code sadly.
upload_2019-1-26_17-11-32.png
In any case, here's what I've been working with. "Force Action" (in purple) runs the instance it is called. So no issues there.

However,
$game_troop.members[0].force_action(4,-1)
$game_party.members[0].force_action(4,-1)
Don't do anything, I'd like to rewire them so they work identically to the Force Action Event Command.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
Looking up the code only yields the use of the code sadly.
how did *I* find the relevant function, then?

nuevo-1.jpg

search the code!
*the code*, not the help file.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
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

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top