Aller au contenu

Photo

Self closing doors?


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
el.sombrero

el.sombrero
  • Members
  • 100 messages
 Hi again dudes,

 This time my doubt is the following:
 I'm creating a maze and I would like it to be a "one way" maze. What I mean is that once the player has chosen left or right, he can't go back and chose the other side.
 I was trying to figure out a way to do this and my most promising idea was to put doors at each path of the junction (left or right) and once the player has gone through it, the door closes itself and is locked down. 
 Does anyone out there knows how could I implement this? Does anyone have a better idea of how to create a one-way maze?


 

#2
bealzebub

bealzebub
  • Members
  • 352 messages
I think putting a trigger past the door with an OnEnter script to close and lock the door would work. You need to make sure the pc actually goes through and didn't just open it. Make sure the doors are all set to plot so they don't just get smashed.

#3
rjshae

rjshae
  • Members
  • 4 507 messages
You could always choose the airlock route: the next door won't open until the previous door is shut. That would help solve the problem of tracking at what point the party is all the way through before closing the door.

#4
Morbane

Morbane
  • Members
  • 1 883 messages
//Put this script OnOpen
void main()
{

object oPC = GetLastOpenedBy();

if (!GetIsOwnedByPlayer(oPC)) return;

DelayCommand(4.0, ActionCloseDoor(OBJECT_SELF));

DelayCommand(4.0, ActionLockObject(OBJECT_SELF));

}
This doesnt prevent someone from getting trapped behind - so the airlock or the trigger  will also work - this is just an example...

Modifié par Morbane, 14 mai 2012 - 10:08 .


#5
bealzebub

bealzebub
  • Members
  • 352 messages
You'll probably need to think about henchmen, comapnions, familiars, animal companions, or other PCs, if someone plays this multi-player, getting left behind.
maybe a trigger on the entrance side of the door which unlocks it when approached.

#6
Dann-J

Dann-J
  • Members
  • 3 161 messages
I have self-closing (but not locking) doors in a module I'm working on. The doors have heartbeat scripts that return immediately if the door is already closed (to reduce processing load) , but which check the immediate area (in a fixed radius) whether it can find the character who opened it if the door is open. If the search finds the character responsible then it returns. If it doesn't, then it closes the door. That way the door doesn't slam in a character's face if they hang around and don't go through it immediately.

The script still allows party members to be cut off from whichever character opened it though if they dawdle far enough behind (which they often do), and if the door isn't a whole-party area transition (like a gate).

You could always tie the closing and locking of one door to the opening of another. If you intend to have companions, then you can jump the party in formation when you open a new door to stop them being trapped behind the one that closes and locks.

#7
bealzebub

bealzebub
  • Members
  • 352 messages
Maybe instead of locking doors, you could give a creature the push block appearance, and have it follow behind or move to block passages.

#8
Shaughn78

Shaughn78
  • Members
  • 637 messages
I have a maze with self closing doors, like rjshae suggested I used a airlock method. Open a new door and the previous door closes. This was not a one way maze, I would allow the player to backtrack but they would be unable to follow their path of open doors to return to the beginning. I also had a percent chance to have zombies spawn so excessive wandering and back tracking would hinder the player.

Companion/henchmen/multiplayer will be a huge thing to look at. With my area I deactivated the companions on blocked AI, because I didn't want them to open door causing more zombies to spawn and splitting up the party further with more doors closing.

For the script I used an on open. A ipoint kept track of the last door open so the script would close that door. With your locking of the door you could also do a faction loop and if a faction member was further than X from the player they would jump next to them to prevent party members from being left behind.

Here is the parts of my script that apply to what you are doing.


void main()
{
object oPC = GetLastOpenedBy();

//Info for closing last opened door and locking
int iLockRoll = d100(1);
int iLock = TRUE;
object oInfo = GetObjectByTag("wt_orc_door_last");// placed ipoint
string sOldDoor = GetLocalString(oInfo,"OldDoor");//tag of last opened door
object oOldDoor = GetObjectByTag(sOldDoor);
string sNewDoor = GetTag(OBJECT_SELF);//door opened


//Closes last door and 50% chance to lock door
if (sNewDoor != sOldDoor)
{
*/if (iLockRoll > 50)
{
iLock == TRUE;
}*/
DelayCommand(3.0, AssignCommand(oOldDoor,ActionCloseDoor(oOldDoor)));
DelayCommand(3.5, SetLocked(oOldDoor, iLock));
SetLocalString(oInfo,"OldDoor",sNewDoor);
}
}

By setting the doors to plot and requiring a key the player should be locked in their chosen path.

**edit**

Another option would be to spawn in a  placeable. I also used this to seal off retreat from one cave. Have a trigger a little ways in, once a player enters the trigger, jump all factions members to the player. Have a non-static, non-useable placeable appear with a dynamic collision spawn at a waypoint and block the passage. For a bit of fun throw in the screen shake VFX.

Modifié par Shaughn78, 14 mai 2012 - 11:31 .


#9
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
To me, it seems the simplest thing to do would be to lay down two triggers, one on the left branch, and the other on the right branch. Walk through the left trigger, the right branch gets shut down (via a locked door, collision box placeable, or some other means). Likewise, walking through the right branch shuts down the left. That way, you don't have to worry about other party members getting cut off.

If you really want to use the airlock, though, a little trigonometry could help you out. Lay down a trigger where you want the back door to be, and add a script on the on-exit. Lay down two waypoints, one just before where the trigger ends, and another further back in the passage, in the direction from which the party came. On the on-exit script, cycle through the exiting object's party members. If all party members are 1) nearer to the first waypoint than the second, and 2) far enough away from the second waypoint (i.e. further than the first waypoint), then you can safely lock down the back door.

Crude diagram:

2nd WP--(3m)---1st WP---(2m)----Party Member---->>

The party member is 2m from the first waypoint and 5m from the second. 5>2, and 5>3, so the party member must be through the passage already.

#10
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
Use area transitions under portals..

Make where the doors are dead ends, throw in a few portal effects and placeables instead and off you go, no need for scripts etc just set the waypoint the portal goes to on the transition properties and that's 100% one way and will jump the whole party so long as you tick the box.

#11
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hey guys, thank you all, problem solved with your help :0)