Damage Formula and Battle Log Issue

Greetings, it has been quite a while since I have last posted on a forum.

Anyway, here's the issue. I've made this conditional damage formula in the "Skills" tab of the "Database" window,
here is the formula code:

"healVar = Math.floor((Math.random() * 100) + 10); hitVar = (healVar/-1); if(Math.random() > 0.5){a.gainHp(healVar); $gameMessage.add(healVar+" hp restored!");} else {a.gainHp(hitVar); $gameMessage.add(healVar+" hp lost!");}"


The code is a random self heal or self inflicted move to the user.
The formula functions fine; however, when it gets to the battle logs it displays "Harold took no damage!"
I used the "$gameMessage.add()" method to display the ideal text (picture below). I'm not sure how to change the battle logs to fix this, any help would be much appreciated.







cheers,


-JayMythos
The "no damage" message is because the skill result is always zero: the last line of the formula is always a $gameMessage.add(...) line, which lacks a return value.

Setting the text to nothing on the Terms tab just seems to leave a blank line in the battle log, so I think you'd need a plugin to remove it properly... Yanfly's Battle Engine Core offers this option, though I imagine there are alternatives available.

If you want to add text to the log window rather than the standard click-to-advance message box, you could try using this:
Code:
SceneManager._scene._logWindow.addText(healVar+" hp restored!");
Thanks for your reply caethyril, you were a great help. I did use the SceneManager code, and it worked. I'm reluctant to use any plugins because I want to design as much as possible independently. Worse comes to worse I'll check it out, thank you for the suggestion.

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-and-battle-log-issue.96079/