- Joined
- Dec 29, 2018
- Messages
- 39
- Reaction score
- 5
- First Language
- English
- Primarily Uses
- RMMV
It might help if i give some context to what I'm trying to do. as @Bex is probably aware of due to an earlier post, I am basically trying to make a barista simulator, where the player makes coffees and people come in to order them, and form a line. Should the player take to long to get through the line, it will take away one of three total lives until the player loses.Good point, @BexThe code on page 1 of Event 3 seems to be flawed in that Complaint1 will never equal 3 (unless it already does when the page starts with switch Complaint OFF...or starts at a value of 2 if switch Complaint is ON...both seeming highly unlikely since there's code to handle Complaint1 = 1). Follow me here: The switch Complaint is either ON or OFF when this page runs. If it's OFF (Case 1), then Complaint1 has to equal 1 or 3, or else nothing on this page runs except the first script line. If Complaint1 = 1 (Case 1a), then you add 1 to it, making it Complaint1 = 2...but since this case began with the notion that Complaint is OFF...and because it doesn't get turned back ON anywhere...Complaint1 will be stuck at 2...which again means nothing will run but the first script line. If Complaint1 = 3 (Case 1b), then the self switch changes the page...but it seems unlikely you would have that be the case...because otherwise...why the preceding code? Now consider case 2, where Complaint is ON. Here you add 1 to Complaint1, then turn Complaint OFF. Complaint1 at this point needs to equal 1 or 3 or else we're back to the same problem as Case 1. If Complaint1 =1 (Case 2a), then you add 1, making it Complaint1 = 2...but now we end up like Case 1a anyway because the condition Complaint1 = 3 won't run, the switch is OFF, and Complaint1 is not 1 anymore. If, on the first pass, Complaint1 was equal to 3 (Case 2b), then we get the same result as Case 1b...and the same question.



this.setSelfVariableValue($gameMap.mapId(), 3, 1, 180)
this.setSelfVariableValue($gameMap.mapId(), A, B, C)
for (var a = 1; a <= 50; a++) {
if (!!$gameMap.event(a)) { // check that event exists
if (this.getSelfVariableValue($gameMap.mapId(), a, 1) > 0) {
this.setSelfVariableValue($gameMap.mapId(), a, 1, this.getSelfVariableValue($gameMap.mapId(), a, 1) - 1)
if (this.getSelfVariableValue($gameMap.mapId(), a, 1) == 120) {
$gameSelfSwitches.setValue([$gameMap._mapId, a, 'B'], true) }
if (this.getSelfVariableValue($gameMap.mapId(), a, 1) == 0) {
$gameSelfSwitches.setValue([$gameMap._mapId, a, 'C'], true)
} } } }
if ($gameVariables.value(1) === 0) {$gameSelfSwitches.setValue([$gameMap._mapId, 1, 'C'], true)} else {$gameVariables.setValue(1, $gameVariables.value(1) - 1);}
Yes I was aware, it's so that the player can go back to the customer and reference his order should he forget a detail.@deveras111 Were you aware that the trigger for page 2 is set to Action Button for the trigger while the other pages are all set to Parallel? Just asking. There may have been a reason for it, or it may have been an oversight.
EDIT: Okay. So, based on what you said you're trying to accomplish, @Andar is right...you need a plugin. Yanfly's Self Switches & Variables plugin will allow you to turn Complaint1 into a Self Variable for every event that spawns. Complaint1 would then handle the complaint count of the event. Now you can set up another Self Variable, maybe call it MaxComplaint, and set it to Random: Range: 1 to 2. Now you just compare Complaint1 to MaxComplaint after every new complaint comes in (Every time Complaint1 += 1 in the event), and if that event has reached its own MaxComplaint, set it to walk away. Otherwise, keep it waiting and preparing to either complain again or be served.
EDIT 2: Got my threads crossed.Andar said a plugin was required in another thread...still...this is how I think you want to handle things here for simplicity's sake.
Okay, so I've downloaded the plugin. You said I should use this scriptline to set a timer for a customer event, so would this script add 1 value to Variable1 every 3 seconds? How would this work in relation to the multiple complaints I want the customer event to make before reducing a life?Edit:
I like your Idea, would also like that you get it to work. Will create a Testroom and see what i can do.
Here the Link to Self Variable Plugin:
http://yanfly.moe/2016/08/06/yep-113-self-switches-variables-rpg-maker-mv/
If you name a Variable include: Self Var in the Name. For example: Self Var TimarA.
This is what i got so far:
I made 1 Parallel Event which contains a Script snippet, that can check and control the Timers for 1 to 999 Customer Slots. I used Yanflys Self Variables Plugin, and made Variable1 into a Self Variable.
If you want to Set a Timer for a customer Event, you need to use this Scriptline 1 Time when customer timer should start.
Code:this.setSelfVariableValue($gameMap.mapId(), 3, 1, 180)A = Event ID, B = The Self Variable of that Event, in our case Variable1Code:this.setSelfVariableValue($gameMap.mapId(), A, B, C)
C = The Timer Start Value itself, 60 = 1Second but if you put a wait 60 frames eventcommand after the code shown further below, 1 becomes 1 second.
I see how I'd be able to incorporate the complains in this, for example maybe have a show text command on a second event page under the condition for self switch B. This seems like exactly what I need!Here the Scriptsnippet of our paralell control Event, use this in Eventcommand Script which you find on 3rd Page of Eventcommands.
Timer of Event Ids 1 to 50 are checked and controlled.
If Timer reaches 120, Self Switch B of that Event is turned On, if it reaches 0 self switch C is turned On. 1 to 999 Customer Slots can be handled with this. You maybe just need 10 to 20 customer slots max. If you like this Idea, it could be Edited to your needs.Code:for (var a = 1; a <= 50; a++) { if (!!$gameMap.event(a)) { // check that event exists if (this.getSelfVariableValue($gameMap.mapId(), a, 1) > 0) { this.setSelfVariableValue($gameMap.mapId(), a, 1, this.getSelfVariableValue($gameMap.mapId(), a, 1) - 1) if (this.getSelfVariableValue($gameMap.mapId(), a, 1) == 120) { $gameSelfSwitches.setValue([$gameMap._mapId, a, 'B'], true) } if (this.getSelfVariableValue($gameMap.mapId(), a, 1) == 0) { $gameSelfSwitches.setValue([$gameMap._mapId, a, 'C'], true) } } } }
The plan is to have the customer wait to give there order. However, If they are waiting too long, they will complain and eventually leave without reaching the counter. Once they are at the counter, the original plan was to have a separate mechanism begin where they would give their order, and then if it took too long complain and eventually leave.I edited a possible Solution for your Timer which could safe some work in your other Thread.
One Question, do the Customers give there Order and than go into Line? Or are they waiting in Line to give there Order?
Just wondering if this is a 1 after 1 single customer gameplay. than the timers would not make much sense,
but if you can make different coffees and give them to different customers, that could be cooler but more work.
Depending on such details, the after all solution could be more or less different each time.
https://forums.rpgmakerweb.com/index.php?threads/galvs-event-spawn-timers-help.110084/#post-978215
Yes changing event pages would be a problem. Perhaps theres an easier solution in using wait times? I could have it so that the event page with the move routes contain wait times acting as timers, and at the end of every wait time there could be a complaint. This is dependent, however, on whether at the end of the move route once the customer gets to the counter, if I put a "self switch A on" command does it immediatly switch or will it finish the event page first before switching. I will try this and get back to you.- This is used as Parallel Event on the Side. Not in every Customer.
- Timer are not counting up, they are counting down, if they are set to a wait time.
- Activating self switch B and C for other Eventpages was a mistake of mine, because it interrupts the moveroute of that eventpage.
But if the complaint is just a Show Balloon Icon, than the code itself could be edited to do it automaticaly.
- The Customers long moveroute while being in waiting line, this keeps us from changing eventpages,because we would kill the moveroute. We need the triger be on action button , because we want to talk to that NPC. That means we need to exclude everything else into a controlling Event. Timers, Complaints and there Textboxes and so on...
At first i also thought we could do it with multiple eventpages and stuff, that just lead to all this confusion and Bugs and Errors after every second corner. Sorry.
Sorry for the confusing start, iam not a Scripter and just a casual User.
Edit: To make a Event Self Variable out of Variable 1 you need to include this into its variable name: Self Var
Will do!I hope the Timer helped in the End, if it doesnt help or if something is missing or if you dont understand something , let us know.
