Hm. Alright. Let me try to make an event list. You can find a “for each” event by clicking on the plus at the top right, I believe. Four dots represent a sub-event.
Player is standing on top of teleporter and Player pressed key (E) : Store teleporter ID in scene variable “teleID”
…For each teleporter, if teleporter ID == sceneVar(“teleID”)+1: set player position to teleport.x, teleport.y
Doh, you’re right. For each isn’t needed as there are multiple conditions for the teleporter to fit.
A for each would be needed if “teleID==currentTeleID+1” were in a subevent.
Now i have two Objects:
Teleporter with an ID (works)
Target Object (hidden) with an ID (works).
I do it this way:
when Player is in collision with Teleporter and presses down,
change position to the Target
I don`t know why, but when i place 3 Teleporter and 3 Targets,
when i do it on Teleporter 1, it works
when i do it on Teleporter 2, it changes position to Target 1 (should be 2)
when i do it on Teleporter 3, it changes position to Target 1 (should be 3)
So it seems not to work. Perhaps you see the mistake i made:
I think the problem is that the third event in your screen shot will apply to the first teleporter it finds. It’s not being applied to the Teleporter from the first event.
Also, will the Telport variable of Gunnar only be set in the first event? If so, make the third event a subevent of the first one, and get rid of current second event - so it looks like:
I need the Teleport variable of Gunnar to set some animations and other settings. I just deleted them until the destination of the teleport works.
So the question is the same: how to tell the “change position of gunnar” which Target i mean?
When he stands on Teleporter 1, Target should be Target 1,
When he stands on Teleporter 2, Target should be Target 2.
I need something like:
when Gunnar is in collison with ID of Teleporter 3 → change position of gunnar to Target.objectvariable(ID = the same where Gunnar stands on Teleporter).
Hmm, i think i don`t understand. My english sometimes is not good enough.
which action do you mean with “say”, and what is targetTeleportId?
I have a object “Teleporter” (starting point) with the id: “ID” as a object variable
and
I have a Target “Portal” (target point) with the id: “Ziel” as an object variable
So I only have a Teleporter.ID and a Portal.Ziel, not a TargetTeleportId…
the global variables “target” and “beamer” are only used to give every object an own id (“ID” for Teleporter and “Ziel” for the Portal).
I don´t want the Player to beam to another Teleporter, i want it to beam to a fitting Portal.
My intentions is the following:
When i create for example 3 Teleporters, the first should have ID1, the second ID2 and so on.
When i create 3 Teleporters, i also create 3 Portals, which IDs (i named them “Ziel”) are also 1 for the first, 2 for the second and so on.
so if the player stands on Teleporter1 and presses down, he should beam to Portal1, if he stand on 2 and presses down, he should beam to Portal2 and so on.
Hey, in future, could you quickly switch to English before screenshotting events? It’ll help us wrap our brains around the code faster.
I have misunderstood. I thought you said: After pressing down key, teleport to the next teleporter. Sorry about any confusion that may have caused.
Hmm. One part to check might be the variables assigned to the teleporters and portals. Are you sure you don’t have 3 portals with the same variable?
Player is standing on top of teleporter and Player pressed key (down) : Store teleporter ID in scene variable “teleID”
…(For each portal may be needed) if portal ID == sceneVar(“teleID”): set player position to portal.x, portal.y
If this goes nowhere, it might be good to just send us the project file, and we’ll send back a solution.
Wow! Looks very interesting, but if i am right (as a newbie), isnt the target Portal random?
So the more i look on the code, the more sense it makes. could it be that easy? And when i say easy, i mean short… impressive. have to sleep now, tomorrow familiy day, and then i can be back on my loved project game to test it out!
And this is the way it looks now, when Gunnar is beaming (I will hide the Portals, and next days i will change the Portal Animations from barrels to a well or something. )