Hello there, good morning!
I'm trying to make a script where at night all doors automatically close and become locked, then in the morning they unlock and can be opened by NPCs, BUT after they're opened a small timer is set and after that they close again (not locking this time).
I wrote a code for one door and it works except for one thing. The door doesn't change "position" (open/closed), even though its state is changed.
Code:
func void DOORS_Loop()
{
var int BDoor_ptr; BDoor_ptr = MEM_SearchVobByName("TESTDOOR");
var oCMobDoor BDoor; BDoor = _^(BDoor_ptr);
if(Wld_IsTime(20,00,8,00))
{
BDoor._oCMobInter_rewind = 0;
BDoor._oCMobLockable_bitfield = true;
BDoor._oCMobInter_state = 0;
BDoor._oCMobInter_state_num = 0;
BDoor._oCMobLockable_pickLockStr = "LRRLLRLLRL";
}
else if(Wld_IsTime(8,01,19,59))
{
BDoor._oCMobLockable_bitfield = false;
BDoor._oCMobInter_state_num = 1;
};
if(Wld_GetMobState (hero, "TESTDOOR") == 1)
{
FF_ApplyOnceExt(CloseDoors,10000,1);
};
};
func void CloseDoors()
{
var int BDoor_ptr; BDoor_ptr = MEM_SearchVobByName("TESTDOOR");
var oCMobDoor BDoor; BDoor = _^(BDoor_ptr);
BDoor._oCMobInter_state_num = 0;
BDoor._oCMobInter_state = 0;
};
As I said, it works, the only exception is that if I open a door, it stays open, it doesn't close automatically =(