Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Teleporting Doorways!!!
Nuclearbones Offline
Junior Member

Posts: 45
Threads: 19
Joined: May 2012
Reputation: 0
#1
Teleporting Doorways!!!

Hello forum,
After tons of searching for the answers I was not able to find the right help for what I want. Here's the situation...

I'm going to have a humongous map made with blender, it's large, surreal, and almost ridiculous. It will have many things from floating towers, to upside down bridges and looping staircases! But there's one specific thing about this map that is going to give it its puzzle.

Portals.

Not just any portal, no, it is basically a door that will lead you to eight small subsections of the room. Six hold mandatory items. One is the room where the puzzle is solved. And and the last room that holds the exit. The subsections only have one door which is the door you came from and what ever you find in the room. Once you go into a room, the door will close behind you and when you open it back up then when you open the door up again it will lead you into another random subsection of the room. Mind that it doesn't simply lead you into another subsection and end just like that. The rooms will "shuffle" your position so that when you open the door it's a random subsection. I want to know how I can do this. It was suggested that I use Random Intigers and position areas but I think I should check with some experienced people in order to obtain the proper instructions.

If anybody has any suggestions, it would be much obliged to give me a piece of you knowledge!

I'm definitely planning for this custom story to be completely original.

Thanks so much!

-Nuclearbones
05-05-2012, 08:07 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: Teleporting Doorways!!!

I'm sure that there are competent people here that will help you with your problem, and as the door closes before the scenery changes, you're not asking for actual portal mechanics either.
...but take a step back and look at what you're asking:

"I'm definitely planning for this custom story to be completely original."
"I'm going to have <insert extra-dimensional scripting problem here>, it's large, surreal, and almost ridiculous."
"I want to know how I can do this."
"After tons of searching for the answers I was not able to find the right help for what I want."
"I think I should check with some experienced people in order to obtain the proper instructions."

The reason why this would be completely original, is because it takes a competent programmer/scripter to pull it off. Don't go "It's going to have X." until you know that it's even possible for something to have X.
How much progress have you made on your idea?
Have you made the level parts yet?
Have you made ONE level part yet?

Noob scripting tutorial: From Noob to Pro

(This post was last modified: 05-05-2012, 08:49 AM by Cranky Old Man.)
05-05-2012, 08:48 AM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#3
RE: Teleporting Doorways!!!

That's pretty simple to do. All you have to do is close the door with script once the person enters a room and then have it re-assign a new location when the door opens again. (the teleporting would also have to be done with script, so it would just be a simple matter of connecting two doors and then re-connecting it with a different door again when the player goes through it a second time.)

05-05-2012, 12:59 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#4
RE: Teleporting Doorways!!!

(05-05-2012, 12:59 PM)Homicide13 Wrote: That's pretty simple to do. All you have to do is close the door with script once the person enters a room and then have it re-assign a new location when the door opens again. (the teleporting would also have to be done with script, so it would just be a simple matter of connecting two doors and then re-connecting it with a different door again when the player goes through it a second time.)
Are you thinking that it's a level door, or a swing door now?
...because with swing doors, it's not just a matter of connecting. You have to teleport entire rooms around for it to work. Then, when you think you've got it working like a charm, I'll just take this book here, and toss it into one of the rooms, and close the door. The room will teleport, but the book will fall down into the void, and that was an expensive book. Hopefully there are scripts for teleporting any/all physics objects inside the room as well, or make sure that you can't carry stuff around in the entire level.

Noob scripting tutorial: From Noob to Pro

(This post was last modified: 05-05-2012, 01:15 PM by Cranky Old Man.)
05-05-2012, 01:14 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#5
RE: Teleporting Doorways!!!

Not really, there are very simple work-arounds for that, all it requires is that you be creative. Also I was thinking that he wanted more of a move-object door, but doing it with level doors would certainly be even easier.

Though there is also the question of if he wants the player to see what is on the other side of the door before he goes through it. If he does, that's still possible, it would just take a bit more hacking around. Otherwise it would be very simple to do what he wants to do.

05-05-2012, 02:14 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: Teleporting Doorways!!!

Here's one possible solution: Create eight different versions of a small room with only one door, each connected to the eight rooms you want to go to. The next part's a bit complicated.

Place a Script Area around the doorway, and one that takes up most of the room.

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""DoorArea""CreateCallback"false1);
}

void CreateCallback(string &in asParentstring &in asChildint alState)
{

    
AddEntityCollideCallback("Player""RoomArea""TeleportPlayer"true1);



This will assure that the area that teleports the player will only turn on when you pass through the doorway, otherwise you'll end up getting stuck in a loop that whizzes you through all the versions of the room.

After that it's just teleporting the player to a random identical version of the room. Create 8 PlayerStartPos, and make sure they end in "_#"

PHP Code: (Select All)
void TeleportPlayer(string &in asParentstring &in asChildint alState)
{
SetSwingdoorClosed("[DOOR]"truetrue);
AddTimer("TeleportTimer"1.0f"TeleportTimer");
}

void TeleportTimer(string &in asTimer)
{

int x RandInt(1,8);
TeleportPlayer("PlayerStartArea"+x);


You'll need to repeat this eight times for every room. What this basically all means together is that as soon as you enter the small room, the teleport callback turns on and makes the door shut behind you when you enter the room. A second later, you can turn around and emerge into a random one of the eight adjoining rooms. The teleport callback won't turn back on until you've walked through the doorway.

You will probably need to alter the code to suit your specific needs, but that's the general gist. The biggest downside is that it will be obvious your player has teleported because you'll snap to the alignment of the PlayerStarAreas. It won't work if you just want the eight rooms to randomly connect to each other. Hope I have been helpful. :]

(This post was last modified: 05-05-2012, 08:04 PM by Damascus.)
05-05-2012, 07:51 PM
Find
Nuclearbones Offline
Junior Member

Posts: 45
Threads: 19
Joined: May 2012
Reputation: 0
#7
RE: Teleporting Doorways!!!

(05-05-2012, 07:51 PM)Damascus Wrote: Here's one possible solution: Create eight different versions of a small room with only one door, each connected to the eight rooms you want to go to. The next part's a bit complicated.

Place a Script Area around the doorway, and one that takes up most of the room.

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""DoorArea""CreateCallback"false1);
}

void CreateCallback(string &in asParentstring &in asChildint alState)
{

    
AddEntityCollideCallback("Player""RoomArea""TeleportPlayer"true1);



This will assure that the area that teleports the player will only turn on when you pass through the doorway, otherwise you'll end up getting stuck in a loop that whizzes you through all the versions of the room.

After that it's just teleporting the player to a random identical version of the room. Create 8 PlayerStartPos, and make sure they end in "_#"

PHP Code: (Select All)
void TeleportPlayer(string &in asParentstring &in asChildint alState)
{
SetSwingdoorClosed("[DOOR]"truetrue);
AddTimer("TeleportTimer"1.0f"TeleportTimer");
}

void TeleportTimer(string &in asTimer)
{

int x RandInt(1,8);
TeleportPlayer("PlayerStartArea"+x);


You'll need to repeat this eight times for every room. What this basically all means together is that as soon as you enter the small room, the teleport callback turns on and makes the door shut behind you when you enter the room. A second later, you can turn around and emerge into a random one of the eight adjoining rooms. The teleport callback won't turn back on until you've walked through the doorway.

You will probably need to alter the code to suit your specific needs, but that's the general gist. The biggest downside is that it will be obvious your player has teleported because you'll snap to the alignment of the PlayerStarAreas. It won't work if you just want the eight rooms to randomly connect to each other. Hope I have been helpful. :]
Yes! This was exactly what I was looking for! Thank you so much for helping me!
05-05-2012, 09:13 PM
Find




Users browsing this thread: 1 Guest(s)