I’ve tried Azure Yoshi’s Roll to Hit Tutorial, but I am running into a snag. When an enemy is reduced to 0 HP and a new enemy is autotargeted on that turn, the new enemy’s ID comes up as 1 and its AC is either 0 or whatever default AC has been specified. How do I make it so that the battle system can check a target variable (in this case, the new enemy’s AC) on the fly?
Checking for target AC with roll to hit event
RPG Maker MZ SupportJust to put my two cents in, I don't think this is a very good way to implement what you're looking for.
It's overly complicated and, as you see, can produce unexpected results with the actual code of the battle system.
I would suggest much more simply using a plugin that can alter the math used to hit enemies. caethyril has one in her MZ plugins, and I have one here:
forums.rpgmakerweb.com
That way you're not trying to outsource your entire combat system into common events and the engine's code should just work more naturally.
It's overly complicated and, as you see, can produce unexpected results with the actual code of the battle system.
I would suggest much more simply using a plugin that can alter the math used to hit enemies. caethyril has one in her MZ plugins, and I have one here:
Custom Hit Formula MZ
Custom Hit Formula 1.4 ATT_Turan Introduction As far as I know, there's still no plugin written with the ability to provide a custom hit formula in MZ, and I got tired of telling people that :wink: (apparently caethyril actually had one and I didn't know about it! Well, now you can try both...
forums.rpgmakerweb.com
That way you're not trying to outsource your entire combat system into common events and the engine's code should just work more naturally.
Thank you for the quick reply and elegant solution, @ATT_Turan.
Original thread: https://forums.rpgmakerweb.com/threads/checking-for-target-ac-with-roll-to-hit-event.158014/