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
363
Reaction score
565
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
853
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,086
Reaction score
15,501
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,086
Reaction score
15,501
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 Profile Posts

I don't really have any neat updates today about how I screwed up programming... But if you want to observe the intensenes of me programming, then you can check out my stream :)
New Weapons.gif
No more spam from me today, I promise! Just wanted to upload this, people have been giving me feedback that my weapon sprites (which were RTP) clashed badly with my battlers for ages, so today I finally took the plunge and updated them! Really happy with how they came out :D :D
So Facebook fraudulently took money from me. They even went through my PayPal accounts to find a card that had the money on it. Thinking about deleting my Facebook account because this doesn't happen on twitter, not even close.
Today the 2nd part of the RPGMakergame "A Thief's voyage" came out.


Go show DutchPowerCreations some love.
love it when you forget to put a certain thing in the movement route and suddenly a character starts spinning at 10000 rpm

Forum statistics

Threads
116,992
Messages
1,103,664
Members
152,889
Latest member
LazyTitan
Top