MV Condition Section of Some Random Dude Hud Maker

My actor has 2 weapons, a knife and a gun. This HUD only appears if the actor equpped the gun.
While browsing this forum, I found a javascript code to put on the Condition section but it didn't work.

from caethyril
Here's the javascript code that I found:
$gameParty.members()[0].hasWeapon($dataWeapons[2]);

1688383829079.png
i am not sure where the issue is,
but the script is related to gameparty member 0 , which is always the leader..
you could also relate it to the actor id itself..
- that would be :
JavaScript:
$gameActors.actor(1)
("1" is the actor id from your database)
Or you could try "Game_Party.prototype.leader" which would be:
JavaScript:
$gameParty.leader()
but that will return the same as "$gameParty.members()[0]"
..
and dataweapons 2 means the weapon which has the id 2 in your data base..
(incase thats not the weapon you want to use in that condition, you might need to change the number)

also you can find a list of what i used in the hudmaker, in my signature spoiler..
(ill edit it into this post aswell)

Spoiler: hudmaker scripts
Actor current HP:
Code:
$gameActors.actor(1).hp

Actor Max HP:
Code:
$gameActors.actor(1).mhp

Actor current MP:
Code:
$gameActors.actor(1).mp

Actor Max MP:
Code:
$gameActors.actor(1).mmp

Actor current TP:
Code:
$gameActors.actor (1).tp

Actor current LV:
Code:
$gameActors.actor(1).level

Actor Name:
Code:
$gameActors.actor(1).name()

Actor Total current EXP:
Code:
$gameActors.actor(1).currentExp()

Actor current LV EXP:
Code:
Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Actor Max EXP of current LV:
Code:
Math.abs($gameActors.actor(1).nextRequiredExp()) + Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Actor EXP to Next LV (=> Actor Max EXP of current LV - Actor current LV EXP):
Code:
Math.abs($gameActors.actor(1).nextRequiredExp()) + Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp()) - Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Needed in Text HUD in order to use script code where X is:
Code:
${X}

Script code to put in "Condition" :
For switches:

Code:
 $gameSwitches.value(x) == true
For variables:
Code:
 $gameVariables.value(x) == n


Script code for Variable (this one is Variable "50" )
Code:
$gameVariables.value(50)

edit.

reminder your script doesnt ask for the weapon type, which would also be possible with a different script, it is asking for the weapon id
i am not sure where the issue is,
but the script is related to gameparty member 0 , which is always the leader..
you could also relate it to the actor id itself..
- that would be :
JavaScript:
$gameActors.actor(1)
("1" is the actor id from your database)
Or you could try "Game_Party.prototype.leader" which would be:
JavaScript:
$gameParty.leader()
but that will return the same as "$gameParty.members()[0]"
..
and dataweapons 2 means the weapon which has the id 2 in your data base..
(incase thats not the weapon you want to use in that condition, you might need to change the number)

also you can find a list of what i used in the hudmaker, in my signature spoiler..
(ill edit it into this post aswell)

Spoiler: hudmaker scripts
Actor current HP:
Code:
$gameActors.actor(1).hp

Actor Max HP:
Code:
$gameActors.actor(1).mhp

Actor current MP:
Code:
$gameActors.actor(1).mp

Actor Max MP:
Code:
$gameActors.actor(1).mmp

Actor current TP:
Code:
$gameActors.actor (1).tp

Actor current LV:
Code:
$gameActors.actor(1).level

Actor Name:
Code:
$gameActors.actor(1).name()

Actor Total current EXP:
Code:
$gameActors.actor(1).currentExp()

Actor current LV EXP:
Code:
Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Actor Max EXP of current LV:
Code:
Math.abs($gameActors.actor(1).nextRequiredExp()) + Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Actor EXP to Next LV (=> Actor Max EXP of current LV - Actor current LV EXP):
Code:
Math.abs($gameActors.actor(1).nextRequiredExp()) + Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp()) - Math.abs($gameActors.actor(1).expForLevel($gameActors.actor(1).level) - $gameActors.actor(1).currentExp())

Needed in Text HUD in order to use script code where X is:
Code:
${X}

Script code to put in "Condition" :
For switches:

Code:
 $gameSwitches.value(x) == true
For variables:
Code:
 $gameVariables.value(x) == n


Script code for Variable (this one is Variable "50" )
Code:
$gameVariables.value(50)

edit.
reminder your script doesnt ask for the weapon type, which would also be possible with a different script, it is asking for the weapon id
Thank you for these scripts that you provided. To clarify, you want to make the HUD, specifically the ammo count, only visible when the actor equips the gun. This can be achieved through the "condition" section of the HUD Maker. I tried using the script I mentioned on my post but the problem is the condition section reads the scripts as "if the actor has equipped the gun, the HUD(Ammo count) won't show."

Original thread: https://forums.rpgmakerweb.com/threads/condition-section-of-some-random-dude-hud-maker.158910/