RMMV Can I customize battle messages on a skill-by-skill or type basis?

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hi! So when you use a move, the game generally shows a message like "X took Y damage!" I was wondering if through the usage of plugins (or even without them if I've just completely missed something) I could replace and decide which of those messages show on a skill-by-skill basis, or (less likely in my mind) on a type basis?
An example might be if I wanted my "Target gained X MP!" and "Target gained X TP!" to be unique from each other, i.e. "Target gained X MP!" v.s. "Target's TP went up by X!"
I assume I most likely would have to manually change the messages in each attack that targets MP/TP, but I don't know how I would do that, or if I would just be able to change it just by setting a "Gain MP" message and a "Gain TP" message.
Thank you in advance!
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
i found this link to an older thread (dont post in it or you'll get a necro posting warning)
figured could work since plugin maker for it says...
this technically applies to every "Message" in that list on the Terms tab...not really suitable for some of them, but hey~
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
673
Reaction score
397
First Language
English
Primarily Uses
RMMV
Looks like the logic that handles messages for skills is in rpg_windows.js:
Code:
Window_BattleLog.prototype.displayAction = function(subject, item) {
    var numMethods = this._methods.length;
    if (DataManager.isSkill(item)) {
        if (item.message1) {
            this.push('addText', subject.name() + item.message1.format(item.name));
        }
        if (item.message2) {
            this.push('addText', item.message2.format(item.name));
        }
    } else {
        this.push('addText', TextManager.useItem.format(subject.name(), item.name));
    }
    if (this._methods.length === numMethods) {
        this.push('wait');
    }
};

If you look at $dataSkills, you'll see they have a message1 and message2 property, which is referenced in the conditional block for if (item.message1) and if (item.message2).

The formatting there is hardcoded - subject.name() + item.message1.format(item.name) if it's the first line (in the Maker database window, where it says "(User Name) _____", and then just item.message2.format(item.name), which is the next input line below it.

For a skill-by-skill basis, I might try just leaving the first line blank and making use of the second line.

Alternatively, you could modify the displayAction method with a Plugin to have a conditional that would probably read a note from the skill (via the meta property).
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
@Zevia the messages they mentioned though are the 1s from the terms-messages which show up after the skill's messages.
user ___ would be the incantation message, followed by the flair message (the 2nd skill's message), followed by the effect message (terms-messages)
and was asking about possibility to have different terms-message on a skill by skill basis.

dont know about if possible for a skill by skill basis but at least can get some more variation then only having 1 terms-message for each skill. even if the plugin from the the link does just pick 1 from the possible messages at random.
 
Last edited:

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
i found this link to an older thread (dont post in it or you'll get a necro posting warning)
figured could work since plugin maker for it says...
Hm. That does allow for randomized variation of the messages, but I'm not really looking for randomization, I want to be able to control the message depending on what the variables in the message are; so if %3 is MP, do one message, and if it's TP, do another. Maybe I can modify with the plugin they sent to make this possible, though.
 

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hm. That does allow for randomized variation of the messages, but I'm not really looking for randomization, I want to be able to control the message depending on what the variables in the message are; so if %3 is MP, do one message, and if it's TP, do another. Maybe I can modify with the plugin they sent to make this possible, though.
Actually, would that be a possibility? Is there a way I could test what "%3" is inside that plugin? I imagine the altered code would look something like this:

JavaScript:
(function(alias) {
'use strict';
    const SPLIT = '|';
    TextManager.message = function(messageId) {
        let msg = alias.apply(this, arguments) || '';
        let arr = msg.split(SPLIT);
        let type = "However you would get %3";
        switch (type) {
            case "MP":
                return arr[0] || '';
                break;
            case "TP":
                return arr[1] || '';
                break;
        }
    };
})(TextManager.message);
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,675
Reaction score
2,760
First Language
EN
Primarily Uses
RMMZ
By default these damage messages replace:
  • %1 with the target name (e.g. Harold);
  • %2 with the attribute name (e.g. MP or TP);
  • %3 with the damage/heal value (e.g. 12).
I had a quick look at the core scripts and I think these are the relevant methods:
JavaScript:
Window_BattleLog.prototype.makeHpDamageText = function(target) {
    var result = target.result();
    var damage = result.hpDamage;
    var isActor = target.isActor();
    var fmt;
    if (damage > 0 && result.drain) {
        fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;
        return fmt.format(target.name(), TextManager.hp, damage);
    } else if (damage > 0) {
        fmt = isActor ? TextManager.actorDamage : TextManager.enemyDamage;
        return fmt.format(target.name(), damage);
    } else if (damage < 0) {
        fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;
        return fmt.format(target.name(), TextManager.hp, -damage);
    } else {
        fmt = isActor ? TextManager.actorNoDamage : TextManager.enemyNoDamage;
        return fmt.format(target.name());
    }
};

Window_BattleLog.prototype.makeMpDamageText = function(target) {
    var result = target.result();
    var damage = result.mpDamage;
    var isActor = target.isActor();
    var fmt;
    if (damage > 0 && result.drain) {
        fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;
        return fmt.format(target.name(), TextManager.mp, damage);
    } else if (damage > 0) {
        fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;
        return fmt.format(target.name(), TextManager.mp, damage);
    } else if (damage < 0) {
        fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;
        return fmt.format(target.name(), TextManager.mp, -damage);
    } else {
        return '';
    }
};

Window_BattleLog.prototype.makeTpDamageText = function(target) {
    var result = target.result();
    var damage = result.tpDamage;
    var isActor = target.isActor();
    var fmt;
    if (damage > 0) {
        fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;
        return fmt.format(target.name(), TextManager.tp, damage);
    } else if (damage < 0) {
        fmt = isActor ? TextManager.actorGain : TextManager.enemyGain;
        return fmt.format(target.name(), TextManager.tp, -damage);
    } else {
        return '';
    }
};
From that, it looks like:
  • + HP and MP use the Actor|Enemy Recovery message, but TP uses Actor|Enemy Gain.
  • - MP and TP use Actor|Enemy Loss (HP uses Actor|Enemy Damage).
If you want to separate the MP and TP loss messages then try the attached plugin. (Full code in spoiler below.)
JavaScript:
// ==================================================
// TPLossMessage.js
// ==================================================

/*:
 * @plugindesc Use separate messages for MP and TP loss.
 * @author Caethyril
 * @help MP damage will use the normal Actor|Enemy Loss message.
 * TP damage will use the Actor|Enemy message from this plugin's parameters.
 * 
 * Terms of use: free to use and/or modify for any project.
 *
 * @param Actor TP Loss Message
 * @type text
 * @desc Message used when an actor loses TP.
 * Leave blank to use default (Terms: Actor Loss).
 * @default
 * 
 * @param Enemy TP Loss Message
 * @type text
 * @desc Message used when an enemy loses TP.
 * Leave blank to use default (Terms: Enemy Loss).
 * @default
 */

(function(pluginName) {
'use strict';

    var isTP = false;

    var msgLoseTP = (function(p) {
        return {
            actorLoss: p['Actor TP Loss Message'],
            enemyLoss: p['Enemy TP Loss Message']
        };
    })(PluginManager.parameters(pluginName));

    (function(alias) {
        Window_BattleLog.prototype.makeMpDamageText = function(target) {
            isTP = false;
            return alias.apply(this, arguments);
        };
    })(Window_BattleLog.prototype.makeMpDamageText);

    (function(alias) {
        Window_BattleLog.prototype.makeTpDamageText = function(target) {
            isTP = true;
            return alias.apply(this, arguments);
        };
    })(Window_BattleLog.prototype.makeTpDamageText);

    (function(alias) {
        TextManager.message = function(messageId) {
            if (isTP) {
                var msg = String(msgLoseTP[messageId] || '').trim();
                if (msg) return msg;
            }
            return alias.apply(this, arguments);
        };
    })(TextManager.message);

})('TPLossMessage');
Note that this plugin has parameters, so its file name is important. If you want to rename it, you'll have to edit the last line of the plugin code to match the new file name.

[Edit: ah, I just realised you originally asked for different messages for each skill/item. That might need a different approach, sorry. :kaoslp:]
 

Attachments

  • TPLossMessage.js
    1.8 KB · Views: 1
Last edited:

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
By default these damage messages replace:
  • %1 with the target name (e.g. Harold);
  • %2 with the attribute name (e.g. MP or TP);
  • %3 with the damage/heal value (e.g. 12).
I had a quick look at the core scripts and I think these are the relevant methods:
JavaScript:
Window_BattleLog.prototype.makeHpDamageText = function(target) {[/INDENT]
[INDENT]    var result = target.result();[/INDENT]
[INDENT]    var damage = result.hpDamage;[/INDENT]
[INDENT]    var isActor = target.isActor();[/INDENT]
[INDENT]    var fmt;[/INDENT]
[INDENT]    if (damage > 0 && result.drain) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.hp, damage);[/INDENT]
[INDENT]    } else if (damage > 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorDamage : TextManager.enemyDamage;[/INDENT]
[INDENT]        return fmt.format(target.name(), damage);[/INDENT]
[INDENT]    } else if (damage < 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.hp, -damage);[/INDENT]
[INDENT]    } else {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorNoDamage : TextManager.enemyNoDamage;[/INDENT]
[INDENT]        return fmt.format(target.name());[/INDENT]
[INDENT]    }[/INDENT]
[INDENT]};[/INDENT]
[INDENT][/INDENT]
[INDENT]Window_BattleLog.prototype.makeMpDamageText = function(target) {[/INDENT]
[INDENT]    var result = target.result();[/INDENT]
[INDENT]    var damage = result.mpDamage;[/INDENT]
[INDENT]    var isActor = target.isActor();[/INDENT]
[INDENT]    var fmt;[/INDENT]
[INDENT]    if (damage > 0 && result.drain) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.mp, damage);[/INDENT]
[INDENT]    } else if (damage > 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.mp, damage);[/INDENT]
[INDENT]    } else if (damage < 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.mp, -damage);[/INDENT]
[INDENT]    } else {[/INDENT]
[INDENT]        return '';[/INDENT]
[INDENT]    }[/INDENT]
[INDENT]};[/INDENT]
[INDENT][/INDENT]
[INDENT]Window_BattleLog.prototype.makeTpDamageText = function(target) {[/INDENT]
[INDENT]    var result = target.result();[/INDENT]
[INDENT]    var damage = result.tpDamage;[/INDENT]
[INDENT]    var isActor = target.isActor();[/INDENT]
[INDENT]    var fmt;[/INDENT]
[INDENT]    if (damage > 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.tp, damage);[/INDENT]
[INDENT]    } else if (damage < 0) {[/INDENT]
[INDENT]        fmt = isActor ? TextManager.actorGain : TextManager.enemyGain;[/INDENT]
[INDENT]        return fmt.format(target.name(), TextManager.tp, -damage);[/INDENT]
[INDENT]    } else {[/INDENT]
[INDENT]        return '';[/INDENT]
[INDENT]    }[/INDENT]
[INDENT]};
From that, it looks like:
  • + HP and MP use the Actor|Enemy Recovery message, but TP uses Actor|Enemy Gain.
  • - MP and TP use Actor|Enemy Loss (HP uses Actor|Enemy Damage).
If you want to separate the MP and TP loss messages then try the attached plugin. (Full code in spoiler below.)
JavaScript:
// ==================================================[/INDENT]
[INDENT]// TPLossMessage.js[/INDENT]
[INDENT]// ==================================================[/INDENT]
[INDENT][/INDENT]
[INDENT]/*:[/INDENT]
[INDENT]* @plugindesc Use separate messages for MP and TP loss.[/INDENT]
[INDENT]* @author Caethyril[/INDENT]
[INDENT]* @help MP damage will use the normal Actor|Enemy Loss message.[/INDENT]
[INDENT]* TP damage will use the Actor|Enemy message from this plugin's parameters.[/INDENT]
[INDENT]*[/INDENT]
[INDENT]* Terms of use: free to use and/or modify for any project.[/INDENT]
[INDENT]*[/INDENT]
[INDENT]* @param Actor TP Loss Message[/INDENT]
[INDENT]* @type text[/INDENT]
[INDENT]* @desc Message used when an actor loses TP.[/INDENT]
[INDENT]* Leave blank to use default (Terms: Actor Loss).[/INDENT]
[INDENT]* @default[/INDENT]
[INDENT]*[/INDENT]
[INDENT]* @param Enemy TP Loss Message[/INDENT]
[INDENT]* @type text[/INDENT]
[INDENT]* @desc Message used when an enemy loses TP.[/INDENT]
[INDENT]* Leave blank to use default (Terms: Enemy Loss).[/INDENT]
[INDENT]* @default[/INDENT]
[INDENT]*/[/INDENT]
[INDENT][/INDENT]
[INDENT](function(pluginName) {[/INDENT]
[INDENT]'use strict';[/INDENT]
[INDENT][/INDENT]
[INDENT]    var isTP = false;[/INDENT]
[INDENT][/INDENT]
[INDENT]    var msgLoseTP = (function(p) {[/INDENT]
[INDENT]        return {[/INDENT]
[INDENT]            actorLoss: p['Actor TP Loss Message'],[/INDENT]
[INDENT]            enemyLoss: p['Enemy TP Loss Message'][/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(PluginManager.parameters(pluginName));[/INDENT]
[INDENT][/INDENT]
[INDENT]    (function(alias) {[/INDENT]
[INDENT]        Window_BattleLog.prototype.makeMpDamageText = function(target) {[/INDENT]
[INDENT]            isTP = false;[/INDENT]
[INDENT]            return alias.apply(this, arguments);[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(Window_BattleLog.prototype.makeMpDamageText);[/INDENT]
[INDENT][/INDENT]
[INDENT]    (function(alias) {[/INDENT]
[INDENT]        Window_BattleLog.prototype.makeTpDamageText = function(target) {[/INDENT]
[INDENT]            isTP = true;[/INDENT]
[INDENT]            return alias.apply(this, arguments);[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(Window_BattleLog.prototype.makeTpDamageText);[/INDENT]
[INDENT][/INDENT]
[INDENT]    (function(alias) {[/INDENT]
[INDENT]        TextManager.message = function(messageId) {[/INDENT]
[INDENT]            if (isTP) {[/INDENT]
[INDENT]                var msg = String(msgLoseTP[messageId] || '').trim();[/INDENT]
[INDENT]                if (msg) return msg;[/INDENT]
[INDENT]            }[/INDENT]
[INDENT]            return alias.apply(this, arguments);[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(TextManager.message);[/INDENT]
[INDENT][/INDENT]
[INDENT]})('TPLossMessage');
Note that this plugin has parameters, so its file name is important. If you want to rename it, you'll have to edit the last line of the plugin code to match the new file name.

[Edit: ah, I just realised you originally asked for different messages for each skill/item. That might need a different approach, sorry. :kaoslp:]
It worked perfectly! Could you modify it to also affect the TP gain message too, though? I tried modifying it myself but just broke it, ehehe. :kaoblush:
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,675
Reaction score
2,760
First Language
EN
Primarily Uses
RMMZ
It worked perfectly! Could you modify it to also affect the TP gain message too, though? I tried modifying it myself but just broke it, ehehe. :kaoblush:
Like I mentioned, TP and MP already use different messages for gain. Check the Actor Gain (TP) and Actor Recovery (HP/MP) terms in the database. :kaohi:
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
pretty sure HP/MP can pull from both term-messages for recovery and gain just depends on the method used for the recovery.
i think only pulls from the recovery message if use a normal HP/MP restore damage formula, but if use .gainMp() or effects section it will pull from the gain message instead.
but TP always just pulls from the terms-gain message.

nvm all that. just rechecked and ya MP is pulling from recovery message not the gain message for all 3 methods.
 
Last edited:

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
Like I mentioned, TP and MP already use different messages for gain. Check the Actor Gain (TP) and Actor Recovery (HP/MP) terms in the database. :kaohi:
Isn't the gain message TP uses used by more than just TP? I want to be able to isolate the TP gain message, ehehe.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,675
Reaction score
2,760
First Language
EN
Primarily Uses
RMMZ
Isn't the gain message TP uses used by more than just TP?
I don't see any other references to it in the core scripts. Are you seeing it somewhere else?
 

Cyndi4U

Veteran
Veteran
Joined
Jul 2, 2018
Messages
43
Reaction score
3
First Language
English
Primarily Uses
RMMV
I don't see any other references to it in the core scripts. Are you seeing it somewhere else?
No, I just assumed it would be used when you up stats with an item or skill... Hm. I guess that's my bad. Sorry for asking silly questions then.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,675
Reaction score
2,760
First Language
EN
Primarily Uses
RMMZ
No, I just assumed it would be used when you up stats with an item or skill... Hm. I guess that's my bad. Sorry for asking silly questions then.
It's OK! I didn't originally specify that the Actor|Enemy Gain terms are used exclusively by TP, so it wasn't a silly question.

I think by default the only stat change messages are related to buffs; in that case check out the (de)buff terms near the bottom of the list.

Happy RPG Making~ :kaojoy:
 

Latest Threads

Latest Posts

Latest Profile Posts

I'm still undecided weather or not I should add minor swearing to my game. Like I'm going for an all ages demographic... but the idea of a cartoon character saying dammit, hell, or crap in normal conversation is really funny to me.
If we assume an Elf's strong suit is Dexterity (AGI) & Intellect (MAT), I imagine Strength (ATK) & Constitution (DEF) would be among their lowest stats. But I'm having a hard deciding which should be lower, Strength or Constitution?
I'm really sorry to have to do this, but I'm going to have to start blocking those who repeatedly put up sexual content and offer absolutely nothing (that I've seen) related to what this community is supposedly created for.
Don't take it personal. I'm a rape victim with permanent injuries who can never enjoy 'it' ever again, so it's the last thing I want to have put in my face. :(
Check out my side project! It's a survival dungeon crawler! https://voidmoon-studio.itch.io/depths-of-delmora
RushLog wrote on HarlekinLehl's profile.
how do you attach those images to your posts?

Forum statistics

Threads
123,215
Messages
1,154,964
Members
161,596
Latest member
LilCronch
Top