Check for zones using if else statements?

Im using @ui arrow overlays to change zones on a scene.
Instead of using coordinates, I thought it would be easier to just use the given coordinates for the zones.
How would i navigate between the zones?

I was thinking :

gain zone3
tappable
“LEFT_ARROW”{
if(zone3){
pan to zone 2
}
if(zone2){
pan to zone 1

and so on…

but i want to remove the gains, which isn’t possible.

is there a way to check which zone you are, and implement that into code?

There are two ways to remember choices.

  • Gains
  • Naming your choice

You could try naming the choice. However you will have to create a new UI from your overlay for each zone.

hmmm that seems like a lot more work. I think ill just stick to spotting my character. Is it possible to pan to a specific location?

Unfortunately, there is not. I think using gains will be the easiest option, if I’m honest.

if i have all these gains, when my character is on zone 1 for example, they will move to zone 3 automatically when they press the right arrow (because gain(zone3) is active). How should I make them move zone by zone consecutively?

You could rearrange the order of your if statement. When you’re in zone 1. It will check either only one 2 (or zone 2 first). That way it will only be able to go to zone 2.

Otherwise without using gains. You could use labels to loop. You will be able to track if they’ve checked all the zones, if they have to do it in a specific order - 3, 2, 1.

Eg.
gain zone3
label Zone3
tappable
“LEFT_ARROW”{
if(zone3){
gain zone2
pan to zone 2
goto Zone2
else{
goto Zone3
}

label Zone2
tappable
“LEFT_ARROW”{
if(zone2){
gain zone1
pan to zone 1
goto Zone1
}
else {
goto Zone2
}
“RIGHT_ARROW”{
if(zone2){
gain zone3
pan to zone 3
goto Zone3
}
else {
goto Zone2
}

label Zone1
tappable
“RIGHT_ARROW”{
if(zone1){
[EXIT LOOP - CONTINUE TO NEXT SCENE]
else {
goto Zone1
}

i mean when it clicks on any of the arrows, it will only go to another zone next to it. Im not doing any order. Just allowing players to basically pan through the entire screen. ( i already tried tappable [pan] but i have huge tappable overlays; no room to tap and drag)

I want my players to go back to the zone they’ve previously visited (aka where they gained) but that would be impossible if i have a gain(zone3) in zone1, cause they would skip zone 2.

You could try the code I wrote above. Adding in an X UI for them to exit when they’ve finished.

To do this I’ll alter the code above. It would need to be
label Zone1
if(Zone2) {}
elif(Zone3){}
else{
goto Zone1}

this is getting confusing…

label ZONE3
tappable
“LEFT_ARROW”{
if(zone3){
@DARREN walks to spot 1.421 -83 -139 in zone 2 in 2 and pan to zone 2 in 2 THEN DARREN faces left
gain zone2
goto tappable_explore
}
}
“RIGHT_ARROW”{
if(zone3){
DARREN (talk_neutral_atcamera_loop)
There is nothing there.
}
}

(i have to go back to tappable_explore because thats where my tappable overlays are at. So i must combine the “label Zones” with my tappable overlays so they happen at the same time. Otherwise, the story would be focused on the arrows, until its done.

I think having one label for all the zones may make it harder, as in my opinion you will need separate if statements for each zone; however, you may be able to do it. I’m not at computer, at the moment, so I can’t test it.

This is what I would do, personally - the code may not be perfect as I’m typing on a phone.

Create exit UI here
tappable
“Exit”{
goto after
}
If you can’t select the exit tappable, you will need to intitalise it in all 3 labels.

The scene starts in zone 3. The reader has gained zone 3 already.

label Zone3
tappable
“LEFT_ARROW”{
if(zone3){
@DARREN walks to spot 1.421 -83 -139 in zone 2 in 2 and pan to zone 2 in 2 THEN DARREN faces left
gain zone2
goto Zone2
}
Not sure but if the reader can click anywhere else and the story still continues, you will need an else to loop.
“RIGHT_ARROW”{
Regardless of if zone 3 is gained, there is nothing there.
DARREN (talk_neutral_atcamera_loop)
There is nothing there.
}

If the reader selected the left arrow they would go to zone 2.

label Zone2
tappable
“LEFT_ARROW”{
if(zone2){
@DARREN walks to spot X Y Z in zone 1 in 2 and pan to zone 1 in 2 THEN DARREN faces left
gain zone1
goto Zone1
}
“RIGHT_ARROW”{
if(Zone3)
@DARREN walks to spot X Y Z in zone 3 in 2 and pan to zone 3 in 2 THEN DARREN faces left
goto Zone3
}

**If the reader selected the left arrow it will go to zone 1. If the reader selected the right arrow it will go to zone 3. Because the reader started at zone 3; therefore, had to gain zone 3 to go to zone 2, I did check it. However, you can remove it. **

label Zone1
tappable
“LEFT_ARROW”
Regardless of if zone 1 is gained, there is nothing there.
DARREN (talk_neutral_atcamera_loop)
There is nothing there.
}

“RIGHT_ARROW”{
DARREN walks to spot 1.421 -83 -139 in zone 2 in 2 and pan to zone 2 in 2 THEN DARREN faces left
gain zone2
goto Zone2

Not sure but if the reader can click anywhere else and the story still continues, you will need an else to loop.
}

label after
[Rest of episode]

I was going to add in being able to skip zones however, how it’s currently set up there’s not need.

Hopefully, that helps. If not best of luck.
If you still need help tomorrow I will test your method.

it wont work, if i go to all these labels for the zones, i will be stuck in this loop of arrows. I must also incorporate
goto tappable_explore

label tappable_explore
@DARREN is idle_loop
tappable
"BOXES"{
@DARREN is idle_loop_rear and DARREN faces right
        DARREN
    Hmm....I could probably get a better view up that cliff.

@DARREN faces left
        DARREN (talk_think_neutral)
    I don't think I can climb that high though...

goto tappable_explore
}
"BABY FOOT SWADDLE"{
        DARREN (talk_explain_neutral)
    I'm not really thirsty right now.

goto tappable_explore
}

if i put:
label Zone3
tappable
“LEFT_ARROW”{
if(zone3){
@DARREN walks to spot 1.421 -83 -139 in zone 2 in 2 and pan to zone 2 in 2 THEN DARREN faces left
gain zone2
goto Zone2
}
else{
goto tappable_explore
}

However, i have already gained zone3 so it will always loop back to this and never go back to my other tappable overlays.

That’s why I said you’ll need an exit button.

Otherwise you only let the reader go to each zone once.

Do you have more overlays other than the arrows?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.