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,267
Reaction score
6,011
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,267
Reaction score
6,011
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,748
Reaction score
4,592
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

just spent FOREVER troubleshooting an issue with my keyboard... turns out the cord was just loose OTL
I count on someone one time, I let them promise something to me, and one week later it's complete silence as I'm completely let down. I hate everything.
Everytime I need to write dialogues I find myself writing new music pieces... what kind of trick is this?!
Me Being Dumb spending hrs trying to figure out Irenas Visual Novel busts plugin..lol. I'm probably missing something stupid and obvious xDD

let the journey begin >w>
X.X ok... I guess I'll just have to think about 48x48 a little differently. Its not "room for more work"..."its room for more detail!...yay"

Forum statistics

Threads
99,218
Messages
963,167
Members
130,807
Latest member
NotADev
Top