Battle Script Events - po-devs/pokemon-online GitHub Wiki
I've made a start on the Battle Events. I add more when the use for them occur.
Battle Events
onBattleEnd(result, winner)
Triggers at the end of the battle when someone wins, loses, forfeits or runs out of time.result
provides an int of 0 if someone forfeits. 1 if either they win, lose or run out of time. 2 if it's a tie.winner
is an int of 0 or 1 with 0 being the the user who requested the challenge while 1 is the opponent. Usebattle.me
to check.onBeginTurn(turn)
Triggers on every turn.turn
provides an int of the current turn count.onCriticalHit(spot)
Triggers when a Pokémon deals a critical hit, including from multi hit moves.spot
is the Pokémon that dealt the critical hit, not the Pokémon getting hit from it.onFlinch(spot)
Triggers when a Pokémon flinches.spot
is the Pokémon that flinched and was unable to move due to their opponent, not the Pokémon that dealt the attack that caused it.onMiss(spot)
Triggers when a Pokémon misses their attack.spot
is the Pokémon that missed, not the one who evaded. Type immunity does not count. (Exmaple: Normal type move can't hit Ghost types.) Evading with Dig, Fly, Phantom Force and Shadow Force does count. Status moves that are blocked with Safe Guard does not count. Hitting a Pokémon with Wonder Guard does not count.onPlayerMessage(spot, message)
Triggers when a battler sends a message. This doesn't include spectator messages.onStatusDamage(spot, status)
Triggers when a user receives damage from status effects.spot
is the user receiving the status damage, not the one who infected it. Detects: Burn, Confusion, Poisoned.onStatusNotification(spot, status)
Triggers during a status notification.spot
is the user receiving the status, not the one who dealt it. Detects: Confused (before self damage or uses move), Frozen, Paralysed, SleeponTierNotification(tier)
Triggers when the notification is shown at the start of battle.tier
is a string of the name of the tier being played. This is the only event that catches the tier name.
Event Parameter Index and Explanations
This index explains all the parameters you'll find in these events.
result
This provides an int of 0 if someone forfeits. 1 if either they win, lose or run out of time. 2 if it's a tie. OnlyonBattleEnd(result, winner)
can obtain this parameter.spot
This provides an int of 1 of 3 from the player's pokemon team position when the event is called. 0, 2, 4 is the user's 3 sides. 1, 3, 5 is the opponent's 3 sides.battle.me
for 0 andbattle.opp
for 1 can be used for checking this but won't detect double or triple modes.status
This provides an int of the status event being triggered. The values are: 1 Paralysed, 2 Sleep, 3 Frozen, 4 Burn, 5 Normal/Badly Poisoned, 6 Confused. From my tests, there is no detection for: Infatuation, Perish Song.tier
This provides a string of the tier name being played. OnlyonTierNotification(tier)
can obtain this parameter.turn
This provides an int of the turn counter. OnlyonBeginTurn(turn)
can obtain this parameter.winner
This provides an int of 0 or 1 with 0 being the the user who requested the challenge while 1 is the opponent. Usebattle.me
to check. OnlyonBattleEnd(result, winner)
can obtain this parameter.