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
164
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
164
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 Posts

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,373
Messages
1,005,905
Members
135,894
Latest member
EnriX
Top