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.

Conditional Branch

This is probably really easy, but I have a hard-to-explain problem that I can't figure out.

I essentially have 3 different maps, a beach house, a town, and a path connecting beach house to town.

There is a guard on the path that blocks the way into the town, to get to the town the character must retrieve itemA from the beach house and then the guard will move and you may proceed.  The only problem is when I want to go back from the town to the beach house, the guard won't move because the variable "get itemA" is already at 1 so the guard simply says "you may proceed" without moving. If I change this then the guard would move again when I go to the guard the first time, causing the guard to have a repeating cycle which could move the guard to unintended locations. (I doubt I explained this very well, but here are some screens of what I'm talking about)
http://img392.imageshack.us/img392/3381/helpaj5.png[/img]

I am using RMXP and I have tried using a switch for when coming back from the town and changing variables when leaving the map, but it ends up with the same "guard repeating move cycle thing".  I probably just don't have an understanding of something or am overlooking/overthinking something, but please help D:
 
I couldn't care less about piracy, so I will help...

Create two guards, one where the guard is normally ("Guard A") and one where the guard is supposed to move to ("Guard B"). At first, "Guard B" should be an invisible event that does absolutely nothing and "Guard A" should be stood where he is normally.

When you bring "Item A" to "Guard A", have him move out of the way like normal. Once his movement is over, activate a switch that turns "Guard A" off (i.e. makes him below hero and invisible) and turns "Guard B" on (i.e. changes his graphic to that of a guard and makes him same level as hero etc.).

Because of the switch, even when the "Guard A" event moves back to it's original place because you left the map, he is now below hero and invisible so will not get in the way. Equally, the "Guard B" event will be stood where the "Guard A" event moved to, giving the impression that he stayed there.

I hope that's well explained.
 
e_e Just to show you, I will tell you him how to do it.

First off. Make another page on that Event and on that page, you might aswell go down to the Local switch and switch it to A.

Go back to the first page and move the Player movements, event's movements, and text (not the variable) into the "Clothes" C-branch then delete that whole "Guard 1" C-branch and variable.

Put a "wait for move's completion" at the end of the move commands and then put a "Local switch 'A'= On"

So far your event should look something like this

C-branch [Variable: Clothes] >= 1
     Message: Welcome to the Town!
     *Insert move whateverness here*
     wait for move's completion
     LOCAL SWITCH 'A'= ON
   Else
Message: Blah...something about clothes?
end


Okay, Now go to page two and Put "The town is just ahead." as a message....

That should be it...No waste of a variable.
 

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