NotFlamingo

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
Hello,


I'm trying to make custom hud that updates itself every frame or at least every second. I need it to show pictures and item counts. I need it to auto-hide on specific regions, also when player opens menu and when map event says to stop showing it.


I successfully created custom hud by following tutorial "Eventing Tutorial for Creating custom Text Windows" (exactly as written on Extras: part [4]) . However I have a big problem trying to hide hud on mentioned situations using only events. Question: can I do it by using a specific script or a script call from event? If You know how can I set it, please help me! :)  Thank YOU!


Basically all hud info is in one parallel common event with loop. It creates custom windows and updates it. If I create map event  (trigger: action button) that turns off hud parallel event condition switch, sometimes custom windows disposes immediately but mostly it ends somewhere between 3-11 seconds. Same problem happens if i create parallel map event to turn off condition switch when player is on specific region (conditional branch with script call $game_player.region_id == X).


Another big problem is when player goes to menu (hits ESC). Custom hud always stays on top, even when I choose "Game End" And "To Title".


Please help! I have no scripting knowledge, but maybe there is some way to stop common event immediately with existing script or specific script call?


Here is an example hud parallel event I made on clean project. It shows how many plungers player has. Yeah.. Well, it's not random, plungers are in my game. Please find attached hud common event picture. If You need any additional info or the example project, ask me anything You need!


Thank You all in advance!







hud_event.png
 

chalkdust

Resource Staff
Restaff
Joined
Mar 23, 2015
Messages
364
Reaction score
567
First Language
English
Primarily Uses
RMMV
To turn it off, try turning off the Switch (0016 SuperHud on/off). If it still needs to be cleared, follow that with the @win.contents.clear script command.


To make it below your menu, try changing @win.z to a lower value. z is the "depth" layering so you need to find a value lower than whatever the menu uses (but still higher than everything else). I forget the exact values used in Ace but a little tinkering will get you there.
 
Last edited by a moderator:

NotFlamingo

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
Thank You for such a fast answer, chalkdust!


Added @win.contents.clear as You said, but now game gets error when map event starts:


Script "Game _Interpreter" line 1411: NoMethodError occured.


undefined method 'contents' for nil:NilClass


Changing win.z to 0 helped a lot! Second problem solved, thank You!


Do You have any ideas about first problem? I have found in tutorial to use script call @win.dispose if @win, but it does same thing with or without. Window with custom hud disposes only after between 3-11 seconds, almost never immediately.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,201
Reaction score
854
First Language
Hungarian
Primarily Uses
RMVXA
Don't draw that info all the time, it lowers performance by a lot, especially because you even update a variable constantly as well.


You don't need to re-draw that info all the time, only when the data it shows is changed. 


More importantly, you certainly don't need to set that variable all the time, only when the player gets or loses that item.


And even more importantly, you never dispose these windows, therefore they will remain in the memory until the game is closed (regardless what that tutorial states, these windows you create during runtime with an event will never dispose automatically), in short, you create memory leaks in your game this way. Every single time the map is changed, a new window will be made on top of the old one, and after a few map changes, you will get tons of undisposed windows which will slow your game sooner than later.


This whole window creating during runtime is only applicable if you actually dispose these windows when they are not needed and/or when the scene is changed, otherwise they will break your game. This is not meant to be in parallel events, unless that event actually disposes the window(s) at some point. But because the parallel common event stops during scene changes, I am not sure if you can dispose it properly from there, and quite honestly, you shouldn't even bother doing it this way.


It seems that you want to display a simple variable on the map. There are multiple scripts out there doing this, most of them are even free to use. I recommend you to use those instead of this clunky stuff you are trying to do now. Those won't make memory leaks, and will only update the drawing when it's needed.
 

NotFlamingo

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
Thank You for the answer! Can You recommend a script to show multiple variables (item counts) with icons? I just tried script "CDR - Show variables", but i don't know how to update variable number every time item count is changed. Should I add "Control Variable" command (set to game data item X in inventory) after every "Change Items" command in every event?


One more question. How can I set that every other variable's position y would not be stable value, but instead +30 to the last showed variable's y position?
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,743
First Language
English
Primarily Uses
RMMV
I would not use a parallel process common event for that at all.  You're doing something you apparently only want to do once, and then you have a loop.  That's just not the way to use parallel events.  My suggestion would be to rethink the logic.
 

NotFlamingo

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
All right, I got it, thank You! I started to use script that displays variables on map. However, I don't get it how should I set to update variable number (it's item count) every time after it changes value.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,743
First Language
English
Primarily Uses
RMMV
I have a script called Linked Variables that might help you out - you can set a variable to be the number of a specific item you hold in inventory, and whenever you look at that variable, it will show the correct number without you doing anything to update it.


Search the RGSS3 Scripts forum for Linked Variables.
 

Latest Threads

Latest Posts

Latest Profile Posts

If only RM had the capability to show whether a project has been edited, or not... like 99% of all other editors out there. That don't cost, too, or release new versions with very few features just to get the extra money... ugh, just too many basic features missing even after, what, two decades?
Surgically removing people's faces and grafting them on to other people is kind of fun.

(editing character art busts for my game)
I think sleep is like a foreign language to me.
I really love it when major blocks preventing me from going all out in game design get shattered.

Like finally developing a fully functioning Technical Machine system where certain characters cannot learn certain moves.

You have no idea how much that helps me.

Forum statistics

Threads
118,819
Messages
1,118,952
Members
156,003
Latest member
arsenic333
Top