Teleport Randomly between object???

0 favourites
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Trying to teleport to another instance of my vent system with a collision but it keeps sending me back to the same one.

  • When you collide with the vent you narrow it to only that instance for future conditions and actions in that event. You could add a 'pick all vent' sub-condition BEFORE the pick random instance which opens them all up again to be picked. There are also other options such as running a function which inside the function picks a random instance (functions start again with no picked instances).

  • okay awesome, how would I go about locking out my current vent so I don't get randomly sent back to it after colliding with it?

  • On the collision top event you can add an action to change a variable on that one vent, then when you pick a random instance later on you can say pick a random instance that doesn't have that variable set i.e. it will not choose the one you collided with. You could use where ventopen=0 but I don't know how exclusive that variable is and how it is used so you can always add another one for this pick event.

  • ooooh okay so for each vent I should specifically make a variable being open or closed so I don't go back to it immediately?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't know how your game works but in general you can toggle a variable on the vent so it is different from the others and won't be picked when you a picking a random instance.

  • okay thank you so much I'll play around with the variables and see how that works.

  • Hey I am sorry, I can't figure this out for the life of me. Do you happen to have a method to prevent teleporting to the same vent you collide with? Maybe something with UIDs perhaps?

  • Well technically you can use vent UID is not the one collided with, but that's not the problem, if you can't get it to work with a variable then it's the event structure so please share a screenshot.

  • yessir! I am currently using a setup where he teleports to a outside "hub" vent for a moment then it sends him back to another random vent. it looks nice but I think the quick random selection of a vent will be a lot easier if I can figure it out.

  • So the idea is when you collide with ventreturn you want to pick a random vent but not the one you collided with to get to ventreturn? There's a lot of inbetween events here.

  • Basically I wanted it to be simple like in one vent and out another but not the original one (which was the main issue). I switched it to this "fix" for now but can put it back so you can see the original idea. Sorry just got off work so I'll throw it together now.

  • here you go, also I would like to set a timer so after I leave the vents they will be closed for a bit so he doesn't keep walking back into them. At the moment I attached 2 variables so when the killer is not alerted and the vents are open he can collide with them and they cannot be entered again. I am not quite sure how to connect a 10 second timer to reset the variable. Also thank you so much for the input on the timer for my chase alert, it worked perfectly.

  • Ya so as mentioned above you must add a variable condition with the 'pick random instance' condition that excludes the vent so you can say ventopen=1.

    You can add a timer behaviour to the vent, when you collide start the timer for 10 seconds. Then another event 'on timer finished' set it back to 1.

  • Dude you are my hero for real! Finally figured it out thanks to you. I completely forgot that Instance variables affect only individual objects unless set up otherwise with pick all. Thanks again, f I have more annoying questions I'll ring ya! :D /

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)