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]
(please excuse the cutoff in the second image, I couldn't be bothered to fix it at the time lol)
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! 🙏
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:
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!
Here's hoping somebody else out there finds this useful! Happy game-making! 😂
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]
(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');
};
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');
};
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! 🙏
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.
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)
Here's hoping somebody else out there finds this useful! Happy game-making! 😂