- Joined
- Oct 30, 2015
- Messages
- 34
- Reaction score
- 2
- First Language
- Spanish
Hi!
So in my game I use conditional branches to check the percentage of HP, MP, etc and for example if the result is 50 the game will show a life bar only half full using a Show picture event. The thing is I have several HUD items (HP, MP, Exp, and a couple more) and it takes about 400-500 conditional branches to do it, so if I want to change the scale of the pictures, the position, or anything really I have to do it 400 times, which is very inefficient.
My idea to solve this was to use the script call $gameScreen.showPicture and then using for example "HPvariable6" as the file name, where variable 6 would store the percentage of HP, so if the variable is 62, the game would look for the picture HP62.png and show it.
Any ideas to use the variable for part of the filename?
Thank you for your attention!
Edit: I might have explained myself badly. What I need to know is a way to combine a variable and text into an identifier. In the case of using "HPvariable6" as the filename, the HP would be static, meaning that no mater what variable 6 contains, the filename will start with HP. So if the variable 6 is worth 32, the filename will be HP32, while if the variable 6 is worth 60, the filename will be HP60.
So in my game I use conditional branches to check the percentage of HP, MP, etc and for example if the result is 50 the game will show a life bar only half full using a Show picture event. The thing is I have several HUD items (HP, MP, Exp, and a couple more) and it takes about 400-500 conditional branches to do it, so if I want to change the scale of the pictures, the position, or anything really I have to do it 400 times, which is very inefficient.
My idea to solve this was to use the script call $gameScreen.showPicture and then using for example "HPvariable6" as the file name, where variable 6 would store the percentage of HP, so if the variable is 62, the game would look for the picture HP62.png and show it.
Any ideas to use the variable for part of the filename?
Thank you for your attention!
Edit: I might have explained myself badly. What I need to know is a way to combine a variable and text into an identifier. In the case of using "HPvariable6" as the filename, the HP would be static, meaning that no mater what variable 6 contains, the filename will start with HP. So if the variable 6 is worth 32, the filename will be HP32, while if the variable 6 is worth 60, the filename will be HP60.
Last edited by a moderator:
