Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Eventing Egg Hatching [Think PKMN] - Resolved

Okay so for my new 'monster catch em all' type RPG, I want to have it so that, like in the Pokemon games, you can obtain an egg, and after you've walked a certain amount of steps, the egg hatches into the monster. I'll tell you what I've got so far, but the problem is, it isn't working!

Screenshot to show you what I'm talking about:
http://img55.imageshack.us/img55/8188/eggscreenyp3.jpg[/img]

First part (explanation): In a common event linked to the 'Egg' Item.
First of all, I set a Variable named 'Steps' to be equal to the player's steps. Then a Conditional Branch using the Variable setting the player's steps to 5 for the egg to hatch (actually I'd like to have it so after maybe 75 or 100 steps the egg would 'actually' hatch. The 5 was just for a test run). Ok, so assuming the egg was in the inventory, it'll say 'eggs hatching' etc, then remove the egg from the inventory and add the monster to the party. The rest of the stuff I guess you can ignore it just involves scripts and items and etc to go along with the egg hatching process, but feel free to ask away.

My assumption of the problem? Could it be the fact that I set no trigger to autorun or parallel process? That was one thing I was thinking but I don't know how I'd go about using those options, I'm kinda rusty on my eventing.

http://img355.imageshack.us/img355/4666/eggscreen2ik5.jpg[/img]

Second part (actual event in which you obtain the egg).
In fact I don't know if this is really relevant but maybe I'm suppose to put a switch somewhere on here? Anyway it's just play sound and show message for 'you got the egg item' then the egg disappears with a Self Switch. That's all.

Well I hope someone can make sense of my post and help me out. It'd be much appreciated!
 
Yeah, your basic problem there is up there at the top, where the trigger for your common event is "None."

That means that it isn't going to trigger, unless another event calls it.  You'll need to make it parallel process, and that means a switch to activate it, although that can be set by anything, such as the event that gives you the egg.
 
Five steps is not a lot, and it may not reset itself when you first set that variable.  I'd guess that the player's step total is five or more when they get the egg. 

Try setting an event to display the number of steps (with /v) and see how it looks.  You may need to adjust the numbers somewhat.
 
yeah, like Unka Josh said, you are using a variable that checks for the total steps taken all game. You would need two variables, and check one against the other to see how many steps were taken during the period of time that you had it.
 
List of ingredients:

Two Variables (Steps1, Steps2)
Three Common Events(EggStart,EggEvent,StepChecker)
One Switch(EggSwitch)

Recipe:
First we need our Common Events. Our first one will be our EggStart event which will initialize Steps1 and Steps2 and turn our EggSwitch on. EggStart will look like this:


Trigger: None

Control Variables: Steps1 = Steps
Control Variables: Steps2 = Steps
Control Variables: Steps2 add X (where X is the number of steps it'll take to hatch the egg)
Control Switches: EggSwitch on

------------------------------------------------------------------------------------------------------
Next up we have EggEvent which will check our Steps1 and see if it is greater than or equal to Steps2 and if it is, hatch the egg.

Trigger: Parallel
Condition Switch: EggSwitch

Conditional Branch: Steps1 is greater than or equal to Steps2
Text: Your mystery egg has hatched!
Else:Do nothing!
-------------------------------------------------------------------------------------------------------

And last but not least our StepChecker which is a parallel process event that will keep a running tab of our steps independently of the other two functions.

Trigger: Parallel
Condition Switch: EggSwitch

Control Variables: Steps1 = Steps



And that's it! To use just call EggStart from any event. The flow goes like this:

EggStart is called which sets up our variables and turns on a switch which turns on our two functions: EggEvent which checks to see if our egg should hatch and StepChecker to keep our steps updated for EggEvent. If you want to make some eggs harder to hatch than others just make more than one egg start with a different addition to Steps2. Just made this and tested it now, so should be good to go. If you need some help setting it up, drop me a line.
 
Didn't get to try it til tonight but thanks, rubyaftermath, it worked well... almost perfect... see I'm having one little problem but I think it's my fault... I'll explain:

Okay, this part is the EggEvent... and I think this part is the one that's having the problem, because I modified it a bit to suit my needs. The issue here is, I set it to take 10 steps (in EggStart), and then hatch, didn't want to put too many steps because this was a test run. So playtesting, I took 10 steps, and the egg hatched, but it did what I told it to do in an infinite loop, that would be the following:

http://img152.imageshack.us/img152/5203/eggloopissuewh6.jpg[/img]

Explanation: Like you said, Steps1 greater than or equal to Steps2. Then next, my part. I put a conditional branch so that, when the monster hatches, if your party's full (four members) it won't add the monster to the party and instead it give you an item that lets you summon the monster later, and a message that explains that. However, if your party isn't full, it will give you the item, add the monster to your party, and the message. Also another little thing you might notice is a script that adds the monster's entry to a 'monster album' I have setup to use. And that's what all that stuff is.

Now... why it would be causing this infinite loop I have no idea... I tried everything from 'break loop' to 'exit event processing'. Nothing. A little help please?
 
I don't understand the way rubyaftermath explained it, so I'll just try to tell you my own way.

3 Common Events: 1.EggStart ; 2.EggSteps ; 3.EggHatch

1.Eggstart - Call this common event as soon as you get the egg
Initialize two variables named Steps to the number of Steps and another variable named Steps2 to Steps+{number of steps that takes for the egg to hatch} (steps = 20, steps2 = 50 (if number of steps to hatch was 30))
Turn a switch named EggHatch On

2.EggSteps - Make this event triggering option Parallel Process with EggHatch switch as the condition switch
Steps(your variable) == Steps
Conditional Branch [If Steps == Steps2]
  Turn EggHatch Switch OFF
  Call Common Event: EggHatch
End

3.EggHatch
Put here whatever you want to be done as soon as the egg hatches (text messages, add items, etc.)


99% certain that this works but if it doesn't just reply.

Good luck with your project.
 
Ackkkk can anyone see anything wrong with this? :|

http://img184.imageshack.us/img184/695/eggissueswithtissuesnx7.jpg[/img]

It hatches the egg but it won't do anything I told it to beyond saying 'The egg is hatching' >< Is this a VX bug or something?
 
The reason you are having an infinate loop is because being a paralell process, once it gets back to the top, steps 1 and steaps 2 are still the same, so it continues down the event again. What you need is a switch on the event page condition, so that if it's on it will run this event, but once it's hatched, the switch is turned off.

Also, you'll need to reset both variables next time you get an egg.

As for your last screenshot, you need to have a check for steps on there. Also, you need to change party members to <= not just < otherwise you'll run into issues.

Peace
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top