I stayed inside the editor at least, right? No horizontal scrolling and I did use an event command lol.
Challenge of the events.
General DiscussionHere is my entry for Challenge 1: Status bars
So far I focused on 1 character, and I ignored states.
Here is how I did it:
First I showed the background, which is a single image, that covers the whole screen. So, we place it at coordinates 0, 0.
The second image is the player image. This can be more dynamic, when the player has the option to switch party leaders, but I choose to make it for a game where only 1 character is playable, so there was no need for that. (I plan to do this later, just like the states.)
The third command is the interesting one... The script call.
This call will do the following, line by line:
When you have 30%, the bar for HP is only 30% wide, and therefor 70% empty.
This is triggered with a parallel common event that loops 6 times per second. I also trigger it each time a player gets damage on the map (like when bitten by a bat outside of battle), to prevent the bar updating a fraction of a second later. The only reason I made it also parallel is to update it after healing in the main menu (by using a skill or a potion). Of course, I could also have the skill and the potion trigger this common event. Then I don't need a parallel trigger at all.
Here is a the code, so you can copy it over and re-use it if you like:
And here are the graphics I used from the pictures folder:
You can use everything in your project if you like. Just, replace the face image. 😛 If you want to use my interface, you can scale the face of your party leader to 50% and then crop it into a perfect circle. Place that in the exact center of a 144x144 image, and name it "Face.png". Now my system should work with your game.
Easy peasy right? And if you know how to do a bit of editing, you can make very pretty and cute interfaces surrounding your portait and status bars.
So far I focused on 1 character, and I ignored states.
Here is how I did it:
First I showed the background, which is a single image, that covers the whole screen. So, we place it at coordinates 0, 0.
The second image is the player image. This can be more dynamic, when the player has the option to switch party leaders, but I choose to make it for a game where only 1 character is playable, so there was no need for that. (I plan to do this later, just like the states.)
The third command is the interesting one... The script call.
This call will do the following, line by line:
- This looks for the actor ID of the party leader.
- This looks for the current HP in %
- This looks for the current MP in %
- This looks for the current TP (Since max is 100, it is always in %)
- This places the HP bar
- This places the MP bar
- This places the TP bar
When you have 30%, the bar for HP is only 30% wide, and therefor 70% empty.
This is triggered with a parallel common event that loops 6 times per second. I also trigger it each time a player gets damage on the map (like when bitten by a bat outside of battle), to prevent the bar updating a fraction of a second later. The only reason I made it also parallel is to update it after healing in the main menu (by using a skill or a potion). Of course, I could also have the skill and the potion trigger this common event. Then I don't need a parallel trigger at all.
Here is a the code, so you can copy it over and re-use it if you like:
JavaScript:
var ID = $gameParty.leader().actorId();
var HP = $gameActors.actor(ID).hp * 100 / $gameActors.actor(ID).mhp;
var MP = $gameActors.actor(ID).mp * 100 / $gameActors.actor(ID).mmp;
var TP = $gameActors.actor(ID).tp;
$gameScreen.showPicture(93, 'Bar_HP', 0, 480, 48, HP, 100, 255, 0);
$gameScreen.showPicture(94, 'Bar_MP', 0, 480, 64, MP, 100, 255, 0);
$gameScreen.showPicture(95, 'Bar_TP', 0, 480, 80, TP, 100, 255, 0);
And here are the graphics I used from the pictures folder:
You can use everything in your project if you like. Just, replace the face image. 😛 If you want to use my interface, you can scale the face of your party leader to 50% and then crop it into a perfect circle. Place that in the exact center of a 144x144 image, and name it "Face.png". Now my system should work with your game.
Easy peasy right? And if you know how to do a bit of editing, you can make very pretty and cute interfaces surrounding your portait and status bars.
@JohnDoeNews the background could be smaller, why a big file for that?
but it's small, something I do for simplicity (but still neat)
@bass2yang whaáááááát! that is neat and quite working.
1 issue though, your code only works in 1.6.x (not lower) unless > nwjs 0.48
is needed to read them, as "?.destroy" or anything with ?.length = CS6 which
isn't supported in 1.5.x so far I know, but it simplify the code ^^
a way I didn't thought of at all. not with icons like that included.
at least you completed all challenges in 1 😀
but it's small, something I do for simplicity (but still neat)
@bass2yang whaáááááát! that is neat and quite working.
1 issue though, your code only works in 1.6.x (not lower) unless > nwjs 0.48
is needed to read them, as "?.destroy" or anything with ?.length = CS6 which
isn't supported in 1.5.x so far I know, but it simplify the code ^^
a way I didn't thought of at all. not with icons like that included.
at least you completed all challenges in 1 😀
Lazyness. Now I didn't have to look up the coordinates and just make it 0, 0. 😛 I know, that is not an excuse. I will adjust that later. 😛
That looks amazing, but to be honest, I have no idea what the javascript does. Would you mind to explain?
Thanks! Made some changes for this time around and updated my post. Yeah the optional chaining (?.) is for a later nwjs. Usually, you would do if (variable && variable.property) so you don't run the second part. The optional chaining returns undefined if there isn't anything there.
Should be fine now. Appreciate it!
@JohnDoeNews I'll walk through it a bit. I updated my post to reflect this and the new stuff - should cover all the goals presented.
Updated Post - Status Bars
Thanks!
Nicely done - very neat too. (Sorry, double post. DELETE OR COMBINE... plz halp. haha.)
You too. Even though that is a higher level of javascript than I will understand any time soon. 😛
If you have a simple bar that can extend 'indefinitely' (such as a vertical gradient on a horizontal bar or just a white line), you could probably just use Width in Move Picture to 'shrink' the bar inside the border. That's extremely annoying (at least in MV) because you can't assign a variable to Width. A tricksy way of doing that is to instead push the bar off screen to emulate it shrinking, which only works if your bar border can fully hide it.
Typing all this out makes me want to try this now.
You can with a script call. That is what I did.
What stops you? 😛
True, I was more thinking without a script call.
I already ran into some issues, apparently Control Variables doesn't let you choose TP.
Yeah, without a script call, that is a tough one.
Hey all! I kinda hoped there would be more participants, like before, but that is okay. 2 entrees and one of them is even my own. 😛 So far, that is. The challenges will be open forever, so who knows what kind of entrees we get in the future.
But we won't wait for that, right? We go to the next challenge for Januari. I'll add it to the main post in a few days (on januari first) but I can let you guys know what the new challenge will be: A character selection screen. Details come soon, when the challenge is officially starting.
But we won't wait for that, right? We go to the next challenge for Januari. I'll add it to the main post in a few days (on januari first) but I can let you guys know what the new challenge will be: A character selection screen. Details come soon, when the challenge is officially starting.
pure eventing with pictures 😛 easy peasy, but low time.
but always welcome to learn more XD
but always welcome to learn more XD
Original thread: https://forums.rpgmakerweb.com/threads/challenge-of-the-events.173841/