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,041
Reaction score
6,694
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
1,988
Reaction score
3,436
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
1,988
Reaction score
3,436
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
1,988
Reaction score
3,436
First Language
English
Primarily Uses
RMMV
Can you post the image of your event page?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,041
Reaction score
6,694
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,453
Reaction score
10,858
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,041
Reaction score
6,694
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
5,897
Reaction score
4,217
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

I'm playing DQ:XI DE in 2d mode with the synthesized soundtrack, the only way a RPGMAKER creator should play it. :D
:/ it really get on my nerves reading stuff about how to write a resume and they say things like "turn your failures into wins!!!" ... no interview Ive ever had cared to hear anything about my failures, and why would they :( ?
"Huh? You haven't backed up yet? *menacing stare* "
Been having a lot of fun playing Hearts of Iron IV. Had to restart a few times, but now I've finally conquerd Europe with my Axis friends, and am currently invading the Soviet Union.
Guess I'll rework all the existing screens in my game. Except of the save/battle screen. For this I will be lazy and use Yanfly. With my current pace it'll take a few months.

Forum statistics

Threads
93,633
Messages
914,149
Members
123,222
Latest member
Tomtomsan17
Top