Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with common event (Resolved)

Cait

Member

I am using variables to create a payment system, like Final Fantasy VIII, and am having a little bit of trouble. Everything is going well, until it comes to a certain point... I don't know if the script is working or not, because it won't leave the (You got your paycheck) message. Here is the image, and maybe someone can tell me what I am doing wrong? Loop didn't work, as it only froze everything up... not that I thought it would, because it did exactly as I thought.

paymentsystem.png
 
well, the interesting thing first off that I see is that you are setting your step count to zero before you check to see how many steps there are. What I would suggest doing would be delete your footsteps = 0 command since with that there you'll never get paid. Also, it's freezing because you are not giving it a way to get out of the event. You have the jump to label on each conditional branch so your even repeats over and over and over and can't break out...I would suggest using an exit event processing command instead of a jump to label command. That way it'll only run once. If you want it to run more than once, you would have to have another conditional branch.

Hopefully this is clear enough. If it's not I can explain with pictures, but i think it's okay.

hope this helps!
~xgamexfreakx
 

Cait

Member

Okay, the whole point is that you walk around and as you do, every now and then, you get paid... automatically like in Final fantasy VIII. My biggest concern is that I want to use a ranking system, so it determines how much you get paid and the steps... to determine when you get paid. Would it be easier with a timer instead of using footsteps?
 
well, if you want to use steps, you can't set that back to zero using a change variable. I think what you would want to do would be to create a loop that checks the footsteps as they increase. You should use two common events. In the first you would want,
[rgss] 
conditions - tirgger = parallel and a switch, well say switch 008 since that's what you used.
 
set variable[0001] = steps
loop
set variable[002] = steps
set variable[003] = variable[002] (minus) variable[001]
if variable[003] >=100
 then
control switch[008] = off
control switch[009] = on
 else
nothing
end loop.
 
 
<span style="color:#996600;"
[/rgss]
then in the second common event you would have
[rgss] 
condtions - trigger = parallel, switch = [009]
 
#now you just do everything here just like you have in your current conditional branch except you don't need to do
#variables and you don't need to check for steps, so the first part will look like this.
 
Conditional branch: switch[002] = on
  then
you get paid!!!
control switches [008] = on
control switches [009] = off
exit event processing
  else
nothing
branch end
Conditional branch: switch [003] = on
  then
you get paid, blah blah blah
#just follow how it's done above and it should work
 
[/rgss]

now be aware that for your rank switches, you have to only have one on at a time, otherwise if you have both rank 0 and rank 1 switches on, then you'll only get paid for rank 0. If you have any other questions, let me know. **I didn't test this so if it doesn't work, let me know and i'll figure out what's wrong. This is only a rough sketch, so you'll have to figure some things out yourself.**

hope this helps!
~xgamexfreakx
 

Cait

Member

OKay, a quick question is how to start the event... Every time, I go to turn on Switch 8 and give a rank it freezes right after the character (test) speaks... and that's when the switch 8 is turned on. I used a switch to see if anything else was happening, and yeah, it continues to do what it's told, I just can't move after that.
 
did you intend to loop the setting of the variable 0001 to 0 everytime?

how about not putting an Exit Event Processing on the first Branch?

also, you may want to change the method of using 5 switches for each rank. turning them on per iteration
really may have something to do with the crashing.

i suggest using a Variable as a condition, which adds increments of 1 (increasing rank) everytime
you get the paycheck.

Every branch, increase the variable, for example, RANK[0001], by 1 using the Control Variable operands.
then the next branch will have a condition of +1 higher rank(variable)...

just a suggestion.
 
ok, so I changed the event a lot, and it works, with one bug in it...when you save the game, then reload it, the steps get set to whatever you are at when you load the game. So say that you save the game with 99 steps and you need 100, when you load the game, you are back to "0" steps, even though you have 99. So the trick is to walk 100 steps without saving and reloading the game. Is this okay or do you want me to fix that?

Edit: okay, so it turns out that you are going to want it fixed, unless you want the counter reseting after every battle as well...I'll post screenshots in a seconds since that is a lot easier to do than to type it all up.
 
ok, so there are three pictures, the first is the first common event, the second is the second common event, and the third is a list of three commands that you need to make sure that you set up when you start the system. This also includes the bug fix.

ok, so here is the first common event. I simplified it a touch.

Here is the second common event. It's also been simplified.

And last are the three commands that need to be set up. First, you need to set the steps when you start the system. If you start it at the beginning of the game, then put it in your first event. The second is your rank. That just makes sure that you have a rank and it's not set to nil. (which would make it crash). and the last command starts the system. If you want it to start at the beginning, then put it in your first event.

If you have any other questions, ask away!

Hope this helps!
~xgamexfreakx
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top