[RMVX ACE] I WANT TO TRIGGER AN EVENT AFTER PLAYER TAKE A CERTAIN NUMBER OF STEPS. HOW DO I DO THAT?
Posts
Pages:
1
I just had a monster teleport the party to a 3x3 piece of land in the middle of a huge hole in the ground on the world map with no way to escape it.
I want the user to take a certain number of steps in order to trigger an event. When the player makes required number of steps on the 3x3 platform, it will trigger an event where the main character makes a statement where if he knew where his bird was, his bird could help him get off the platform.
I see that in "variable operation" there is "game data" where there is "Steps Taken". However, it WILL NOT let me add a constant to how many to add each time the user takes a step. There is NOT even an option to initialize the variable to 0. Therefore, I am unable to create an event that triggers when the user takes x amount of steps.
Whoever's idea was it to disallow assigning a value to a variable has a few screws loose. I may not be a programmer but my programming knowledge is not zero. I know in programming that you need to define or initialize your variables. But RPG Maker disallows this for "Steps Taken" for whatever reason. so I cannot tell it to trigger an even when the user takes 300 or whatever steps since arriving on the platform.
Since obviously you cannot initialize a variable for "steps taken", I am wondering, is there any way I can make the event occur once the user takes the required amount of steps?
I want the user to take a certain number of steps in order to trigger an event. When the player makes required number of steps on the 3x3 platform, it will trigger an event where the main character makes a statement where if he knew where his bird was, his bird could help him get off the platform.
I see that in "variable operation" there is "game data" where there is "Steps Taken". However, it WILL NOT let me add a constant to how many to add each time the user takes a step. There is NOT even an option to initialize the variable to 0. Therefore, I am unable to create an event that triggers when the user takes x amount of steps.
Whoever's idea was it to disallow assigning a value to a variable has a few screws loose. I may not be a programmer but my programming knowledge is not zero. I know in programming that you need to define or initialize your variables. But RPG Maker disallows this for "Steps Taken" for whatever reason. so I cannot tell it to trigger an even when the user takes 300 or whatever steps since arriving on the platform.
Since obviously you cannot initialize a variable for "steps taken", I am wondering, is there any way I can make the event occur once the user takes the required amount of steps?
Make two variables.
Assign variable A to steps taken.
Assign variable B to steps taken as well.
Add the number of steps you want the player to take to variable B.
Set a parallel process event to check if variable A is equal to variable B. If yes, execute code. If no, set variable A to steps taken.
This should constant update the first variable to the current steps taken, and constantly check if it's equal to the second variable, which is how many total steps you'll need to have taken to trigger the event.
Assign variable A to steps taken.
Assign variable B to steps taken as well.
Add the number of steps you want the player to take to variable B.
Set a parallel process event to check if variable A is equal to variable B. If yes, execute code. If no, set variable A to steps taken.
This should constant update the first variable to the current steps taken, and constantly check if it's equal to the second variable, which is how many total steps you'll need to have taken to trigger the event.
There is NO way to add a number to "Steps Taken". The option to assign any kind of value to "Steps Taken" is nonexistent. Even if I select "add" and assign it to "steps taken", the option to put any value in is STILL grayed out.
Your answer is incorrect
Your answer is incorrect
You misunderstood.
Assign a variable to "Steps taken"
Then add the number to that variable.
The total is the number of steps you have currently taken plus the number of steps you want the player to take before triggering the event.
Trust me, I've used VX for 15 years and I did this exact code to run a repel item in bloodstained Hands. The answer is correct. Try it out.
EDIT: When I get home I'll write out the actual code and show you what I mean.
Assign a variable to "Steps taken"
Then add the number to that variable.
The total is the number of steps you have currently taken plus the number of steps you want the player to take before triggering the event.
Trust me, I've used VX for 15 years and I did this exact code to run a repel item in bloodstained Hands. The answer is correct. Try it out.
EDIT: When I get home I'll write out the actual code and show you what I mean.

Create a common event set to parallel process and whatever switch you set it to, make sure it's on.
Variable step counter: Operation = Set. Operand > Game Data > Other > Steps.
Also, some advice. You should have a player tracker in every game you make, and since this common event is doing part of that, it may as well do the rest.
Create a Player X variable. Operation = Set. Operand > Game Data > Character = Map X
Create a Player Y variable. Operation = Set. Operand > Game Data > Character = Map Y
Leave this common event on forever. It will be your most valuable resource, and even if you never use it again, it takes up almost no space so it hurts nothing and can only help you if you ever need it again.
For your event where you need to trigger something. On-screen event. Trigger it however you want. Once it's triggered:
Triggered page (this page should be off until a switch turns it on):
Autorun
Set Step Counter to 0
Turn on another switch. Switch MoltresRider's Thing = ON. This should turn you to the next page.
Set the next page to parallel process.
Conditional Branch.
If Step Counter == X
@Do stuff
@If you're done, turn off the event. Switch to a new page, or turn off the switches for both active pages.
@If you want to do it again, only turn off the MoltresRider's Thing switch and the game will just do it again.
>else
@Don't do stuff
You cannot add any number to that variable. RPG Maker VX does not allow it. The option to add anything is grayed out if you select "Steps Taken"
You can ONLY use "constant" on its own. It becomes grayed out if you select anything else, including "Steps Taken"
You can ONLY use "constant" on its own. It becomes grayed out if you select anything else, including "Steps Taken"
O_O
Am I missing something, or is this not getting through? Give me an hour and I'll show you exactly what you need to do.
You're not assigning a number to steps taken. You're assigning steps taken to a variable, then adding to that VARIABLE. Does that make more sense?
Am I missing something, or is this not getting through? Give me an hour and I'll show you exactly what you need to do.
You're not assigning a number to steps taken. You're assigning steps taken to a variable, then adding to that VARIABLE. Does that make more sense?
author=pianotmCreate a common event set to parallel process and whatever switch you set it to, make sure it's on.
Variable step counter: Operation = Set. Operand > Game Data > Other > Steps.
Also, some advice. You should have a player tracker in every game you make, and since this common event is doing part of that, it may as well do the rest.
Create a Player X variable. Operation = Set. Operand > Game Data > Character = Map X
Create a Player Y variable. Operation = Set. Operand > Game Data > Character = Map Y
Leave this common event on forever. It will be your most valuable resource, and even if you never use it again, it takes up almost no space so it hurts nothing and can only help you if you ever need it again.
For your event where you need to trigger something. On-screen event. Trigger it however you want. Once it's triggered:
Triggered page (this page should be off until a switch turns it on):
Autorun
Set Step Counter to 0
Turn on another switch. Switch MoltresRider's Thing = ON. This should turn you to the next page.
Set the next page to parallel process.
Conditional Branch.
If Step Counter == X
@Do stuff
@If you're done, turn off the event. Switch to a new page, or turn off the switches for both active pages.
@If you want to do it again, only turn off the MoltresRider's Thing switch and the game will just do it again.
>else
@Don't do stuff
You are obviously trolling me. The fact that you did not even show a screenshot of adding X to the second variable. You just showed the "set" page.
You CANNOT add ANYTHING to second one dumbass. The option to is grayed out EVEN under "add" no place to add 300 or any other number.

You know, if you took the time to actually read what we're writing (keep in mind you're talking to veterans of the platforms here), you'd see what we're talking about. But instead, you're dismissing what we're saying, not even TRYING to read it from an alternate perspective, and insulting members of the community who are genuinely trying to help. You know what, never mind. Showing you the code to solve this isn't worth the trouble. Figure it out yourself.
They're not literally altering the game's internal step counter. They're using variables that interact with the step counter to try to do the thing you asked to get help for.
Though if this is how you treat people who are trying to help you, you may find people aren't very willing.
Though if this is how you treat people who are trying to help you, you may find people aren't very willing.
author=pianotm
OH, nevermind. Screw you, then.
I did not mean to direct that at you. I meant to reply to the other guy's post but you ninja'd right in. This other guy just keeps telling me to add a value to the second variable when you cannot. He is arguing with me even though my screenshot clearly shows "constant" as grayed out when steps taken is selected as a variable. So you cannot add any number to the second one.
And Unity, I deal with people all day who say that they are trying to help me when most don't in my line of work. It has made it extremely difficult for me to know who is actually helping and who is not
so I apologize.
You apologized, which is more than most people do, so I'll help you, but please try to be more courteous to members of the community. It goes a long way to simply ask, "can you explain this a bit differently" as opposed to simply saying "you're wrong" or "you're trolling." Dismissing someone who's trying to help won't get you very far and won't help you make any friends in the community. Having said that, I understand the cynicism behind not trusting whether or not someone is genuinely trying to help, so I won't judge your response too harshly this time, but also understand that usually if someone has been with the community for a long time, they didn't get that way by disrespecting and trolling others who are just asking for help.
Regardless, this is a more visual example of what I was explaining in the first response. This was done in VX, not VX Ace, but the fundamental solution is the same and can also be done in Ace.
Step 1: Assign a variable to the current steps.
Step 2: Assign a second variable to the current steps.
Step 3: Add a value to the second variable equal to how many steps you want the player to take before the event is triggered. In this example, I used 150 steps.
Step 4: Compare these two variables in a conditional branch. If variable A is equal to or greater than variable B, execute code. This example just uses equal to, not greater than, but it should work the same.
Step 5: Execute the code you want when the steps are hit. If steps are NOT hit, make sure you set the first variable to the step count again. Set this event as a parallel process so it runs at all times on the map you're looking for.
NOTE: It's just the conditional branch that you want running in a parallel process. The first three steps should only be run once in a separate event, or on a separate page, otherwise it will just keep resetting the step counter.
Step 6 (Optional but helpful): Do what Pianotm was suggesting, and have a parallel process common event that assigns things like steps, map x, map y, etc to variables so that you can track this information all the time, and reference it anywhere and anytime you need, rather than running this code in a new event every time you need it.
Regardless, this is a more visual example of what I was explaining in the first response. This was done in VX, not VX Ace, but the fundamental solution is the same and can also be done in Ace.
Step 1: Assign a variable to the current steps.

Step 2: Assign a second variable to the current steps.

Step 3: Add a value to the second variable equal to how many steps you want the player to take before the event is triggered. In this example, I used 150 steps.

Step 4: Compare these two variables in a conditional branch. If variable A is equal to or greater than variable B, execute code. This example just uses equal to, not greater than, but it should work the same.

Step 5: Execute the code you want when the steps are hit. If steps are NOT hit, make sure you set the first variable to the step count again. Set this event as a parallel process so it runs at all times on the map you're looking for.
NOTE: It's just the conditional branch that you want running in a parallel process. The first three steps should only be run once in a separate event, or on a separate page, otherwise it will just keep resetting the step counter.

Step 6 (Optional but helpful): Do what Pianotm was suggesting, and have a parallel process common event that assigns things like steps, map x, map y, etc to variables so that you can track this information all the time, and reference it anywhere and anytime you need, rather than running this code in a new event every time you need it.
@MoltresRider: Anything under Operand will change whatever is under Variable which is what's being declared and actually changed. You keep confusing Steps Taken as a variable when really it is a value that cannot be changed. Instead you declare a variable (a value that can be changed) and store Steps Taken into that variable and do whatever is nesscary with that number afterwards. Which is what 3 people are trying to get across to you and is a crucial thing to understand before you can do anything with variables.
I have a question,
if both variables are dealing with "steps taken", what is preventing the second variable from increasing with the first?
To me, it seems that the second would always be 150 above the first
if both variables are dealing with "steps taken", what is preventing the second variable from increasing with the first?
To me, it seems that the second would always be 150 above the first
author=MoltresRider
I have a question,
if both variables are dealing with "steps taken", what is preventing the second variable from increasing with the first?
To me, it seems that the second would always be 150 above the first
Yeah, you'd need to seperate them to have it work. Tho Strak did say "NOTE: It's just the conditional branch that you want running in a parallel process. The first three steps should only be run once in a separate event, or on a separate page, otherwise it will just keep resetting the step counter."
To simplify, I think you'd want this part to run only once when the player is trapped in the grid. Maybe put it with whatever event teleports them there?

Then you'd have a parallel process check to see when the player reaches the number of steps you want in a seperate event.

And if it's just a 3x3 grid, you'd probably want less than 150 steps so the player isn't walking around forever, so alter as needed to fit your scenario :D
Hopefully that should work; it seems logically sound. I imagine you could also just have a touch event on every square of the grid that increases a variable and have a parallel process check for when that variable reaches the number you want to get the same effect, which is how I would have tried to do it, but Strak's method seems more elegant and wouldn't clog up the grid with a bunch of events.
Pages:
1

















