New account registration is temporarily disabled.

NEED A BIT OF HELP WITH SCRIPTING VARIABLES IN VX ACE

Posts

Pages: 1
I just got into ruby programming but I'm still not confident in exactly what I'm doing.

I'm creating a survival horror game where you get hit 3 times and you die. I have a variable for the char's damage (1 hit = 10dmg, once it reaches 30, it's game over).

Not wanting to deal with changing the layout of the menu, I disabled it. But I also set up a health system where you can pick up potions and use them to heal you.

My problem is this. I set up a script where pressing "A" would bring up the common event to show you your health and number of potions, and if you want to heal yourself. Instead of displaying Damage = \V (it's kinda lame displaying damage and a random number like 10...), I want to set it like this:

When char's DMG variable is:
0, display it as Health: Healthy.
10, display it as Health: Injured.
20, display it as Health: DANGER
and obviously, if it was 30 it'd already be game over.

I have a feeling it's pretty simple to do... but I'm exactly sure how to do it correctly. Any help or insight is appreciated.
LEECH
who am i and how did i get in here
2599
You are using defualt game variables right?
If so, then you would need to make an extra variable, then you use case statements to change it depending on your health variable.

(im using variable 25 as the HEALTH variable, and 26 as the text variable.)

case $game_variables[25]
when 0
  $game_variables[26] = "Healthy"
when 10
  $game_variables[26] = "Injured"
when 20
  $game_variables[26] = "DANGER"
else
  $game_variables[26] = "You are dead. >.>"
end

Then just display that variable in the message.

Tell me if it works. (Didnt test it lol)

Edit: was bored so i tested it. It seems to work.
Yes, I'm understanding this and seeing that it can work.

However... where in the script editor do I add this? Sorry, noob question. -_-
LEECH
who am i and how did i get in here
2599
Put it before you display your message that displays how much health you have.
I would put it as a script in the event editor, just before the message.
Awesome! This works perfect, it was a lot more simple than I thought.

Sorry if I'm asking for too much, but there's also another problem. With the press of button "A," a message that shows your health and (if you're damaged) prompts you if you want to heal. I think this is a nice feature to have when you're running away from ghosts and need to heal quickly without having to menu->items->use, which also takes a lot away from the atmosphere.

My problem is that I'm unsure of how to pause the ghosts events from moving around (they're set to approach the player), and what's even worse is that as you're being prompted to heal yourself, they can't hurt you so they just walk around you like retards...

There are two solutions to this, the simpler one being to pause the characters so you can safely heal yourself.
The second being to allow the events to touch you and apply their commands to hurt you (I imagine getting this to work would add to the scariness of having to run away with real-time healing, but would be much more difficult to implement).

Sorry for the long post, but thanks again Idida for the tremendous help!
Marrend
Guardian of the Description Thread
21806
Well, I think this can be done with an Common Event that has an auto-run trigger based on a switch. What pressing "A" would do is simply turn the switch on, with the Common Event having the switch turned off as the last event action. I'm not 100% on this, so try testing it!

Though, isn't the "A" button the run button by default? Or are we talking about pressing the "A" key? There is a difference, here!
My apologies, I meant the "A" key on the keyboard.

I was hopeful because I thought it would work, but unfortunately the monsters still walk around. I appreciate the effort though!
Marrend
Guardian of the Description Thread
21806
Damn! I thought auto-run events were higher priority, and caused the other event to pause. Though, the only possible work-around that I know of would be that the switch that is flicked when the "A" key is pressed causes all the events on the screen to stop moving. Like, put in a new page on each of the enemies where the movement pattern is stay still. Though, I think that might reset their positioning to where they originally stood? If so, that is totally not what you want to do!
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
Add a new event page for each enemy that's triggered by the switch and has no movement pattern. Then when the switch is on the enemies will stop moving until it turns off again.
Thank you for all the informative input. I have tried making a switch that would activate when the health window is displayed, switch monsters to a separate event which stops them in place.

However... the monsters stop without the health window even opening, and after the commands of the health window closing, the switch is supposed to turn off, making monsters move again... which they don't! I think somewhere in my commands, it's preventing it from reaching all the other commands.

I'll upload a picture of what I have so far, and from what I have for my commands. It's a bit messy... but I'll have it up as soon as I figure out how to upload pictures.
Update: Nevermind! Sorry for the inconvenience but it was my fault. It works perfect. The reason why it didn't work before was because I started moving the common events around to display the health correctly, totally neglecting that I moved the common event to open with key A.

I have one last issue though pertaining to this health system, and I ask that those of you who have helped me thus far bear with me.

I got a little ambitious so let me tell you how my health system works. When you get hit, the screen flashes red and the character screams. On the third hit, the character gives a dying scream, which then the game over screen comes on. I got this to work pretty well. I upped the challenge: another character with a different scream, and a different death scream. I got this to work too.

The issue lies in the "one second of invincibility" that I want to implement between hits, because as of now, damage is triggered by "event touch" and this literally means you can get hit 3 times almost instantly and die within a fraction of a second. That's not good.

I have tried creating a separate event page for the monster, where the first touch would switch on "invincibility" where the monster event switches to a second page and can't hurt you. On the second page, I set the monster event to wait 60 frames (on the command Event Move Route...) before it turns off the "invincibility" switch.

The monster doesn't wait 60 frames before the switch turns off, and if I check the option "wait for completion," the player waits as does the monster after he gets hit. I still get killed instantly. This is the main problem.

EDIT: the trigger for event page two is autorun. If this is incorrect, let me know.

When I believe I have something, I can get the monster to pause between the 1st and 2nd hit. But I have the problem of the 2nd to 3rd hit being instantaneous (since after the 2nd hit results in DANGER HP, it is triggered by a damage variable). I believe I'm not getting something here that should be working...
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
If you mean it's autorun for the second pages of the enemy events, no. If you do that it'll prevent any other events from running. Just make them "When key is pressed".

Rather than making a separate event page for the damage check, have enemy collision turn on a switch called "invincible". Make a parallel process common event that's triggered by this switch that waits for 1 second and then turns the switch off.

Then, in the code that handles damage, put it all inside a conditional branch that checks whether "invincible" is off. That way it'll only run when the common event isn't (which is to say that you'll only take damage when you're not invincible).

Let me know if you need any further help implementing this.
LEECH
who am i and how did i get in here
2599
Post some screenies of your events. I'll have a look.

Edit:
Ninjad.

But what Trihan said should work.
You guys are awesome. I stayed up too long trying to figure it out and I completely overlooked something that simple. You guys have my eternal gratitude!

When my short story here is complete, I will share it with you guys and personally give thanks in the credits.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
Looking forward to it!
LEECH
who am i and how did i get in here
2599
author=Trihan
Looking forward to it!
Pages: 1