Jump to content

A script doesn't work with custom doors, but works with original o


DavideMitra

Recommended Posts

Hi! In the internet I found a script that relocks a door after a second.

 

I tried it on an already existing door, and it worked perfectly (it was a Leyawiin interior medium door).

I created a custom door (it is the same of the other door, but it has a different name.."main house door"), I tried the script on this door, but it doesn't work..what's wrong?..thanks for the help!

 

 

Oh..I was forgetting xD..This is the script, it doesn't have any reference, because you have to apply it where you want. So, this isn't a reference problem...

 

 

scriptname MyDoorAutoCloseScript

float timer

short doWhat

 

Begin GameMode

if getopenstate != 1

if timer > 0

set timer to timer - getsecondspassed

else

if doWhat == 0

set timer to 5

set doWhat to 1

elseif doWhat == 1

setopenstate 0

set timer to 3

set doWhat to 2

elseif doWhat == 2

lock 100

set doWhat to 0

endif

endif

endif

End

Link to comment
Share on other sites

If the script is being written for a door, why not use the OnActivate block instead of a GameMode block? This way the script is executed when the door is activated instead of running every frame to see if the door is open or not.

 

Edit: I would also like to add that the game engine doesn't take kindly to the "!=" expression. Instead I would just simply put

if getopenstate == 0

Edited by kingtitan
Link to comment
Share on other sites

  • Recently Browsing   0 members

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