Forcing a player action during battle without prompt

Kiboto

Villager
Member
Joined
Nov 1, 2015
Messages
9
Reaction score
0
First Language
English
Hi all,

What I want to do

I want to fully automate a battle and am having trouble skipping the player inputting part of the turn cycle.

I basically want to implement my own AI - so I don't want to turn on the auto battle feature. This involves not prompting the player for their decision, but still executing an action.

What I've done

I am defining a plugin method that is called within a troop's battle script, per turn:

$gameParty.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameParty.members()[index]);

$gameTroop.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameTroop.members()[index]);


(they are from the call list: https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0 )

The above isn't the actual script, but the used one is executing those commands when the BattleManager._phase === "turn".

What happens

Only the troop's actions are executed, while the party's is not. What results is only the troop automatically choosing the action, but the party always skips it's turn.

I can explain the script in more detail if need be, but I wanted to post in case there's something wrong that is glaringly obvious.

I'm not even sure I can run the forceAction function on the gameParty inside the battle events of the troop for example; but I couldn't find a place to enter scripts for the party during battle, and I couldn't manage to find where in the engine code the player's actions are set.

Any help would be much appreciated!

Thanks.
 

Kiboto

Villager
Member
Joined
Nov 1, 2015
Messages
9
Reaction score
0
First Language
English
Problem Solved!

I dug into the engine a bit more, and it turns out only one action can be forced per turn. (probably due to the animations).

To Solve my issue, I just create a switch that alternates per turn - allowing the troop to act, followed by the party. It seems a turn actually comprises of 2 action events initiated by two turns (correct me if I'm wrong).

Thanks,
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
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'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top