How to increase scene number by 1

I want the scene number to increase by 1 when the player hits the win object, and I don’t want to have to enter in the scene numbers manually. So like, if player touches win and it is on scene 1 it should go to scene 2. I tried using ToString and a variable but it didn’t seem to work


1 Like

Thanks, this works, but for some reason when I use this code to switch scenes the link code no longer works. In scene 2 I have a link to use the code from scene 1, and when I start the player in scene 2 it works fine, but when I switch with the code it doesn’t

Linking normally has nothing to do with scenes. Linking is for using external events. Do you have an external event sheet?

Oh, I have no idea how external events work. Should I copy all the code in my scene1 over to an external event and then link all my scenes to that external event?

If those are events you intend to reuse throughout the game, yes.

Ok, I did that but have the same problem. When I switch scenes using an action none of the code works, even though it’s linked to the external event, in fact behaviors don’t even work either

Hmm…that doesn’t make much sense, however events have nothing to do with behaviors.

Are you using events that specifically refer to an object? You can’t really use those in multiple scenes unless the object is a global object. Just giving it the same name does not apply.

All of my objects are global objects, and I just copy pasted the same code I was using before into an external event. The weird thing is that it works if I start in the second scene but when I switch with a command, everything breaks.

Can you post a screen shot of the external events, plus the events for each scene ?

Here is a video showing all the code and what is going wrong - YouTube

The answer is in your other post

Please don’t double post the same issue.

Since the original request here was answered, and a new thread was opened for the other, I’m going to close this out.

1 Like