Hey there! I've been working for a few months on an action rpg using the official ARPG plugin.
Right now I'm at a bit of a coding puzzle: I have monsters roaming on the map; if you get close enough they'll aggro you and start attacking, if you walk away they'll go back to roaming. What I want is an in-battle state that activates if at least one monster is aggroed. In that state, the bgm fades, the battle music plays, the player can't open the menu, etc.
Basically a switch that automatically turns ON if at least one enemy is aggroed, and automatically turns OFF if no enemies are aggroed. So I need a way to tell the game whether there is at least one aggroed enemy on the map.
The way I solved it so far, is to make it so when an enemy is aggroed, they add +1 to a variable, and when they lose the aggro or die, they -1 the variable: if the variable is >0, then we enter the in-battle state. The problem is that it relies on every monster running the event properly rather than a single centralized common event, and as such it's incredibly flimsy, all it takes is one of the monsters being interrupted or repeating the event to break it.
So, is there any better way to let the game know if at least one enemy is aggroed?
Right now I'm at a bit of a coding puzzle: I have monsters roaming on the map; if you get close enough they'll aggro you and start attacking, if you walk away they'll go back to roaming. What I want is an in-battle state that activates if at least one monster is aggroed. In that state, the bgm fades, the battle music plays, the player can't open the menu, etc.
Basically a switch that automatically turns ON if at least one enemy is aggroed, and automatically turns OFF if no enemies are aggroed. So I need a way to tell the game whether there is at least one aggroed enemy on the map.
The way I solved it so far, is to make it so when an enemy is aggroed, they add +1 to a variable, and when they lose the aggro or die, they -1 the variable: if the variable is >0, then we enter the in-battle state. The problem is that it relies on every monster running the event properly rather than a single centralized common event, and as such it's incredibly flimsy, all it takes is one of the monsters being interrupted or repeating the event to break it.
So, is there any better way to let the game know if at least one enemy is aggroed?