This is a battle script to automatically send a message to your opponent when you are down to your last Pokemon. Just like the Gym Leaders in the games for example. You need to have the Script Window plug-in installed before you can use this. Code (text): ({ onTierNotification: function(){ /* SET VARIABLE */ vPokeNum = 6; vBotSymbol = "~ "; }, onKo: function(spot){ /* DOWN TO LAST POKEMON MESSAGE */ if (spot==battle.me){ vPokeNum--; if (vPokeNum==1){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE."); } } } }) Script made, with the help of SongSing's example scripts (Pre-Battle Message) and coyotte508's battle script tutorial (Battle scripting (next update)).
Thanks. :) Even though I had plenty of experience with JavaScript, I actually had quite a difficult time trying to understand the battle script's syntax. But your examples really helped a lot. Hopefully, this will help a lot of players get into battle scripting and understanding how it works better. ^_^
Installed the script, works perfect, just has an unwanted ~ preceding the message. Is there any way I can do this for 5 Pokemon, 4 Pokemon, etc.? And if using a super effective attack, not very effective attack, OHKOing, and if it does a certain amount of damage?
I mentioned in the instructions about ~ before the message. Just remove the contents of "~ " but leaving the quotes so they look like this "". This way it won't display ~ before the message. It should look like this now: Code (text): vBotSymbol = ""; For having different number of Pokemon left messages. Just add another one of these lines, but change the ==1 part to the number of Pokémon remaining you want it to display for. And of course, giving it another message. Code (text): if (vPokeNum==1){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE."); } Here's a completed one: Code (text): ({ onTierNotification: function(){ /* SET VARIABLE */ vPokeNum = 6; vBotSymbol = ""; }, onKo: function(spot){ if (spot==battle.me){ vPokeNum--; // 5 POKEMON REMAINING MESSAGE if (vPokeNum==5){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE 5."); } // 4 POKEMON REMAINING MESSAGE if (vPokeNum==4){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE 4."); } // 3 POKEMON REMAINING MESSAGE if (vPokeNum==3){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE 3."); } // 2 POKEMON REMAINING MESSAGE if (vPokeNum==2){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE 2."); } // LAST POKEMON REMAINING MESSAGE if (vPokeNum==1){ battle.battleMessage(battle.id, vBotSymbol + "MESSAGE HERE LAST."); } } }, }) If you don't want one of them to display. Just delete one of them. I spaced them out so you don't delete anything by accident. I'm afraid I don't how to detect "Super Effective", "Not Very Effective", "1 Hit KO" or "Damage Conditions" yet. I tried "Damage Condition" once before but was unsuccessful. Hope this helps. :)