SumRndmDde Hud Maker Javascript Evals

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
so I'm currently using SumRndmDde's hud maker in battle and was wondering a couple of things...

1. is it possible to highlight/show which actor is active? I feel I'm really close to figuring that one out.. but I don't know the Javascript Eval that would let my pictures act as a condition to turn on and off when it's time for the right person to act.

2. is there any way to get state icons to appear in the hud? I've looked everywhere and no one seems to know...

I feel both of these "could" be possible when I think about Moghunter's huds. they do both of these things (I'd use it instead, but I haven't been able to figure out a sizing issue with his default pics, as I've been using my own)... would I need a new plugin for either of these or would some script calls work? any help would be greatly appreciated! have a great day guys and gals.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
1. What do you mean by active? Do you mean selecting commands or executing their move?

2. This is probably manageable by using the Image EX overlay. This appears to use a javascript eval to look for an images name. So, you would need to save an image of the states icon to SRD's image folder - give it the same name as the state does in game. You could then use

Code:
$gameActors.actor(x).states()[y].name
by replacing x with the actor Id and y with a number (eg 0 to refer to the first state the actor has applied, or 1 for the second and so on) it will return the name of the state which the plugin manager will then look for in the image folder. You may need quite a few of these to cover all possible states.

The other alternative, which may work better if you're using states with no icons, is to have a grid/column/row of images set up using the normal Image overlay, one for each state that has an icon and have the display condition be

Code:
$gameActors.actor(x).isStateAffected(y)
Where y is the id of the state that image is handling.

The reference to $gameActors.actor(x) in both the above will likely need to be changed based on your answer to question one to ensure the HUD is showing consistent information.
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
1. What do you mean by active? Do you mean selecting commands or executing their move?

2. This is probably manageable by using the Image EX overlay. This appears to use a javascript eval to look for an images name. So, you would need to save an image of the states icon to SRD's image folder - give it the same name as the state does in game. You could then use

Code:
$gameActors.actor(x).states()[y].name
by replacing x with the actor Id and y with a number (eg 0 to refer to the first state the actor has applied, or 1 for the second and so on) it will return the name of the state which the plugin manager will then look for in the image folder. You may need quite a few of these to cover all possible states.

The other alternative, which may work better if you're using states with no icons, is to have a grid/column/row of images set up using the normal Image overlay, one for each state that has an icon and have the display condition be

Code:
$gameActors.actor(x).isStateAffected(y)
Where y is the id of the state that image is handling.

The reference to $gameActors.actor(x) in both the above will likely need to be changed based on your answer to question one to ensure the HUD is showing consistent information.
thanks for the reply! sorry I wasn't more clear, I meant the actor that's selecting commands.

as for 2, I'll test it out as soon as I get home later. what you've said definitely makes sense tho, so yeah thanks a TON for the info
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
In that case you should be able to replace $gameActors.actor(x) with BattleManager.actor() and it will refer to the actor that's inputting commands. eg

Code:
BattleManager.actor().actorId()
//You can use this for your face overlay

BattleManager.actor().states()[y].name
BattleManager.actor().isStateAffected(y)
//One of these for handling your state icon images
It may be worth considering using a condition with these as well though as without it SRD HUDMaker will blit a bunch of messages (I mean 100's) onto the console at battle start and any other time BattleManager doesn't have an active actor. The obvious solution is

Code:
BattleManager.actor()
This will be true so long as there is an actor selected for command inputting but means that your HUD will disappear when you've stopped inputting which may not be desirable.
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
In that case you should be able to replace $gameActors.actor(x) with BattleManager.actor() and it will refer to the actor that's inputting commands. eg

Code:
BattleManager.actor().actorId()
//You can use this for your face overlay

BattleManager.actor().states()[y].name
BattleManager.actor().isStateAffected(y)
//One of these for handling your state icon images
It may be worth considering using a condition with these as well though as without it SRD HUDMaker will blit a bunch of messages (I mean 100's) onto the console at battle start and any other time BattleManager doesn't have an active actor. The obvious solution is

Code:
BattleManager.actor()
This will be true so long as there is an actor selected for command inputting but means that your HUD will disappear when you've stopped inputting which may not be desirable.
ahh OK then, thanks! by condition you mean a reason for whatever NOT to appear right? I was trying to get that to work yesterday to no avail. at least for having the active battler pic not show. tho I wasn't using the right Eval either I see now. one last question, do I need to use the image ex for both of these setups? I can't remember the difference between the two image parts other than how you add them.

EDIT: Ok, the code for the faces works... but it changes everyone's face to the active actor that's selecting at that time. unless I was supposed to put the eval on something other than the actual face? I had a pic that would change the color behind the active actor's face if it was there turn. but I'm not seeing where to put BattleManager.actor().actorId() if that's not supposed to be the actual condition... and secondly, the first code you gave me for states, I'm pretty confused on what info I'm supposed to plug in where?

BattleManager.actor().states()[y].name... y is the state number right? is anything else suppposed to go because if i just put a number, it'd say undefined. and with a name where name is, it'd cause an error... tho I have a feeling that's not supposed to go there. the second code works... but only once for some odd reason. then I get this error, TypeError: Cannot read property 'isStateAffected' of null...
 
Last edited:

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
The condition section means that if the statement is true the HUD element will show, if it's false it won't show. For instance if you were to put 1+1 === 2 into that box the image would always show but if you put 1+1 === 3 it would never show.

No, if you want to use the first method you need to use a js eval so it requires the Picture EX overlay. The second method will just use Picture because each overlay box will only show one state, whereas the previous example will have each box be capable of showing any state.

I think I may have misunderstood you're original question. I thought you wanted to change the image to the active players face. Could you perhaps provide a screen shot of what you're trying to display?

With regards to the state methods:

Code:
BattleManager.actor().states()[y].name
You will have separate HUD picture EX overlays up to the number of states you want to show. The letter "y" refers to the states position in the actors state array. For instance an actor has states - sleep, paralyse and confusion.

Code:
BattleManager.actor().states()[0].name
//this will return 'sleep'

BattleManager.actor().states()[1].name
//this will return 'paralyse'

BattleManager.actor().states()[2].name
//this will return 'confusion'
Picture EX will look for these file names in img\SumRndmDde\hud\pictures and shows them in the overlay. So if you want the HUD to display the first 3 states an actor has you need to include 3 HUD elements, one for each of the above codes. If you want the HUD to show 20 states you need to make 20 HUD elements and in each one replace y with the numbers 0 - 19. It may be worth changing the condition on these ones to

Code:
BattleManager.actor().states()[y]
This will only return true if the actor has that number of states or more, which should prevent issues where the actor has a low number of states applied.

I suspect the reason you're getting the error with the second code is because the BattleManager has no active actor, hence BattleManager.actor() is null, null can't have any states because null is not a battler. By using the condition

Code:
BattleManager.actor()
then it won't try to check for states because null is false.
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
sorry again if I haven't been clear on the first part ... here's a screen shot of what I'm essentially trying to do here.

display.PNG

the active actor will have a green circle essentially while the others will be gray. just sort of a way to let you know who's turn it is and whatnot.

as for the states, I wanted to line them up under the actor's face like the red highlight I have in this picture here. I changed the named of one to the eval and then when I tried BattleManager.actor().states()[y], it caused an error. tho with BattleManager.actor(), there was no error, but the status would only show if the actor was selecting a command, regardless of if they were inflicted any longer. sorry if there's something i'm just not doing right on my end... I'm still kinda learning a lot of when comes to how evals work so to speak. thanks
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
Ok. I've misunderstood, that's my bad.

To give you a little bit of background into the functions I'm using:

Code:
BattleManager.actor()
//this returns a reference to the actor who is currently inputting commands

$gameParty.members()
//this returns an array containing all actors in the party
//if you're in battle it will only be the actors in battle

$gameParty.members()[0]
//this refers to the first member of the party
//changing the 0 to a 1 will refer to the second member and so on
So, with that for your highlight rings you just need to use Picture, the condition will be

Code:
BattleManager.actor() === $gameParty.members[0]
//this will be for the first actors circle
BattleManager.actor() === $gameParty.members[1]
//this will be for the second actors circle
This is checking if the specified actor is inputting commands, and if they are will return true and show the highlight circle.

For your states instead of referencing BattleManager.actor() we need to again reference $gameParty.members(). So the old scripts would become:

Code:
$gameParty.members()[0].states()[0].name
// .states() returns an array of the actors current states
// [0] references the first state in that array
// .name will return that states name, which we need to search for the Picture EX

$gameParty.members()[0].states()[1].name
// this does the same as above but checks the second state that's affecting the actor
You will keep adding to the final [] section to display as many states as you would like. Once you've finished that you will create the overlay for the second actor by changing the first [] section, like so

Code:
$gameParty.members()[1].states()[0].name
//refers to the first state applied to the second actor

$gameParty.members()[1].states()[1].name
//refers to the second state applied to the second actor
As you can see, you will probably need a lot of HUD elements to do this. For each of these you will need to add a condition, which will be the same script just without the .name at the end. For example

Code:
//Eval:
$gameParty.members()[0].states()[0].name

//Condition:
$gameParty.members()[0].states()[0]
Hopefully this works now that we're trying to do the same thing. Sorry again for my misunderstanding.
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
I've tried the code for indicator picture, but unfortunately it's not working for any of the actors. I'm not sure why tho. the condition comes up red tho as if something is wrong I suppose. but I'm not sure what could be wrong with it... what you're saying sounds pretty spot on.


HMMM.PNG

I'll have to try the states later as I need to leave momentarily tho.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,047
Reaction score
1,477
First Language
EN
Primarily Uses
RMMZ
Code:
BattleManager.actor() === $gameParty.members[0]
//this will be for the first actors circle
BattleManager.actor() === $gameParty.members[1]
//this will be for the second actors circle
Typo alert! I think you just forgot the brackets here. :kaothx:
Code:
BattleManager.actor() === $gameParty.members()[0]
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
296
Reaction score
322
First Language
English
Primarily Uses
RMMV
I'll try it again as soon as I'm in front of my computer, thanks everyone
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV

Godlikemike

Warper
Member
Joined
Apr 27, 2020
Messages
2
Reaction score
1
First Language
De
Primarily Uses
RMMV
In that case you should be able to replace $gameActors.actor(x) with BattleManager.actor() and it will refer to the actor that's inputting commands. eg

Code:
BattleManager.actor().actorId()
//You can use this for your face overlay

BattleManager.actor().states()[y].name
BattleManager.actor().isStateAffected(y)
//One of these for handling your state icon images
It may be worth considering using a condition with these as well though as without it SRD HUDMaker will blit a bunch of messages (I mean 100's) onto the console at battle start and any other time BattleManager doesn't have an active actor. The obvious solution is

Code:
BattleManager.actor()
This will be true so long as there is an actor selected for command inputting but means that your HUD will disappear when you've stopped inputting which may not be desirable.
You're a genius. Thanks man :D:D:D:D:D:D:D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Happy Thanksgiving everyone! What are you thankful for? I'm thankful that I no longer have PTSD, and that I get to enjoy a good meal with my mom and stepdad! It might not be the same as before COVID, but at least I still get to enjoy the holiday!


Made another map, this one even has a cool moving waterfall. I'll have an animated GIF later whenever I'm done adding stuff. :LZSwink:
Back here again?! RPG MAKER, I can't quit you. :kaosigh:
um... why didn't anyone tell how easy it is to add motions to Sideview battlers? I literally copied the last one, changed the name and index, said where it should play, and boom... I've got intro motions.
Lately when I listen to 1970s songs, I always think that the "real world" is still at mid 70s. What we experience now is a futuristic dream. With this point of view, even 80s and 90s looks super futuristic. :D

Forum statistics

Threads
105,541
Messages
1,014,486
Members
137,220
Latest member
broiderers
Top