DavideMitra Posted December 30, 2012 Share Posted December 30, 2012 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 MyDoorAutoCloseScriptfloat timershort doWhat Begin GameModeif getopenstate != 1if timer > 0set timer to timer - getsecondspassedelseif doWhat == 0set timer to 5set doWhat to 1elseif doWhat == 1setopenstate 0set timer to 3set doWhat to 2elseif doWhat == 2lock 100set doWhat to 0endifendifendifEnd Link to comment Share on other sites More sharing options...
kingtitan Posted January 4, 2013 Share Posted January 4, 2013 (edited) 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 January 4, 2013 by kingtitan Link to comment Share on other sites More sharing options...
Recommended Posts