Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,376
Reaction score
13,022
First Language
English
Primarily Uses
RMMZ
I have a range of enemies where I want the enemy to use a particular skill if, and only if, switch #3 is ON. This switch is set at the beginning of the game and is used for a range of battle related actions.
I also want this skill to be used on e.g. turn 3.

However, setting the skill in the enemies tab only allows for one or the other, not both - at least as far as I can see. I think the assumption is that the switch will be turned on at some point in the battle so the skill will be used then and doesn't allow for the fact that it is already set.

As far as I can see I have 2 choices:
1) Make duplicate enemies, and therefore troops, one of which will have the different skill on turn 3. Nightmare amount of extra work.
2) The other is a troop event on turn 3 which checks if switch #3 is on and if it is turns on another switch which is the condition switch for the skill. Still a lot of work including always making sure that the second switch is turned off at the end of battle. I can see me forgetting sometimes. And will this override the skill used if switch #3 is OFF?

Are these my only options?

Thank you.

EDIT
For the sake of clarity, here is an example.
At turn 3 in a particular troop, the enemy will use skill 281 'Enfeeble' if switch 3 is OFF.
The enemy will use skill 282 'Predator' if switch 3 is ON
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
2) The other is a troop event on turn 3 which checks if switch #3 is on and if it is turns on another switch which is the condition switch for the skill.
I don't understand the need for two switches. If it's the same skill, why wouldn't it use the same switch?

Still a lot of work including always making sure that the second switch is turned off at the end of battle. I can see me forgetting sometimes.
You can just make a common event run after every battle to turn it off.

For the sake of clarity, here is an example.
At turn 3 in a particular troop, the enemy will use skill 281 'Enfeeble' if switch 3 is OFF.
The enemy will use skill 282 'Predator' if switch 3 is ON
Your example for clarity has confused me further, because it's talking about two skills and your entire post previous appeared to be talking about one skill. Following emphasis mine:
I want the enemy to use a particular skill if, and only if, switch #3 is ON...I also want this skill to be used on e.g. turn 3.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,494
Reaction score
3,527
First Language
EN
Primarily Uses
RMMZ
Option 1 definitely sounds like overkill. I'd go with option 2, or some kind of enemy AI plugin.

In case it helps, I've been using this for a "base troop events" kind of thing to reset enemy AI switches on turn 0:
JavaScript:
/*:
 * @target MZ
 * @plugindesc Troop 1 events apply to all troops.
 * @author Caethyril
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
    Scene_Boot.prototype.start = function() {
        alias.apply(this, arguments);
        // lazy solution: just copy them over
        const T = $dataTroops;
        for (let n = T.length; --n > 1;)
            T[n].pages = T[1].pages.concat(T[n].pages);
    };
})(Scene_Boot.prototype.start);
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,376
Reaction score
13,022
First Language
English
Primarily Uses
RMMZ
@ATT_Turan Sorry for being so confusing. I'll try coming in from a different angle.

I don't understand the need for two switches. If it's the same skill, why wouldn't it use the same switch?
The need for 2 switches is because of the way skill conditions are set up in the database. I can allocate a skill to be used if switch #n is on. However, I cannot set it so that that skill is only ever used in turn 3. Selecting 'Turn' automatically removes 'Switch' as the condition. I therefore need a switch which only comes on in turn 3. So in the troop event I would need a conditional check to see if switch 3 is on and if it is, turn on switch 239 which is the switch that's used in the enemy tab where the attack pattern is input.

As for my example, 'Enfeeble' is used in battles where switch 3 is OFF and 'Predator' is used if switch 3 is ON. My suspicion is that I could end up with the enemy using both skills rather than either/or.

@caethyril my little brain went into meltdown. How does the plugin know which are the enemy AI switches and which are not? Also, what are the advantages of using this instead of turning the switch OFF in my post battle common event (other than the fact that that c.e. is getting to be super long)?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
So in the troop event I would need a conditional check to see if switch 3 is on and if it is, turn on switch 239 which is the switch that's used in the enemy tab where the attack pattern is input.
So...that doesn't help, because I read that and still don't see why you'd not just turn switch 3 on to let the skill be used.

I think the answer is because switch 3 is used for other things beyond determining whether this skill should be used.

You could also try doing away with the second switch by having your turn 3 event simply use Force Action on the enemy. But I don't know if you're using a specific kind of battle system where that would mess with the timing.

Is the Yanfly Battle AI not compatible with MZ via Project FOSSIL? That seems like it would be the thing.

How does the plugin know which are the enemy AI switches and which are not? Also, what are the advantages of using this instead of turning the switch OFF in my post battle common event (other than the fact that that c.e. is getting to be super long)?
You seem to be misunderstanding the point of it. It simply does what it says in the description - any troop events you put on troop 1 will exist on all troops.

So if you want every battle to start with switch 239 turned OFF, you put a Turn 0 event in troop 1 that turns switch 239 OFF and it will apply to every other troop also.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,376
Reaction score
13,022
First Language
English
Primarily Uses
RMMZ
I think the answer is because switch 3 is used for other things beyond determining whether this skill should be used.
Yes, this.
I have a difficulty mode system. When the player chooses the mode they want the appropriate switch goes on. That switch is used to determine a whole range of things, like different troop composition, certain enemies do/do not respawn, certain healing spots are/are not open etc. etc. My hope had been that the switch could determine when the enemy would use a nastier skill in the harder modes.

As I use Base Troop Events already for lots of things, adding a page to turn off switch 239 isn't a problem.

EDIT
Forgot to answer your point about force action.
As I'm using CTB, timing is everything, and force action would mess it up.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
Does it have to be an entirely separate skill? Can it be the same skill and you use the value of your difficulty variable (or switches, if for some reason that's better) in the skill formula/action sequence/whatever to make it more complex?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,376
Reaction score
13,022
First Language
English
Primarily Uses
RMMZ
@ATT_Turan
This would be needed across many troops and enemies. In some instances what you suggest will work. In others, the one we are discussing here for instance, it is a different skill targeting a different number of allies.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
I'm not sure if you've seen this plugin, but it says it will customize which troops you encounter based on the difficulty levels.

So you could use a copy of the enemy with different attack patterns.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,376
Reaction score
13,022
First Language
English
Primarily Uses
RMMZ
@ATT_Turan No, I hadn't seen that. I'll go off and have a look. Thanks for the info and for all the time and trouble you've taken to answer my query.
 

Latest Threads

Latest Posts

Latest Profile Posts

Learn how to do custom face parts with my latest tutorial!
Generatorpartsfromscratch.png
The Legion
T7T0hR2.gif
Made a title screen, and by ''made'' I ofc mean I slapped a simple title on some cool art I bought xD This side project might be fun.

sIMPLE.png
CDF.png

Trying for a Classical RPG with Pokemon Elements. Capture monsters like Zombies and Harpys and use them on your team.
ow28O4A.png

Astarte in her usual demeanor: mocking people.

Forum statistics

Threads
129,872
Messages
1,205,835
Members
171,048
Latest member
CNighty221
Top