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,037
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,435
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,435
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,435
First Language
English
Primarily Uses
RMMV
Can you post the image of your event page?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,037
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,446
Reaction score
10,856
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,037
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,896
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: 2)

Latest Threads

Latest Posts

Latest Profile Posts

I made a lot of progress on the 2nd stage of my game. Only 10 levels but it took over a week to design and implement. Cant wait to share more info.
Decided to focus on mapping for once. I've pumped out 15* new maps over the past two days' work, including two larger ones that involved some kinda fancy parallax stuff.

*should actually be 17 by the end of the night.
its been a while help
About to go live with a drawpile stream! Me and some fellow artists will be drawing things based off of prompts!
If I post an item for sale on fb for $750 and say it's in excellent condition, what is going through someone's mind to make them think it is remotely acceptable to offer $300 for it?

Forum statistics

Threads
93,625
Messages
914,077
Members
123,201
Latest member
GotTheJoy
Top