- 4
- Posts
- 6
- Years
- Under the bed
- Seen Apr 10, 2023
After hours of toiling away, tinkering with EBS, I finally found asked for help with a solution for changing the battle background when a terrain effect becomes active, using the Elite Battle System by Luka SJ.[/URL]
Now, I'm going to share it, to help everyone else, so nobody else has to bother the poor man about this ever again.
1. The first step is to, obviously, install Elite Battle System. If you haven't... go and do that.
2. Navigate to the EliteBattle_1 script section. In the class PokeBattle_Scene, copy and paste the following around line 135:
This method is designed to be infinitely expandable so that you can add as many terrain effects as you want. Remember that when doing so, you'll need to add to this piece of code, otherwise nothing will happen.
$globalBackdrop is the backdrop that the method will reset to once the terrain effect ends. In order to get this variable, paste the following above "# Choose bases" in PBBackdrop. (I recommend line 89 for this, that's where I put it
The "zElectricTerrain" of this line is the name of battle back that you will be changing to once the respective terrain effect comes into play. For reference, these need to be kept within Graphics/Battlebacks/battlebg within your Pokemon Essentials folder, along with all the other battle backgrounds from EBS.
3. The next step is making it activate when the moves are used. In PokeBattle_MoveEffects, find the code for the move Electric Terrain. Then, paste the following above "An electric current runs across the battlefield!"
This tells the method what terrain effect to use, then calls it. Remember that for every other terrain effect you add to this method, the "$terrainEffectsBG=" will need to be a different number.
This will make it so that the battle background changes whenever electric terrain is activated via the move.
4. Now, we need to make it apply to more than just moves. Most notably, the Electric Surge ability, if you have that installed (If not, skip this step)
This is the part where it could get tricky depending on how different people have integrated Electric Surge. Regardless, navigate to where you have it installed and, once again, paste the following above whatever message plays when the ability is activated.
This will call the method and tell it to use Electric Terrain's graphic, just like the move.
5. The final step is ensuring that it returns to normal at the correct time.
In PokeBattle_Battle, find the code that ends Electric Terrain. It should be under the effects for Water Sport and Mud Sport.
Then paste the following above "The electric current disappeared from the battlefield."
We don't need the full "@battle.scene.pbChangeBGSprite" here because we're already in the section of the script that handles the battle. I think that's why idk don't ask me but it breaks otherwise.
That should now be everything. Huzzah.
Using this same method it could easily be expanded to include the battle bases as well, but, at least it works.
Now, I'm going to share it, to help everyone else, so nobody else has to bother the poor man about this ever again.
1. The first step is to, obviously, install Elite Battle System. If you haven't... go and do that.
2. Navigate to the EliteBattle_1 script section. In the class PokeBattle_Scene, copy and paste the following around line 135:
Code:
#Change battle background
def pbChangeBGSprite
case $terrainEffectsBG
when 0 # Normal
@sprites["battlebg"].setBitmap($globalBackdrop,self)
when 1 #Electric Terrain
@sprites["battlebg"].setBitmap("zElectricTerrain",self)
end
end
This method is designed to be infinitely expandable so that you can add as many terrain effects as you want. Remember that when doing so, you'll need to add to this piece of code, otherwise nothing will happen.
Code:
when 0 # Normal
@sprites["battlebg"].setBitmap($globalBackdrop,self)
$globalBackdrop is the backdrop that the method will reset to once the terrain effect ends. In order to get this variable, paste the following above "# Choose bases" in PBBackdrop. (I recommend line 89 for this, that's where I put it
Code:
$globalBackdrop = backdrop
Code:
when 1 #Electric Terrain
@sprites["battlebg"].setBitmap("zElectricTerrain",self)
The "zElectricTerrain" of this line is the name of battle back that you will be changing to once the respective terrain effect comes into play. For reference, these need to be kept within Graphics/Battlebacks/battlebg within your Pokemon Essentials folder, along with all the other battle backgrounds from EBS.
3. The next step is making it activate when the moves are used. In PokeBattle_MoveEffects, find the code for the move Electric Terrain. Then, paste the following above "An electric current runs across the battlefield!"
Code:
$terrainEffectsBG=1
@battle.scene.pbChangeBGSprite
This tells the method what terrain effect to use, then calls it. Remember that for every other terrain effect you add to this method, the "$terrainEffectsBG=" will need to be a different number.
This will make it so that the battle background changes whenever electric terrain is activated via the move.
4. Now, we need to make it apply to more than just moves. Most notably, the Electric Surge ability, if you have that installed (If not, skip this step)
This is the part where it could get tricky depending on how different people have integrated Electric Surge. Regardless, navigate to where you have it installed and, once again, paste the following above whatever message plays when the ability is activated.
Code:
$terrainEffectsBG=1
@battle.scene.pbChangeBGSprite
This will call the method and tell it to use Electric Terrain's graphic, just like the move.
5. The final step is ensuring that it returns to normal at the correct time.
In PokeBattle_Battle, find the code that ends Electric Terrain. It should be under the effects for Water Sport and Mud Sport.
Then paste the following above "The electric current disappeared from the battlefield."
Code:
$terrainEffectsBG=0
@scene.pbChangeBGSprite
We don't need the full "@battle.scene.pbChangeBGSprite" here because we're already in the section of the script that handles the battle.
That should now be everything. Huzzah.
Using this same method it could easily be expanded to include the battle bases as well, but, at least it works.