Status
Not open for further replies.

EblyssR

Warper
Member
Joined
Oct 24, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
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:
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,319
Reaction score
11,744
First Language
English
Primarily Uses
RMVXA
@EblyssR You reported this for closing as you had solved it yourself. It would be helpful to any other Member who has the same problem if you posted your solution. I am, therefore, leaving this open to give you the opportunity to do that.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,468
Reaction score
5,596
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Stop shutting the damn power down! Why always like this
Working on a slightly experimental horror game. It will be finished in approximately 88888888888 years.
Y'all will enjoy it though, I put lots of effort into making it stand out.

It's called Red Light and it's inspired by another obscure RPG Maker horror game, but I don't want to give too much away just yet.
Ohh man, Weapon animations plugin feels so mandatory. Seeing that same image regardless of the icon of the weapon....ugh :p
Ok so......Maaaaybe I've taken a ''little'' bit of inspiration from FF9 when it comes to battle hud xD

ff9.PNG

Just maybe....

Forum statistics

Threads
112,356
Messages
1,067,715
Members
146,004
Latest member
Faxify
Top