Code: Select all
void main()
{
string sGateBlock = GetLocalString(OBJECT_SELF, "CEP_L_GATEBLOCK");
location lSelfLoc = GetLocation(OBJECT_SELF);
int nIsOpen = GetIsOpen(OBJECT_SELF);
if (GetLocked(OBJECT_SELF) == 1){
//FloatingTextStringOnCreature("Locked", OBJECT_SELF);
string sLockedMSG = GetStringByStrRef(nZEPDoorLocked,GENDER_MALE);
SpeakString(sLockedMSG);
return;
}
//if the object is locked, it cannot be opened or closed
if (nIsOpen == 0) //if the item is a door
{
object oSelf = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_OPEN);
if (GetLocalObject(oSelf, "GateBlock")!= OBJECT_INVALID)
{
DestroyObject(GetLocalObject(oSelf, "GateBlock"));
SetLocalObject(oSelf, "GateBlock", OBJECT_INVALID);
DelayCommand(3.0, PlayAnimation(ANIMATION_PLACEABLE_CLOSE));
DelayCommand(3.0, SetLocalObject(oSelf, "GateBlock", CreateObject(OBJECT_TYPE_PLACEABLE, sGateBlock, lSelfLoc, FALSE)));
}
}
else
{
object oSelf = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_CLOSE);
SetLocalObject(oSelf, "GateBlock", CreateObject(OBJECT_TYPE_PLACEABLE, sGateBlock, lSelfLoc));
}
}

So I got two questions:
1. Has anyone a 'clean' working open-auto-close script for CEP doors? (or know how to script one)
2. Is there anyway to get the Gateblock to spawn on the door (before the door has been used) without using a dreaded heartbeat script?