CEP Doors: Auto close problem

Moderator: Event DM

Post Reply
Moredo
Team Member; Retired with Honors
Posts: 8339
Joined: Mon May 26, 2003 3:47 pm
Timezone: +2
Location: Norway (GMT +2)

CEP Doors: Auto close problem

Post by Moredo » Tue Aug 08, 2006 9:02 pm

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?
Always consider alignment as a tool, not a straitjacket that restricts the character.
— AD&D, 2nd Edition Player's Handbook
User avatar
p0m
Scholar
Posts: 1364
Joined: Tue May 10, 2005 12:02 am
Timezone: +10
DM Avatar: Wintermute
Location: Brisbane, Australia
Contact:

Re: CEP Doors: Auto close problem

Post by p0m » Tue Aug 08, 2006 9:07 pm

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.
Player of: Dannar Sunrise/Blighte
Gennor Visson
Jert Vilodel
User avatar
NecroZombie
Team Member; Retired with Honors
Posts: 2744
Joined: Tue May 11, 2004 10:28 pm
Timezone: GMT -5
Location: The Republic of Texas

Post by NecroZombie » Tue Aug 08, 2006 9:10 pm

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]
Moredo
Team Member; Retired with Honors
Posts: 8339
Joined: Mon May 26, 2003 3:47 pm
Timezone: +2
Location: Norway (GMT +2)

Post by Moredo » Tue Aug 08, 2006 9:39 pm

@p0m, I'll test it

@NZ, I'll definately check that out
Always consider alignment as a tool, not a straitjacket that restricts the character.
— AD&D, 2nd Edition Player's Handbook
User avatar
CPU
Team Member; Retired with Honors
Posts: 5161
Joined: Sat Apr 05, 2003 4:27 pm
Location: NY. USA (-4GMT)

Post by CPU » Tue Aug 08, 2006 10:13 pm

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]
Avlis Housing Director
PM: Avlis Player Housing
Player Housing Information - This answers most questions people have. Please read this before asking.
Moredo
Team Member; Retired with Honors
Posts: 8339
Joined: Mon May 26, 2003 3:47 pm
Timezone: +2
Location: Norway (GMT +2)

Post by Moredo » Fri Aug 11, 2006 9:44 pm

*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.
Always consider alignment as a tool, not a straitjacket that restricts the character.
— AD&D, 2nd Edition Player's Handbook
User avatar
Gorgon
Father of Avlis EE
Posts: 6637
Joined: Fri Oct 17, 2003 10:14 pm
Timezone: PST -8
Location: Vancouver, BC, Canada

Post by Gorgon » Sat Aug 12, 2006 6:35 am

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.
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --


Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
Post Reply