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

Discussion in 'RPG Maker MV' started by marcelox, Nov 6, 2015.

  1. marcelox

    marcelox Painfully Clueless Veteran

    Messages:
    86
    Likes Received:
    14
    Location:
    San Diego, CA
    First Language:
    English
    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 :)
     
    Last edited by a moderator: Nov 6, 2015
    #1
  2. Rexal

    Rexal Digital Fuzzball Veteran

    Messages:
    141
    Likes Received:
    258
    Location:
    Washington, USA
    First Language:
    C#
    Primarily Uses:
    RMMV
    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.
     
    #2
  3. marcelox

    marcelox Painfully Clueless Veteran

    Messages:
    86
    Likes Received:
    14
    Location:
    San Diego, CA
    First Language:
    English

    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
     
    #3
  4. Rexal

    Rexal Digital Fuzzball Veteran

    Messages:
    141
    Likes Received:
    258
    Location:
    Washington, USA
    First Language:
    C#
    Primarily Uses:
    RMMV
    ...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));      }    }};}
     
    Last edited by a moderator: Nov 6, 2015
    #4
  5. Nomi

    Nomi Veteran Veteran

    Messages:
    156
    Likes Received:
    47
    First Language:
    German
    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)



    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.
     
    Last edited by a moderator: Jul 24, 2016
    #5

Share This Page