RPG Maker Forums

Hello there! Sorry ahead of time, I'm not very good or knowledgable when it comes to coding and technical stuff, but I'm eager to learn! I also hope I posted this in the correct category, took a bit of a gamble but I think this is more a JS (and my idiocy lmao) issue than Luna engine

So, I was messing around with Yanfly's Item core (Here) and Luna engine (Here), I'm trying to replace the text that tells you what actor has a piece of equipment equipped, with an icon.

What it started off as(as well as what I'm talking about) , and what I managed to do without luna engine]
img1.png img2.png
(please excuse the cutoff in the second image, I couldn't be bothered to fix it at the time lol)

Window_ItemList.prototype.drawEquippedActor = function(item, dx, dy, dw) {
var carrier = null;
for (var a = 0; a < $gameParty.members().length; ++a) {
var actor = $gameParty.members()[a];
if (!actor) continue;
if (actor.equips().contains(item)) carrier = $gameParty.members()[a].actorId() + 100;
};
this.drawIcon(carrier, dx, dy, dw, 'right');
};
Unfortunately (and really I shoulda remembered this lol) because Luna engine like either completely overwrites (or covers if you're using the addition mode thingy) So changing it in item core was kinda useless. In Luna engine's SceneItem.yml file I changed I added a new icon thing, thinking I could just use the carrier variable from itemcore plugin, and it did kinda work.

I tried replacing "this.drawIcon(carrier, dx, dy, dw, 'right');" with "return carrier;"

it draws the icon, but it won't run through the part of the function that gives it the ID it needs, it just keeps returning the original "null" value.

Something tells me it has to do with the "return carrier;" thing but I don't really understand what I'm doing lol

Any and all help is super super appreciated, thank you! :kaothx:

Edit: Solution

(@Kes suggested I post the solution, which I actually didn't even think to do lol, Thank you for reminding me!)

In Yep_ItemCore, you'll want to change the drawEquippedActor to this:

Window_ItemList.prototype.drawEquippedActor = function(item, dx, dy, dw) {
var carrier = 0;
for (var a = 0; a < $gameParty.members().length; ++a) {
var actor = $gameParty.members()[a];
if (!actor) continue;
if (actor.equips().contains(item)) carrier = $gameParty.members()[a].actorId()+ 109;
};
var icon = carrier;
return icon;
};

Note: The "109" value in there is just on offset, so it will start looking for icons after icon 109, you can change that freely to the number just before your face/actor icon.

in Lunaengine, you'll want to add the component that draws the icon (You might be able to do this with Images too but I haven't really tried that)

and in the "iconIndex:" line paste this

iconIndex: "${(Window_ItemList.prototype.drawEquippedActor(data))}"

and boom!

(This was taken from my WIP project whereas the other screenshots were from Yanfly'sdebug test project, so custom assets and stuff for luna engine are being used here, but the EquippedActor icon bit is all the same)

img3.png

Here's hoping somebody else out there finds this useful! Happy game-making! :kaojoy:

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,050
Messages
1,018,548
Members
137,835
Latest member
yetisteven
Top