The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Pixie1001 on December 14, 2015, 01:18:17 PM

Title: [VX] Help writing additional messages into the battlelog during a fight.
Post by: Pixie1001 on December 14, 2015, 01:18:17 PM
I'm not sure if this is the right place to post this since I don't a full add-on script, just some advice for writing a few lines into a common event, but any help would be appreciated.

Basically, I have a few skills that deal damage that's calculated using variables and inflicted via the 'set enemy HP' command using a linked common event. When the skill is used, it obviously shows the base damage in the battle log, but not the additional bonus damage.
I was wondering if there was a way I could insert a script into the attached common event that would display the secondary damage effect in the logs as well.

Something like-

BattleLog.Print(This attack inflicted an additional (Variable x) damage!)

I haven't the faintest idea how to code in Ruby however and my attempts to do so have resulted in error after error - I'd assume this would only take a few lines at most once I figured it out though? Or is it more complex than that? Is it even possible?

Help D:
Title: Re: [VX] Help writing additional messages into the battlelog during a fight.
Post by: &&&&&&&&&&&&& on December 14, 2015, 06:26:01 PM
Found
http://forums.rpgmakerweb.com/index.php?/topic/25061-how-to-force-the-battle-log-to-display-certain-messages/

Quote from: Archeia of rpgmakerweb
Okay first, add this scriptlet.
 
Code: [Select]
class Scene_Battle < Scene_Base
  attr_accessor:log_window
end

Then to force things, it kinda depends? Here's how I did it though. I made a custom formula but let it be called through a method.
Example:
         
Code: [Select]
class Game_Battler < Game_BattlerBase
  #---------------------------------------------------------------------------
  # Ralph's Stale Bread (#if (b.id==5 || b.id==7); b.tp+=20;  b.hp+=50; else; 20; end)
  #----------------------------------------------------------------------------
   def bread(a,b)
    if b.id.to_i == 5 || b.id.to_i == 7
      b.tp+=20
        if SceneManager.scene.is_a?(Scene_Battle) #This is to add custom battle log
          SceneManager.scene.log_window.add_text(b.name + " gained 20TP")
          SceneManager.scene.log_window.wait
        end
        return 50
    else
        if SceneManager.scene.is_a?(Scene_Battle)
SceneManager.scene.log_window.wait
end
      return 20
    end       
  end
end #End of Class
then I put this in the formula box of the item stale bread:
b.bread(a,b)
You could probably use:
SceneManager.scene.log_window.add_text("Insert custom text here")
SceneManager.scene.log_window.wait

If you want it to clear make sure to use this.
Code: [Select]
SceneManager.scene.log_window.wait_and_clear

Hope this helps.
Title: Re: [VX] Help writing additional messages into the battlelog during a fight.
Post by: Pixie1001 on December 15, 2015, 12:15:55 PM
Thanks! I'll try it out next time I get a chance and tell you how it goes.

Hopefully with great success :D
Title: Re: [VX] Help writing additional messages into the battlelog during a fight.
Post by: Pixie1001 on December 18, 2015, 06:36:21 AM
Hmmm, unfortunately that script was for ACE, so I don't know if all the syntax is the same :/

I'll keep tinking though and see if I can use it as a base.
Title: Re: [VX] Help writing additional messages into the battlelog during a fight.
Post by: &&&&&&&&&&&&& on December 18, 2015, 06:48:35 AM
Oh I'm sorry. I wasn't paying attention.
I tried looking at how it works and could only figure out how to display it as a message, but not as a battlelog.
Title: Re: [VX] Help writing additional messages into the battlelog during a fight.
Post by: Pixie1001 on December 18, 2015, 12:33:57 PM
It's cool - Enterbrain could've really saved their users a lot of time by just calling it RPG Maker ACE, but hey.

But yes, unfortunatly I didn't have much luck either :/

I imagine the concept is similar, but it's difficult to know what syntax needs changing and I still don't really understand the whole order of operations thing. Like, what happens if I call the event whilst another message is already being shown? Or during skill select? This isn't an issue in ACE, but in VX the battle log uses the same space as the action selection window.

I didn't really get what they meant be Method either. In Visual Basic they're like a separate section of code that can be referenced by any other line of code - but I'm not really sure how that translates into RPG Maker D:

Edit: Although I didn't find a solution to this exact issue, the 'YERD_DmgFormula' script solved all my problems for the purposes of incorporating bonus damage into the base damage of a skill, so I guess this thread can be closed :)

Again, thank you Boe for all your help :)