Page 1 of 1

CEP Doors: Auto close problem

PostPosted: Tue Aug 08, 2006 9:02 pm
Author: Moredo
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));
    }
}


This is bascially your regular zep_openclose script, except that I've added two lines - the DelayCommand ones. It works.. but it's buggy. Sometimes the Gateblock won't go away when you open the door, and I can't understand why. :?

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?

Re: CEP Doors: Auto close problem

PostPosted: Tue Aug 08, 2006 9:07 pm
Author: p0m
Moredo wrote:<codesnip>
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?


I'm not sure of the answer for number 1, however for 2.. you could use triggers and a CreateObject using a waypoint where the gateblock should be. Although, triggers are messy when psions are included.

PostPosted: Tue Aug 08, 2006 9:10 pm
Author: NecroZombie
Mor,

Look in the Mikona mod and on The Clandestine (PE's boat). I can't remember if it is on the lower deck, or tween deck... but CPU has a CEP gate working there. Maybe you could peek at the script and see what he did.

[hijack]BTW - The Clandestine is probably the most impressive build I've seen in NWN. Cheers CPU!!! [/hijack]

PostPosted: Tue Aug 08, 2006 9:39 pm
Author: Moredo
@p0m, I'll test it

@NZ, I'll definately check that out

PostPosted: Tue Aug 08, 2006 10:13 pm
Author: CPU
No, I removed the heatbeat scripts: results: before you use the gate for the first time, you can literally walk right through it. once you open the gate and close it, it behaves properly. I did no other coding on that. Sorry.

[blushes]Hey, thanks for the compliments though! 8 months of building almost nearly every day! YIKES![/blushes]

PostPosted: Fri Aug 11, 2006 9:44 pm
Author: Moredo
*bump*

Anyone have an answer for my initial question? Gonna go with a one shot encounter for the second question, but I still need some help with the first.

PostPosted: Sat Aug 12, 2006 6:35 am
Author: Gorgon
I've been dying to use these doors as well, the way they were intended, so something without a heartbeat would be great. Right now they are just useless placeable to attach jump scripts to. The animations are very spiffy.