Jump to content

Door script.


cynderdragon

Recommended Posts

This script controls a door in my "fallout idiot box" mod.

 

 

The problem is, the script can be spammed even though the door has done what the script says. How can I fix this?

 

Script:

scn aaadumdumdooraccess

 

Short activealready ; is the script already running?

Short havegumgum

short doorstatus ;1 open, 0 closed

short gumbypass

float timer

 

;Failsafe

Begin OnActivate

If (activealready == 1)

endif

End

 

;Door control

Begin OnActivate

ShowMessage aaagumgumquestion

ShowMessage aaagumgumquestion1

 

If (activealready == 0 && player.GetItemCount aaav88bubblegum>10)

If (activealready == 0 && player.GetItemCount bubblegum>10)

Set havegumgum to 1

Else

Set havegumgum to 0

Endif

Endif

 

If (havegumgum == 1 && activealready == 0)

ShowMessage aaagumgumYes

if (player.GetItemCount aaav88bubblegum>10)

player.removeitem aaav88Bubblegum 10

Set doorstatus to 1

Set activealready to 1

Set timer to 0

Set gumbypass to 1

Activate

else

Set doorstatus to 0

Set activealready to 1

Set timer to 0

Set gumbypass to 0

Endif

Endif

 

if (gumbypass == 0 && player.GetItemCount bubblegum>10)

player.removeitem Bubblegum 10

Set doorstatus to 1

Set activealready to 1

Set timer to 0

Set gumbypass to 1

Activate

else

Set doorstatus to 0

Set activealready to 1

Set timer to 0

 

Endif

 

 

If (havegumgum == 0 && activealready == 0)

ShowMessage aaagumgumNo1

ShowMessage aaagumgumNo2

Set doorstatus to 0

Set activealready to 0

Endif

 

;door reset once the player has opened the gumgumdoor.

If (activealready == 1 && doorstatus == 1)

if (timer<10)

set timer to timer + getSecondsPassed

Else

activate

;turns off the script failsafe.

Set timer to 0

Set doorstatus to 0

Set activealready to 0

Set gumbypass to 0

 

endif

endif

End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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