Help - Search - Members - Calendar
Full Version: [Solved] Anyone can solve my dilemma?
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
Vexus
I'm making a random variable in an inn in which you get a room based on the random number between 1 to 5.

I also have a script with day/night system and I made it so you rent a room for till 8 am of the day afterwards (Which works) then when you exit the room the door locks itself automatically and you have to rent another room if you want to sleep in the inn.

Now the problem. I rent a room and go into the room, fast forward time to 8 am of the day after and when I exit the room the door gets locked alone. (So far it works) Then I go to rent another room the random variable chooses a random room which is available but for some reason it's working 50% of the times it's like the switches in the event just get totally skipped.

At first I thought it was maybe lag but there is only 1 parallel event in the room so I don't think it's lag. I also tried putting wait after every switch maybe this way they work well but nope still skips them sometimes. The way I know the event worked is that after you are given x room a switch goes on that makes the inn keeper go on event page 2 which is just random words then at 8 am it goes back to first page.

I'll upload a screenshot with my current event maybe you gets can figure it out why it's making this problem.

Clicky


The left part is the event which gets activated when I go near the reception and the right part is the parallel event. (It's page 1 and 2)

Thanks for the help maybe I can solve this problem.
Titanhex
I understand what you're doing, I just don't understand the way you're doing it.

Theoretically:
When you speak to the innkeeper, that's when the random 1 through 5 number should be generated. If you decide to take that room number, then you don't need a switch saying you have. 0 = No Room rented. 0 < means you rented room one through 5.

I don't know why you're doing it in a parallel process, but it looks like your parallel process has a condition that's the same as it's action.
(If Inn Time is ON is the triggering condition. The actions in that page turns Inn Time ON though. Seems redundant.)

The parallel process should check the time of day. If it's past check out time, it should only let you open that door if you're standing on the other side of the door (Example; Coord X = 12, Y = 9), which would essentially mean you're leaving the room. This keeps you from being locked inside, but still prevents you from re-entering that room.

If you have a room rented in that Inn, then the innkeeper should tell you you can't rent another room. The check is just if the room rented out is above 0.
You really don't need to make 5 switches.
Vexus
When inn time is on the parallel goes to page 2 which is the pic on the far right.

Never thought on making the random variable on the inn keeper I'll try that.

Still can't understand why after the first time I get a room sometimes the switches on/off get skipped.

Thanks for the help.

The random variable I made is the npc goes to check which room is available (There will always be one) and then tells you "Room 2 is available" and so room 2 gets unlocked while the other rooms remain locked.
Titanhex
I suggest trying it how I suggested in my edited post. (Edited it not long ago)

You should be able to cut down your switches to just one variable.]

I'll edit my post in a sec here to show you.

Here's how I'd do the innkeeper:



Rinse and repeat for each room number. Just paste the Conditonal Branch Room # == 1. You could even make it easier on yourself by putting the dialogue as "Room \v[1] is available for the night. It's 200 zen." Then you just copy and paste and not even have to change the dialogue.

As you can see, it checks if the room # rented is 0.

If it's not, he tells you what room # you have rented.

If it is 0, he finds you a room through a random number of 1 to 5.

If you take that room, he takes your gold. If you don't take it, the # is put back at 0.

The parallel process for check out would just be
@If Hour Variable == 8
@Variables: Room # = 0

And since the door event takes you out no matter what then all you gotta do is make it so doors only let you in when you have that room # rented. (I assume you've done this already anyways)
Vexus
Don't know if it means anything but the 5 rooms are separate from the actual room and you transfer into them.

Now I placed the random variable into the inn keeper event but now after the first time the random door doesn't open it's like the switches get just skipped.

Also the variable that checks the time is not exactly counting but working with the day/night script.
Titanhex
What I've suggested should work in my post before this. I don't see it being a problem unless you have something you didn't to mention to me that'd complicate it.

Here it is slightly improved to show you how it works:

Spoiler
Vexus
I'll try it out thanks for the help.
Titanhex
Cool. Good luck! I trust this does the job :3

Incase you were wondering the problem with your switches, it didn't look to me like they did anything. I didn't see them being used in your example besides Inn Time. That's why I suggested this revision.
Vexus
The inn 1 to 5 are the switches of the doors and the switch inn is the 2nd page of the inn keeper (This was how I could know the event worked as the inn keeper asks you if everything is ok).

[Edit]

I did it sort of like yours (Added the switches for the doors and inn keeper 2nd page) and now the problem is that after I fast forward time and exit room door closes and when I try to rent a room again the npc goes to check which room is available but nothing else happens the npc just stops there and if I try to trigger the event again same thing happens.

[Edit 2]

Nvm adding erase event in the parallel that makes variable back to 0 fixed it.

Thanks a lot.
Titanhex
Oh yeah good point. I forgot about the seconds. But good to hear you fixed it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.