I made a big gate and I don't want to use a key to open it as we have enough items already.
I like to have a cd-key check on the one who tries to open the door.
If the cd-key matches the door will unlock and open.
I made one like this:
void main()
{
object oOpener = GetLastUsedBy();
object oDoor = GetObjectByTag("TagOfTheDoor");
if(GetPCPublicCDKey(oOpener) == "xxx"||
GetPCPublicCDKey(oOpener) == "xxx")
{
SetLocked(oDoor, FALSE);
ActionOpenDoor(oDoor);
}
else
{
SetLocked(oDoor, TRUE);
}
}
the gate is locked in the beginning when the module loads.
But this script won't work as the closed door won't open.
What did i do wrong?
I placed this script in "OnUserDefined" and the gate is an area-placeable