oniichanjones

Villager
Member
Joined
Aug 20, 2015
Messages
5
Reaction score
1
First Language
English
Primarily Uses
I would love a clean way to get enemy AI smart enough to use an ATB interrupting skill on an a player actor that is mid-cast.

I have been wracking my brain trying to crack this, and all I can come up with is to rewrite each skill with a cast time as an action sequence, and put a state? on the actor? And use vizu Battle AI plugin to focus on actors with that state? idk sounds janky.

Any help would be appreciated.
 

Ms Littlefish

Time Traveling Victorian Vampire
Global Mod
Joined
Jan 15, 2014
Messages
8,984
Reaction score
14,481
First Language
English
Primarily Uses
RMMV
I have moved this thread from RPG Maker MZ Tutorials to RPG Maker MZ Support.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,258
Reaction score
4,734
First Language
EN
Primarily Uses
RMMZ
I'm guessing you're using VisuStella's ATB system plugin. Am I right?

I had a quick look at VisuStella's Battle AI plugin and it looks like it accepts JS for conditions. Assuming the ATB plugin simply extends the existing TPB system, "is target casting right now" would be:
JavaScript:
target._tpbState === "casting"
I don't know if target is the correct variable to refer to the target in the AI condition, I haven't tested.
 

oniichanjones

Villager
Member
Joined
Aug 20, 2015
Messages
5
Reaction score
1
First Language
English
Primarily Uses
I'm guessing you're using VisuStella's ATB system plugin. Am I right?

I had a quick look at VisuStella's Battle AI plugin and it looks like it accepts JS for conditions. Assuming the ATB plugin simply extends the existing TPB system, "is target casting right now" would be:
JavaScript:
target._tpbState === "casting"
I don't know if target is the correct variable to refer to the target in the AI condition, I haven't tested.
Yes, i am, and as far as I can tell, the plugin does just expand on the base TPB system.

I think my next mistake was not giving the ATB Interrupt skill higher priority than the normal attack.

EDIT: thank you for your response (☆-v-)

So here is the log for a combat encounter, whenever that enemy's turn starts, it throws all these errors:
Untitled.png

I was at my limit for JS scripting when i started this nonsense, now I'm completely out of my depth. I hope this is enough to troubleshoot?
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,258
Reaction score
4,734
First Language
EN
Primarily Uses
RMMZ
(target._tpbState here means "read the value of _tpbState defined on target". But the error says it can't read _tpbState of undefined, i.e. target is not defined.)

Basically, as I suspected, target is not the correct variable to use here. I assume there is such a variable, but I don't know what it might be named.

Maybe someone familiar with the plugin will have a suggestion. Alternatively you could try contacting VisuStella via the "Need Help?" links on their itch page. :kaohi:

I've moved this thread to Plugin Support (from MZ Support). Thank you.

 

oniichanjones

Villager
Member
Joined
Aug 20, 2015
Messages
5
Reaction score
1
First Language
English
Primarily Uses
yeah, i tried "actor" as well, with no luck. i also looked at rmmz_managers.js, to see what kind of variables it might use, and it looks like it uses something called _ActionState, so i tried that in place of _tpbState and that wasnt it either.

thanks a bunch for your help
 

rpgLord69

Regular
Regular
Joined
Oct 23, 2021
Messages
688
Reaction score
905
First Language
Finnish
Primarily Uses
RMMZ
[EDIT:
Hmmm, seems like it's just programmed in a "confusing" way. Like it only accepts some kind of expressions or something. I think I got it to work by using:
($gameActors.actor(1)._tpbState === "casting") === true
I'll check if it accepts it somehow like this using the "target" thing...]


I'll bump this, since it's only a month old and I have the exact same question.

Even if we ignore the target or whatever would be the correct variable, what does it mean when it also says that "Reference error: casting is not defined"?
I tested it with:
$gameActors.actor(1)._tpbState === "casting"
but even that gives the same error (or when the actor is in the charging phase, it starts saying "charging is not defined".

However, when I put a script "$gameActors.actor(1)._tpbState" into a variable and make a text box with it, it does say either "casting" or "charging", so clearly it has a value? So what's the problem?
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,258
Reaction score
4,734
First Language
EN
Primarily Uses
RMMZ
what does it mean when it also says that "Reference error: casting is not defined"?
I tested it with:
$gameActors.actor(1)._tpbState === "casting"
Are you certain you wrote "casting" (string) rather than casting (variable)? Because the latter would cause exactly that error message.

If so, then like the OP has done, I suggest you open the dev tools window (F8 or F12 during playtest) and share a screenshot of the full error message seen in the Console tab. Perhaps the error itself is happening on a different line.

Otherwise, as earlier, I can only suggest following the VisuStella support guidelines. (It doesn't look like anyone who has seen this thread knows the answer.)
 

rpgLord69

Regular
Regular
Joined
Oct 23, 2021
Messages
688
Reaction score
905
First Language
Finnish
Primarily Uses
RMMZ
@caethyril Yes, I tested it again and copied it from that box you quoted. Gives an error.

But did you see my edit above?

I think it has something to do with it searching those keywords or that it only wants code on one side of the equation of something, I don't know, I'm not a coder.

Anyway, it seems I got it to work by using the expression in my edit?

However, the "target" word still doesn't work in conjunction with that...do you know how I get the current target the program is evaluating as a potential target? (I mean even in the base game, if we forget Visustella). Maybe that would work?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,258
Reaction score
4,734
First Language
EN
Primarily Uses
RMMZ
Ah, I didn't see the edit earlier, no. I guess it's some quirk of how VisuStella's plugin parses that condition. :kaoslp:

The core engine has BattleManager._targets, which is an array containing the remaining targets for the current action (does not include the current target). I don't imagine that'll help much.

Maybe try $target instead of target? I think I saw someone use something like that in a VisuStella action sequence once.
 

rpgLord69

Regular
Regular
Joined
Oct 23, 2021
Messages
688
Reaction score
905
First Language
Finnish
Primarily Uses
RMMZ
Hmm, can't get it to work. But thanks for the help. Hope someone knows how the target can be referenced...
 

Latest Threads

Latest Profile Posts

Me working on a deadline, "don't make the baseline and chords too funky, don't over compose it... remember, you have to finish it." Touches MIDI controller...instant funk.
TGA are coming up, and I'm still mad Lies of P didn't get nominated.
Like, they chose a remake of a 20 year old game and a vanilla 2D Mario game over it?

Bah, humbug!
I'll be there for the trailers and whatever weird mistakes are made.
I've bundled all my free plugin releases on itch.io I'll add more later, feel free to check it out! https://starlit.itch.io/rm-free-plugins
If I could draw, my Game Jam title screen would be a Krampus sitting in Santa's chair, his long, blonde hair flowing in the wind, sipping on an Espresso, while snacking on cheddar popcorn, chewing on an orange pencil pensively, while completing a crossword puzzle. I guess it's a good thing I can't draw.
Time for the next chance for y'all to affect my advent calendar! Where should Day 7's sprite come from: land, sea, or demon realm? :rwink:

Forum statistics

Threads
136,782
Messages
1,269,916
Members
180,530
Latest member
Mikimaker
Top