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!!!
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


Messages In This Thread
Teleporting Doorways!!! - by Nuclearbones - 05-05-2012, 08:07 AM
RE: Teleporting Doorways!!! - by Cranky Old Man - 05-05-2012, 08:48 AM
RE: Teleporting Doorways!!! - by Homicide13 - 05-05-2012, 12:59 PM
RE: Teleporting Doorways!!! - by Cranky Old Man - 05-05-2012, 01:14 PM
RE: Teleporting Doorways!!! - by Homicide13 - 05-05-2012, 02:14 PM
RE: Teleporting Doorways!!! - by Damascus - 05-05-2012, 07:51 PM
RE: Teleporting Doorways!!! - by Nuclearbones - 05-05-2012, 09:13 PM



Users browsing this thread: 1 Guest(s)