Skill Message Plugin

Kitdan7

Villager
Member
Joined
Dec 29, 2018
Messages
16
Reaction score
4
First Language
English
Primarily Uses
RMMV
I want a move to say "(character) tried to eat (target)!" (character is a snake) so, I need a plugin that makes %2 display the target's name. I know it's possible because I found an old post that gave a code for exactly that, (link) but I think it was either too old to be compatible with updates or I did something wrong trying to convert the code to plugin form. I'd try to fix the problem myself, but I understand nothing about how plugins work, so I'd probably end up corrupting my whole computer somehow. I am using YEP_BattleEngineCore, btw.
 

Kitdan7

Villager
Member
Joined
Dec 29, 2018
Messages
16
Reaction score
4
First Language
English
Primarily Uses
RMMV
Um... Bump?
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
I wrote this almost a year ago that does exactly this.
If I remember correctly if there are too many targets then it goes out of screen tho.

Code:
//=============================================================================
// MRP_BattleLogSkillTarget.js
//=============================================================================
/*:
 * @plugindesc Skills can now display target names using %2
 * @author Magnus0808
 */
 
(function() {
   
    Window_BattleLog.prototype.displayAction = function(subject, item) {
        var numMethods = this._methods.length;
        var targets = BattleManager._targets;
       
        if (DataManager.isSkill(item)) {
            var targets_string = "";
            // Checks if there is a target
            if (targets && targets.length > 0) {
                targets_string += targets[0].name();
                // Checks if there is more than a single target
                if (targets.length > 1) {
                    for (var i = 1; i < targets.length-1; i++) {
                        targets_string += ", " + targets[i].name();
                    }
                    targets_string += " and " + targets[targets.length-1].name();
                }
            }
            if (item.message1) {
                this.push('addText', subject.name() + item.message1.format(item.name, targets_string));
            }
            if (item.message2) {
                this.push('addText', item.message2.format(item.name, targets_string));
            }
        } else {
            this.push('addText', TextManager.useItem.format(subject.name(), item.name));
        }
        if (this._methods.length === numMethods) {
            this.push('wait');
        }
    };
})();
 

Attachments

Last edited:

Kitdan7

Villager
Member
Joined
Dec 29, 2018
Messages
16
Reaction score
4
First Language
English
Primarily Uses
RMMV
I wrote this almost a year ago that does exactly this.
If I remember correctly if there are too many targets then it goes out of screen tho.
Code:
//=============================================================================
// SkillMessage.js
//=============================================================================
/*:
 * @plugindesc Skills can now display target names using %2
 * @author Magnus0808
 */
 
(function() {
   
    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;
           
        if (DataManager.isSkill(item)) {
            var targets_string = "";
            // Checks if there is a target
            if (targets && targets.length > 0) {
                targets_string += targets[0].name();
                // Checks if there is more than a single target
                if (targets.length > 1) {
                    for (var i = 1; i < targets.length-1; i++) {
                        targets_string += ", " + targets[i].name();
                    }
                    targets_string += " and " + targets[targets.length-1].name();
                }
            }
            if (item.message1) {
                this.push('addText', subject.name() + item.message1.format(item.name, targets_string));
            }
            if (item.message2) {
                this.push('addText', item.message2.format(item.name, targets_string));
            }
        } else {
            this.push('addText', TextManager.useItem.format(subject.name(), item.name));
        }
        if (this._methods.length === numMethods) {
            this.push('wait');
        }
    };
})();
Tried it, but it doesn't show the target's name, it just doesn't put anything there. Here's a screenshot of my active plugins, if that helps.
Your plugin is highlighted.
Plugins.png
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
I should have checked if it worked with YEP_BattleEngineCore first. I changed it a bit and it should work now. It should be placed above YEP_BattleEngineCore.

I have edited my original reply :)
 

Kitdan7

Villager
Member
Joined
Dec 29, 2018
Messages
16
Reaction score
4
First Language
English
Primarily Uses
RMMV
I should have checked if it worked with YEP_BattleEngineCore first. I changed it a bit and it should work now. It should be placed above YEP_BattleEngineCore.

I have edited my original reply :)
It works now. Thanks!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top