Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Hi! I'm very new to rpg maker.

Essentially I want to work it so that the character loses HP when traveling over a certain area, like a hot desert. I know you can set regions but it looks like you can only utilize the regions when setting an enemy encounter. When I click Change HP under 'Actor' I don't see a way to set it to a region. Would I have to copy this event to every single tile in the area?

Thank you in advance!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,230
First Language
English
Primarily Uses
RMMV
As long as you are not USING regions for your random encounters (or you don't want random encounters on the same tiles where you want the player to lose HP), you can use regions.

Draw with a region id over the appropriate area. Then add an event to your map that is set to Parallel Process and has the following commands:
Code:
Wait 60 Frames
If: Script: $game_player.region_id == 15
  Change HP (Entire Party) - 1
End

The above assumes you will use region id 15, and will remove 1 HP for every second (60 frames) the party is standing on an affected tile.

If you DO have random encounters and you're wanting this to happen in the same areas, it gets a bit more tricky.
 

Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
As long as you are not USING regions for your random encounters (or you don't want random encounters on the same tiles where you want the player to lose HP), you can use regions.

Draw with a region id over the appropriate area. Then add an event to your map that is set to Parallel Process and has the following commands:
Code:
Wait 60 Frames
If: Script: $game_player.region_id == 15
  Change HP (Entire Party) - 1
End

The above assumes you will use region id 15, and will remove 1 HP for every second (60 frames) the party is standing on an affected tile.

If you DO have random encounters and you're wanting this to happen in the same areas, it gets a bit more tricky.
Oh thank you!! Some of my early searching warned newbies from using parallel process unless absolutely necessary so I just ignored it, figures this would be the one necessary lol

I'm not sure I'm doing this right, I went to the event, and added it to a tile in the upper corner since the code is specifying the region I didn't think it needed to be on a specific tile?

This is what I have
tile hp code.png

And this is the error I'm getting?

tile hp error.png

I thought it meant to remove the : and put a $ in front of end and I did that but it's still not working?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,757
Reaction score
2,851
First Language
English
Primarily Uses
RMMZ
It's because you've put a colon after if. That isn't a thing in Ruby syntax, so it's telling you it didn't expect to find it. (ignore the $ on end, that's a kind of internal thing that you'll never actually have in your actual code).
 

Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
It's because you've put a colon after if. That isn't a thing in Ruby syntax, so it's telling you it didn't expect to find it. (ignore the $ on end, that's a kind of internal thing that you'll never actually have in your actual code).

Okay took out the colon (also changed if to lowercase) and removed the $, so now it doesn't crash as soon as it loads up BUT as soon as the character walks into the designated region I get this

tile hp error3.png
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,757
Reaction score
2,851
First Language
English
Primarily Uses
RMMZ
Okay took out the colon (also changed if to lowercase) and removed the $, so now it doesn't crash as soon as it loads up BUT as soon as the character walks into the designated region I get this

View attachment 193288
Wait. Just read your code closer. Did you actually write "Change HP (Eric)" in a script event command?

Edit: I see what's happened here. The code Shaz gave you was using pseudocode for event commands, and you thought it was pure Ruby code you had to type in as written. XD
 

Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Wait. Just read your code closer. Did you actually write "Change HP (Eric)" in a script event command?

Edit: I see what's happened here. The code Shaz gave you was using pseudocode for event commands, and you thought it was pure Ruby code you had to type in as written. XD
Yeah. I did. Because, as I said, I'm new at this and thought that's what I was being told to do. So if you're done laughing at me can you maybe help explain this to me or??
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,757
Reaction score
2,851
First Language
English
Primarily Uses
RMMZ
Yeah. I did. Because, as I said, I'm new at this and thought that's what I was being told to do. So if you're done laughing at me can you maybe help explain this to me or??
Sorry, that wasn't laughing or incredulity, I was just trying to establish whether I'd correctly noticed what happened. In other words, I was asking you a clarifying question to make sure I fully understood the situation before I responded based on faulty assumptions rather than what actually happened.

The "if" is the conditional branch event command. I think change HP is just called change HP.
 

Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Sorry, that wasn't laughing or incredulity, I was just trying to establish whether I'd correctly noticed what happened. In other words, I was asking you a clarifying question to make sure I fully understood the situation before I responded based on faulty assumptions rather than what actually happened.

The "if" is the conditional branch event command. I think change HP is just called change HP.
Well it definitely came off mean-spirited, as you asked the question and then edited to answer it yourself with no further info.

I did manage to find the conditional branch but I thought it was the wrong option cause it didn't start with the 'if' . I've got it set up now, I think and it looks like this

tile hp code2.png

It seems to be working now! Is it okay to leave the else blank? I dont want to cause any errors down the line. I wasn't sure if there was a more direct 'if' statement, I couldn't find one.

I'm assuming the wait is just so that the event doesn't happen instantly. Would taking it out mess with the conditional?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,757
Reaction score
2,851
First Language
English
Primarily Uses
RMMZ
The only reason I didn't include the answer in my edit was that I was doing it on my phone on my way to help my wife clean the games room so I was coming back to it in a bit but you responded before I could. :p

Yeah, you can leave the else blank. It's only needed if you need another set of things to happen if the condition is false.

The wait is separate from the conditional, but if you take it out the player will lose HP every frame rather than every second.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,230
First Language
English
Primarily Uses
RMMV
I see you have worked it out now. Yes, there was only one line that contained a script. I couldn't remember if it showed If or Conditional Branch - I know at some point it changed from one to the other.

If you don't like the empty Else being there (I personally don't so I remove them), just edit the Conditional Branch and uncheck the Else box.


The wait is there as a parallel process will execute on every frame. Using parallel processes that don't disable themselves and don't have a wait is something that can cause your game to lag, which is why you've read elsewhere to try avoiding them unless you need them. In this case, a parallel process is the best non-script way to do what you want - a heap of events on the map are definitely not the way - but having that wait means it's taking a break and letting other things have a go at the processor, so no lag. Plus removing HP at set intervals. You can change the number of frames, the region id, and the amount of HP that's removed each time.
 

Jace_E

Veteran
Veteran
Joined
Jun 24, 2021
Messages
38
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Ooh, that all makes sense! Thanks so much! I think I've got it all set now. It looks like this: I even figured out how to add an animation to show the damage!

tile hp code3.png

In my searching I found some full vx ace tutorials/walkthroughs so I'll definitely be looking at those too!

I think that's everything, unless there's anything else you see that I need to tweak or should keep in mind? I left the priority as was, same for speed and freq and all that.
 

Latest Threads

Latest Profile Posts

$Syringer.png
toying with a brand new monster design
Another doodle! Green-haired girl has no name yet, so, any suggestions?
She is about the same age as Nikki, and she is the last one of her clan, known for their innate skills in manipulating both ice and fire. She is a bit stubborn, as well as having a soft spot for kids.
Mystery messages from my AI assistant. :kaojoy:
1632842960834.png
Made some updates to a previous project I was working on. Trying to mimic the 16 bit Squaresoft aesthetic.

Forum statistics

Threads
115,436
Messages
1,089,901
Members
150,206
Latest member
V_1_
Top