Displaying Current Weapon - HUD Maker

OneMoveLeft

Warper
Member
Joined
Apr 8, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi folks. I‘m finding it hard to resolve my issue and after 2 days have decided to see if the helpful RMMV community can assist. Im using SumRndmDde’s impressive HUD Maker plugin. Is someone able to inform me of the HUD Maker property value I would need to use in order to get the equipped weapon for an actor (say ID 150 in the actor database) displaying on the map HUD? Is it possible? It would have to change automatically when equipped weapon is changed. Also, can the associated weapon icon be displayed along with it?

Many thanks in anticipation. OML

Edit: Totally forgot to post the plugin link. Please forgive me!

Plugin can be downloaded here: http://sumrndm.site/hud-maker/
It may also be a good idea to install The Super Tools Engine: http://sumrndm.site/super-tools-engine/
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,297
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@OneMoveLeft Please edit your post to include a link to the web page where you got the plugin. That way, if anyone needs to check something before offering advice they won't have to go hunting.
Thanks.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,058
Reaction score
1,483
First Language
EN
Primarily Uses
RMMZ
Try one of these:
  • Name of first equipped weapon, or an empty string if no weapons equipped:
    Code:
    var weapon = $gameActors.actor(150).weapons()[0]; weapon ? weapon.name : ""
  • Name of item equipped in first equip slot, or an empty string if no item present:
    Code:
    var equip = $gameActors.actor(150).equips()[0]; equip ? equip.name : ""
Related: https://steamcommunity.com/app/363890/discussions/4/1333474229065936360/#c1333474229066371294

If that doesn't work, I think SRD's HUD Maker requires at least some evals to be enclosed in ${...} so that could be worth a try, e.g.
Code:
${var item = $gameActors.actor(150).weapons()[0]; item ? item.name : ""}
 

OneMoveLeft

Warper
Member
Joined
Apr 8, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thank you for the reply Caethyril.

Yes you are correct that the evals must be enclosed in ${...}.
I tried using the above examples and mostly got errors but then I removed the 'var item =' portion of the eval and everything after the semi colon so that visually it more resembled other evals that I've seen. This made the output change from 'Error' to '[object Object]' (minus quotes). Was not sure what this meant but it looked better!

Newayyyyy! To the good news. Between your code and the link you posted, I managed to stumble upon my 'Eureka' moment and now it is working!

The required eval is : ${$gameActors.actor(150).weapons()[0].name}

And Voila, HUD magic!!!
Many thanks for your assistance. I feel I may get a good night's sleep now!!!

P.S. This solution alone will still give an error if there are no weapons equipped. I believe I'll need to enter some conditions in HUD Maker to get that working. So for now ill just make sure a weapon is always equipped until I'm ready to battle that task!
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,058
Reaction score
1,483
First Language
EN
Primarily Uses
RMMZ
Oh, strange. I'm not familiar with the ${} string literal stuff, I guess it doesn't accept multiple lines (i.e. semi-colons). The var stuff was just to avoid writing stuff out multiple times; this is longer but could be worth a try:
Code:
${$gameActors.actor(150).weapons()[0] ? $gameActors.actor(150).weapons()[0].name : ''}
I.e. "is actor 150's first weapon truthy ? if so, return its name : otherwise return an empty string". If they have no weapons equipped, the first weapon will be undefined/null, both of which are falsy. Technical details here: Falsy (definition). :kaothx:

Also, the [object Object] thing you got is likely because you were asking the game to "write" the actual item, rather than just its name. :kaoswt:
 

OneMoveLeft

Warper
Member
Joined
Apr 8, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
RMMV
Worked like a charm! You absolute Legend! :D

Don't suppose you have any suggestions on the related icon issue, i.e code to display the icon for an equipped weapon?

OML
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,058
Reaction score
1,483
First Language
EN
Primarily Uses
RMMZ
I think this'll get the associated icon's index (i.e. a number):
Code:
${$gameActors.actor(150).weapons()[0] ? Number($gameActors.actor(150).weapons()[0].iconIndex) : 0}
I'm not sure how the HUD Maker plugin handles drawing them, though. :kaoswt:
 

OneMoveLeft

Warper
Member
Joined
Apr 8, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
RMMV
I’m just about to travel so once I’ve landed and settled in, i’ll whack this into HUD Maker and update you.

But to be fair, it looks pretty legit to my untrained eye. Can’t wait to test. OML

Edit: Hi again. So I've finally tested the above code and it hasn't really worked out! HUD Maker provides a selection of elements to customise your HUD e.g Text, Text Picture, Gauge, etc. The text element, I have used to display the weapon name. When using the icon code in the text element, it displays the weapon icon number which means its pointing at the correct thing but as yet I've not managed to get a Icon showing even after plugging the code into all element types.

The TextEx element type provides a way to display a selected icon but from what I see, it is only accepting something like, '\i[313]', to display a specific predetermined icon. I may be wrong but I'm stuck there.

I've had a think and reckon that using a picture element to display an image of my weapon instead may work better and might also be more visually pleasing.

Thanks again for the time and help that you have afforded me. OML
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.
Why is there so much month left at the end of money? D=
Hello humans! How goes your day in this journey of living? I hope it is good, for I am human like you, and I am feeling great! Worship the altar.

Forum statistics

Threads
105,625
Messages
1,015,052
Members
137,285
Latest member
AndrewRobertson
Top