So, I am creating one fangame using Pokemon Essentials and decided to use custom variables. For example's sake, let's say like this. Pokemon sets variable A to 1 with one ability and then when he uses another ability, it does bonus damage, setting it back to 0. The way I implemented it is by:
Going into PokeBattle_Move and adding $varA = 0 under creating a move
Going into PokeBattle_MoveEffects and adding a script like:
if $varA == 1
$varA = 0
But the problem stands now: if two same pokemons battle, one activating switch A makes other being able to detonate it, if you understand.
Any ideas how to make it better? I probably have a completely wrong approach here soo...
I'd use a PBEffect, they're basically variables for each Pokémon in battle. You define a PBEffect in the PBEffects script section and set their default values somewhere atop PokeBattle_Battler, where you can also choose if the effect should be retained if the user switches with Baton Pass.
This sounds similar to the move "Charge", which I followed to create a similar effect. I forget exactly what I ended up doing, but if you ctrl-F through the battle scripts for Charge, you'll find all the different areas to add your own data to to create your custom effect.