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,237
Reaction score
1,228
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,237
Reaction score
1,228
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,237
Reaction score
1,228
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

mlogan wrote on alltheyuriz's profile.
Please be aware that our Status rules ask members not to make more than 2 status updates in 24 hours.
rux
Just 80% of my motivation on game making lmao, anyone got tips on how to not be unmotivated?
I've signed up for a job training program for people with Asperger's Syndrome. I went to a "test run" today so they could see how well I did with simple jobs, and I amazed them. Most new people do it in 30+ minutes, while I finished in a mere 15 minutes. Gives me time to work on a screenplay for Studio MDHR...
People,I have seen that Someone from China/Chile and London is doing a Vaccine Against COVID-19.

Forum statistics

Threads
105,467
Messages
1,013,917
Members
137,108
Latest member
maxmach
Top