Player cancelling out of an event.

Status
Not open for further replies.

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
So right now I have mining and fishing events and while I like how they've come along, I'm wondering if there's a way I can let the player cancel out of the event if they want to stop. This is what I have right now.

Code:
Player swings pickaxe
Loop
  Wait: 60 frames
  Player swings pickaxe
  Variable Chance = 1-3
  Conditional Branch: Chance == 3
    Break Loop
Repeat Above
Show Balloon Icon: Player, Exclamation
Play SE: 'Hammer'
Text: "You obtained x ore!"
Change Items: [Ore] + 1
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,770
First Language
German
Primarily Uses
RMMV
you need another condition inside the loop to break it, for example on button press or on inventory full or whatever.
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,229
Reaction score
3,591
First Language
English
Primarily Uses
RMMV
Basically what Andar said. There's an option inside the conditional branch command for input triggering (page 4 I believe).
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Yeah, that's what I originally tried, but I guess I'm just going about it wrong?

Code:
Player swings pickaxe
Loop
  Wait: 60 frames
  Player swings pickaxe
  Variable Chance = 1-3
  Conditional Branch: Chance == 3
    Show Balloon Icon: Player, Exclamation
    Play SE: 'Hammer'
    Text: "You obtained x ore!"
    Change Items: [Ore] + 1
    Break Loop
  Else:
    Conditional Branch: Cancel button is pressed
      Break Loop
Repeat Above
This conditional branch worked in a parallel process, but I guess for an event like this, the window is just too narrow maybe? Even as I spammed cancel it wouldn't stop.
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,229
Reaction score
3,591
First Language
English
Primarily Uses
RMMV
Assuming that what you wrote in the code box is the layout of your event, your break for input trigger isn't in the right place. First of all, is there 2 loops in your event?

Code:
// Loop 1 start
Player swings pickaxe
Loop
  // Loop 2 start
  Wait: 60 frames
  Player swings pickaxe
  Variable Chance = 1-3
  Conditional Branch: Chance == 3
    Show Balloon Icon: Player, Exclamation
    Play SE: 'Hammer'
    Text: "You obtained x ore!"
    Change Items: [Ore] + 1
    Break Loop
  Else:
    Conditional Branch: Cancel button is pressed
      Break Loop
  // Loop 2 end
Repeat Above
// Loop 1 end
Correct me if I'm wrong.

But anyways, your break needs to break the biggest loop (loop 1 in your case). Currently it's only inside the loop 2. And do you want the game to only check the input when the condition that chance == 3 is false?
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
No, no, there's only one loop. The player swinging the pickaxe is the initial action, after this the loop begins.
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,229
Reaction score
3,591
First Language
English
Primarily Uses
RMMV
Can you post the image of your event page?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,770
First Language
German
Primarily Uses
RMMV
@KingHazeel your second conditional branch is inside the first, that is the problem - it gets ony checked when both conditions are fulfilled.
it needs to be on the same level as the first conditional branch, not inside it - get rid of the "else".
Code:
Player swings pickaxe
Loop
  Wait: 60 frames
  Player swings pickaxe
  Variable Chance = 1-3
  Conditional Branch: Chance == 3
    Show Balloon Icon: Player, Exclamation
    Play SE: 'Hammer'
    Text: "You obtained x ore!"
    Change Items: [Ore] + 1
    Break Loop
  Conditional Branch: Cancel button is pressed
    Break Loop
Repeat Above
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Didn't work unfortunately. ^^;
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,599
Reaction score
10,919
First Language
English
Primarily Uses
RMVXA
Can we see a screenshot of your amended event. Without that, your "didn't work" tells us nothing useful.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,770
First Language
German
Primarily Uses
RMMV
I think your script went wrong. why didn't you use the original button pressed conditions, that is exactly what they are for.
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I'm using Sixth's Control Configuration System which is why I need to check for those inputs--but no matter, I did manage to find an alternate solution. I changed the "trigger" conditions to "press" conditions and instead of relying on the cancel button I check if the player is moving up, down, left, or right.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,039
Reaction score
4,255
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Person: "Taxes are bs and money is, too! Anarchy!!" *Literally anything goes wrong* Same Person: "Why hasn't the government fixed this???"
Stream will be live shortly with a session of Haunting Ground! Feel free to drop by!
As for the Coronavirus? Well: "People that spend their life avoiding death are already dead (they're also rich, and I like to spend my life with their money.)"
- R. Sanchez, "Edge of Tomorty: Rick, Die, Repeat"
making pierogi and corrupting my game files wbu

Forum statistics

Threads
94,345
Messages
920,111
Members
124,105
Latest member
acelaces
Top