Jump to content

Combining scripts


Maniac3020

Recommended Posts

Once again, I edit this post. :tongue:

 

I've gotten doors to autoclose with a simple script I found on the Geck help pages, I've even managed to integrate it with a door that already had scripts running, but this door, unless I take out the script that the door already had, won't auto-close. Can someone who has scripting knowledge take a look at it and tell me why it's not working?

 

(The script in green is what I added)

 

scn NVEcvDoorBG01SCRIPT

 

ref rUser

 

;This script is to prevent AI from following you between HiddenValley02 and HiddenValley01 so we don't overload on NPCs.

 

Begin OnActivate

 

set rUser to GetActionRef

 

if (rUser == Player)

Activate

else

;Only check the door between HiddenValley01 and 02

if (GetSelf == vHVLevel02MainDoorREF) || (GetSelf == vHVLevel01DownstairsDoorREF)

 

;Check if they are in combat

if (rUser.IsInCombat)

;If they are, stop combat and don't let them use the door.

rUser.StopCombat

return

else

;They aren't, so let them go.

activate

endif

else

Activate

endif

endif

 

End ;OnActivate

 

float doorTimer

short closeDoor

 

Begin GameMode

if closeDoor == 1

if doorTimer > 0

set doorTimer to doorTimer - getSecondsPassed

elseif GetOpenState == 1 ; if the door is still open

SetOpenState 0 ; close the door

set closeDoor to 0

endif

endif

End

 

Begin OnActivate

if GetOpenState == 3 ; if the door is closed

 

set doorTimer to 5

set closeDoor to 1

 

endif

Activate

End

Link to comment
Share on other sites

Try this:

(I haven't tested it myself yet, as I'm not on a PC at the moment.)

 

float doorTimer

short closeDoor

 

Begin GameMode

if closeDoor == 1

if doorTimer > 0

set doorTimer to doorTimer - getSecondsPassed

elseif GetOpenState == 1 ; if the door is still open

SetOpenState 0 ; close the door

set closeDoor to 0

endif

endif

End

 

Begin OnActivate

 

set rUser to GetActionRef

 

if (rUser == Player)

Activate

else

;Only check the door between HiddenValley01 and 02

if (GetSelf == vHVLevel02MainDoorREF) || (GetSelf == vHVLevel01DownstairsDoorREF)

 

;Check if they are in combat

if (rUser.IsInCombat)

;If they are, stop combat and don't let them use the door.

rUser.StopCombat

return

else

;They aren't, so let them go.

activate

endif

else

Activate

endif

endif

if GetOpenState == 3 ; if the door is closed

 

set doorTimer to 5

set closeDoor to 1

endif

Activate

 

End ;OnActivate

Link to comment
Share on other sites

Open the Script Editor, click the Red Cross, and double-click the script you want to delete. It may look like it does nothing, but the next time you load your mod, it should be gone. :)
Link to comment
Share on other sites

  • Recently Browsing   0 members

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