Anyone know how to make Skills in Database show target name in the battle log?

Hi,

I'm making skills in the Database and I need some help with the Message coding. Normally a cure spell would have this in the Message part:

casts %1!

which says "...casts Cure!" in the battle

But I want to make something like:

casts %1 and (blank) recovers HP!

and I want (blank) to say the name of the character or enemy that the spell is being cast on. I tried using %2 instead of (blank) but that didn't work. Anyone know what %1 or whatever will make the game say the name of the target in the battle log?

Thanks 🙂
By itself, MV doesn't allow this. but with a little bit of coding...

Window_BattleLog.prototype.startAction = function(subject, action, targets) {var item = action.item();this.push('performActionStart', subject, action);this.push('waitForMovement');this.push('performAction', subject, action);this.push('showAnimation', subject, targets.clone(), item.animationId);this.displayAction(subject, item,targets);};Window_BattleLog.prototype.displayAction = function(subject, item,targets) {var numMethods = this._methods.length;    var target = "";    for(var i = 0; i<targets.length-1; i++){    if(i!=0)target += ', '+ targets.name();    else target += targets.name() + " ";    }    if(targets.length!=1)target += 'and ' + targets[targets.length-1].name(); else target += targets[0].name();    if (DataManager.isSkill(item)) {if (item.message1) {this.push('addText', subject.name() + item.message1.format(item.name,target));}if (item.message2) {this.push('addText', item.message2.format(item.name,target));}} else {this.push('addText', TextManager.useItem.format(subject.name(), item.name,target));}if (this._methods.length === numMethods) {this.push('wait');}}; Just use %2 and it'll say the name of all battlers being affected now.
By itself, MV doesn't allow this. but with a little bit of coding...

Window_BattleLog.prototype.startAction = function(subject, action, targets) {var item = action.item();this.push('performActionStart', subject, action);this.push('waitForMovement');this.push('performAction', subject, action);this.push('showAnimation', subject, targets.clone(), item.animationId);this.displayAction(subject, item,targets);};Window_BattleLog.prototype.displayAction = function(subject, item,targets) {var numMethods = this._methods.length;    var target = "";    for(var i = 0; i<targets.length-1; i++){    if(i!=0)target += ', '+ targets.name();    else target += targets.name() + " ";    }    if(targets.length!=1)target += 'and ' + targets[targets.length-1].name(); else target += targets[0].name();    if (DataManager.isSkill(item)) {if (item.message1) {this.push('addText', subject.name() + item.message1.format(item.name,target));}if (item.message2) {this.push('addText', item.message2.format(item.name,target));}} else {this.push('addText', TextManager.useItem.format(subject.name(), item.name,target));}if (this._methods.length === numMethods) {this.push('wait');}}; Just use %2 and it'll say the name of all battlers being affected now.


Hi, thanks for this. I made this into a js and activated it. Then I changed the battle messages to include %2 and then I tried a battle, as soon as I used the spell with %2 in it, it gave me this error: 

TypeError

Cannot read property 'length' of undefined
...I really need to start testing things with Yanfly's plugins. It works fine without, but with throws the error. Give me a bit, I'll make it compatible.

EDIT- Here. Just add this to the bottom of the plugin you made and it should work:

Code:
if(Imported.YEP_BattleEngineCore){        BattleManager.actionDisplayAction = function() {    this._logWindow.displayAction(this._subject, this._action.item(), this._targets);    return false;};Window_BattleLog.prototype.startAction = function(subject, action, targets) {};Yanfly.BEC.Window_BattleLog_displayAction = Window_BattleLog.prototype.displayAction;Window_BattleLog.prototype.displayAction = function(subject, item,targets) {    if (eval(Yanfly.Param.BECFullActText)) {      Yanfly.BEC.Window_BattleLog_displayAction.call(this, subject, item,targets);    } else {      this._actionIcon = item.iconIndex;      this.push('addText', '<SIMPLE>' + item.name);      if (item.message2) {        this.push('addText', '<CENTER>' + item.message2.format(item.name));      }    }};}
Hi there... I feel like a grave digger. But I need exactly that! The name of a target enemy. (to implement it as a actor name :x)

I made this into a js and activated it.



Sadly that kicked me out :/ Could u give me that js script? I tried to just copy it in a txt and load...but that didnt work 🙁


Maybe you could tell me "how" to kame it to a js script - that would possibly be even more worth then the js script.


Thanks a lot!


edit: Nevermind - just had to restart the maker.
So I found this plugin and I have to say, thank you very much for making it!

However, I found that it doesn't seem to like skills that target your whole team for say a buff skill, even when I'm not using %2 anywhere in the skill, here is a screen shot of the error file I get. I've had to censor out some of the folder names due to privacy issues, but the error messages should be easy enough read.
Error File.png
I am hoping that someone is able to point me in the right direction to fix this problem, as the only solution I have for now is to never have any skills that target the entire friendly team 🙁

@CardWielder , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


If you have a particular question you can create a new thread and ask it. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/anyone-know-how-to-make-skills-in-database-show-target-name-in-the-battle-log.49472/