Resource icon

Standalone Ability Messages

A lot of people know the great Elite Battle System from Luka S.J., which comes with ability messages. However EBS is not suitable for all games, but some of you might still want to have the messages show up. SO here I'll show you how you can have that. Huge thanks to Luka S.J. for providing the code



What you need:
1) The code (provided here)
2) Graphics for the ability message (either make some yourself or get them from the official EBS download)


Step 1)
Create a new script section and call it "Abillity_Messages"

Step 2)
Copy and paste the following code.
This code is 100% from EBS
CODE=ruby]#=============================================================================
# Ability messages based on EBS
# Credits for code go to Luka S.J.
#=============================================================================

def showAbilityMessage(battler,hide=true)
return if battler.pokemon.nil?

effect=PBAbilities.getName(battler.ability)


bitmap=Bitmap.new("Graphics/Pictures/Battle/abilityMessage")
rect=(battler.index%2==0) ? Rect.new(0,56,280,56) : Rect.new(0,0,280,56)
baseColor=Color.new(225,225,225)#PokeBattle_SceneConstants::MESSAGEBASECOLOR
shadowColor=Color.new(32,32,32)#PokeBattle_SceneConstants::MESSAGESHADOWCOLOR

@sprites["abilityMessage"].bitmap.clear
@sprites["abilityMessage"].bitmap.blt(0,0,bitmap,rect)

bitmap=@sprites["abilityMessage"].bitmap
pbDrawOutlineText(bitmap,38,-3,280-38,bitmap.font.size,_INTL("{1}'s",battler.pokemon.name),baseColor,shadowColor,0)
pbDrawOutlineText(bitmap,0,27,280-28,bitmap.font.size,"#{effect}",baseColor,shadowColor,2)
@sprites["abilityMessage"].x=(battler.index%2==0) ? -280 : Graphics.width
o = @battle.doublebattle ? 30 : 0
@sprites["abilityMessage"].y=(battler.index%2==0) ? 150 + o : 150 - o
pbSEPlay("BW_ability")

10.times do
@sprites["abilityMessage"].x+=(battler.index%2==0) ? 28 : -28
@sprites["abilityMessage"].zoom_y+=0.1
Graphics.update
end

t=255
@sprites["abilityMessage"].tone=Tone.new(t,t,t)
50.times do
t-=25.5 if t > 0
@sprites["abilityMessage"].tone=Tone.new(t,t,t)
Input.update
Graphics.update
end
pbWait(20)
hideAbilityMessage(battler) if hide

end

def hideAbilityMessage(battler)
10.times do
@sprites["abilityMessage"].x+=(battler.index%2==0) ? -28 : 28
@sprites["abilityMessage"].zoom_y-=0.1
Graphics.update
end
end[/CODE]

Step 3)
In "PokeBattle_Battler" find
Ruby:
  def initialize(btl,index)
    @battle       = btl
    @index        = index
    @hp           = 0
    @totalhp      = 0
    @fainted      = true
    @captured     = false
    @stages       = []
    @effects      = []
    @damagestate  = PokeBattle_DamageState.new
    pbInitBlank
    pbInitEffects(false)
    pbInitPermanentEffects
  end
and after that add the following code:
Ruby:
def pbInitAbilMessage
    @viewport= Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=999999
    @sprites={}
    @sprites["abilityMessage"]=Sprite.new(@viewport)
    @sprites["abilityMessage"].bitmap=Bitmap.new(280,68)
    pbSetSystemFont(@sprites["abilityMessage"].bitmap)
    @sprites["abilityMessage"].oy=@sprites["abilityMessage"].bitmap.height/2+6
    @sprites["abilityMessage"].zoom_y=0
    @sprites["abilityMessage"].z=99999
  end

Step 4)
In the previous mentioned "def initialize(btl,index)" add the following line right before the "end" tag
Ruby:
pbInitAbilMessage
Step 5)
Place your graphic in Graphics\Pictures\Battle and name it "abilityMessage.png"

Step 6)
To show an ability message use
Ruby:
 showAbilityMessage(battler)
where battler refers to the battler object. For example: If you want to show an ability message for Intimidate the whole code would look like this:

Ruby:
# Intimidate
    if self.hasWorkingAbility(:INTIMIDATE) && onactive
      showAbilityMessage(self)
      PBDebug.log("[Ability triggered] #{pbThis}'s Intimidate")
      for i in 0...4
        if pbIsOpposing?(i) && !@battle.battlers[i].fainted?
          @battle.battlers[i].pbReduceAttackStatIntimidate(self)
        end
      end
    end
Credits
Luka S.J. | Code for Ability Message from Elite Battle System
Author
Hollow_Ego
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Hollow_Ego

Top