Force enemy to perform action on specific actor

Status
Not open for further replies.

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
128
Reaction score
32
First Language
German
Primarily Uses
RMVXA
Hello,
I have the following situation:
-an enemy can perform a scan on one/two of the party's actors (out of a maximum of four) via a decision-making process:
--if only one actor is available/alive, the enemy simply copies that actor's skill via the scan and then performs the skill itself (say a heal if only Natalie is available/alive)
--if at least two are available and not dead, those two are scanned via force-action and the enemy fires a special combination attack based on who those two actors are

My problem is that while everything works if all 4 actors are in the party, in case that an actor is missing, the force-action command (based on the index system the program provides) bugs out and may display the scan on the wrong actor(s); for example if Erik is missing, then Alice and Natalie are scanned when it should be Erik and Alice being scanned respectively (it's only a visual error though).

I use Yanfly Engine Ace - Ace Battle Engine for this.

So question is: is it possible to NOT use indexes for the scan skills, but instead use the actual actor numbers (2-5) rather than indexes 1-4?

Thank you very much for reading and, hopefully, providing an answer.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,311
Reaction score
6,073
First Language
Indonesian
Primarily Uses
RMVXA
You could try to replicate the same effect but use script calls. This is untested, taken directly from the code that handles the force action.
Code:
battler = $game_troop.members[enemy_index]
battler.force_action(skill_id, $game_actors[actor_id].index)
BattleManager.force_action(battler)
Fiber.yield while BattleManager.action_forced?
What you need to replace
enemy_index = replace with the enemy index (not id) based on how you put it in the troop
skill_id = replace with the skill id you want the enemy to use
actor_id = replace it with the actor id you want the enemy to target
 

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
128
Reaction score
32
First Language
German
Primarily Uses
RMVXA
I tried to script-call this:
Code:
battler = $game_troop.members[1]
battler.force_action(471, $game_actors[2].index)
BattleManager.force_action(battler)
Fiber.yield while BattleManager.action_forced?
Sadly it crashes outright.

Code:
---------------------------
Magical Camp 0.4.7b
---------------------------
Script 'Game_Interpreter' line 1411: NoMethodError occurred.

undefined method `force_action' for nil:NilClass
---------------------------
OK  
---------------------------
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,311
Reaction score
6,073
First Language
Indonesian
Primarily Uses
RMVXA
Index started from 0, not 1
 

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
128
Reaction score
32
First Language
German
Primarily Uses
RMVXA
Right, that was the error. It works perfectly now, thank you very much.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,811
Reaction score
4,621
First Language
Dutch
Primarily Uses
RMXP

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

Learning C on the side to support Haxe.
Imagine having a different opinion on the internet.
Crazy.
Here's the one that flee from no foe, the brave Sir Kiwival! Also protagonist of my current project.

This is the cover art of new game, "Primordial Essence".
I'm amazed at the performance increase I saw in just going through and rescoping the variables in other people's plugins that I'm using. You know what that means? :LZSexcite:
//Tosses more absurd stuff onto the game of "Jenga" that is his RM project.
:rheh:

Forum statistics

Threads
99,672
Messages
967,895
Members
131,351
Latest member
Makual
Top