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,241
Reaction score
6,784
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
Global Mod
Joined
Nov 18, 2015
Messages
2,388
Reaction score
3,680
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
Global Mod
Joined
Nov 18, 2015
Messages
2,388
Reaction score
3,680
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
Global Mod
Joined
Nov 18, 2015
Messages
2,388
Reaction score
3,680
First Language
English
Primarily Uses
RMMV
Can you post the image of your event page?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,241
Reaction score
6,784
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,638
Reaction score
10,934
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,241
Reaction score
6,784
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,071
Reaction score
4,265
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 Posts

Latest Profile Posts

Caught a guy trying to break into our house today. Appearantly he intended to burgle our neighbor (a 94yo widow) but picked the wrong house. Faced with two angry males he was quick to give up without a fight...
I just joined the club of nerds making their own Excel-Sheets to calculate HP / MP / EXP.. parameter curves
Me: "Finally finished most of my game backlog. Probably time to do some gamedev" | Steam: *offer sales*
If I recorded while I created (what I think is) a small plugin, would you be interested enough in the process to watch it?
I keep trying to explain to clients that the huddle masses behind the old K-Mart are a Fallout Reenactment group. Somehow I don't think they believe me. :LZSskeptic:

Forum statistics

Threads
94,595
Messages
922,186
Members
124,468
Latest member
tonylogan
Top