Jump to content

Recommended Posts

Hi. I have the script below attached to a door in my mod. It works just fine but not as I need it to.

 

This is the issue: The door is operated by a lever in another room.

The player can get to the door without using the lever but must not be able to open it.

This lever also enables some traps between the lever and the now open door.

The player must do a timed Tomb Raider style run to get through the door before it closes.

 

At first I had the door set to 'Parent Activate Only' as this seemed the simplest way of getting it to work but that also prevents the script from closing it.

I can think of a couple of ways to get this to work but I'm not sure how well they'll perform and there may be an easier way of doing it.

 

1. Add a collision plane in front of the door and enable/disable this using the OnOpen event.

2. Lock the door after it closes and set the lock level to 'requires key', but this seems to get messy and needs a lot more done to the script.

3. Is it possible to use a line in the script to get around the 'Parent Activate Only' problem? That would be neatest, if I can.

 

In the absence of any better ideas, I prefer option 1, since that only needs an ObjectReference property and a couple of lines of script (I think). This script idea is set out below, too.

 

What do you think?

 

Scriptname MBWRFbtharDoorTimerScript extends ObjectReference

{Closes the door after a time delay}

 

Int Property DoorTimer auto

 

Event OnOpen(ObjectReference akActionRef)

 

Int OpenState=Self.GetOpenState()

 

If(OpenState==1||OpenState==2)

Utility.Wait(DoorTimer)

Self.SetOpen(false)

EndIf

 

EndEvent

 

Option 1 script.

 

Scriptname MBWRFbtharDoorTimerScript extends ObjectReference

{Closes the door after a time delay and places a collision barrier

in front of it to prevent player activation}

 

Int Property DoorTimer auto

ObjectReference Property MyCollisionBarrier auto

 

Event OnOpen(ObjectReference akActionRef)

 

Int OpenState=Self.GetOpenState()

 

If(OpenState==1||OpenState==2)

MyCollisionBarrier.disable()

Utility.Wait(DoorTimer)

Self.SetOpen(false)

MyCollisionBarrier.enable()

EndIf

 

EndEvent

Link to comment
Share on other sites

Option 1 will bring your idea into fruition. However, I would also put it in type of "done" state afterwards so that the event doesn't send every time the door opens or closes, assuming that you'd want the barrier to stay up indefinitely.

Edited by Rasikko
Link to comment
Share on other sites

Rasikko,

 

I don't have a go to state 'Done' line because I need it to fire each time the door is opened by the lever. Since it's a timed run and the player probably won't make it in time first time around, it has to keep resetting until they finally make it. Glad you think the idea is otherwise OK.

 

The Willoughbian, that's something that didn't occur to me and it would be easy enough to do since I already have an XMarker set up to enable and disable the traps. That works on a script attached to the activate parent lever and also pops up a message box saying 'A remote door opens but some traps have been enabled!' I'll think about it and maybe give it a run. My concern would be how it looks to the player if they are close to the door when one pops out of existence and the other pops in!

 

Taking your idea a step further, it could work really well if I swap the door for a collision barrier plus a visible magical barrier effect. Pop the collision barrier in and out and fade the magic barrier effect in and out.

 

In fact, I like that a whole lot better than my door. That way the player can see the prize through the barrier and it'll be even more frustrating if they just don't make it in time!

 

Thanks a lot for giving me some ideas guys! Much appreciated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...