Server Totals
M'Chek - (4)
Wilderness - (1)
Elysia - (1)
Ferrell - (0)
Le'Or - (0)
Deglos - (0)
Visimontium - (0)
Underdark - (0)
Mikona - (0)
Total players: 6
Gallery

Links Menu

CEP Doors: Auto close problem

Moderators: Nighthawk4, Dungeon Masters

CEP Doors: Auto close problem

PostAuthor: 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
Moredo
CCC
CCC
 
Posts: 7396
Joined: Mon May 26, 2003 3:47 pm
Location: Norway (GMT +2)
Timezone: +2

Re: CEP Doors: Auto close problem

PostAuthor: 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
p0m
Scholar
 
Posts: 1366
Joined: Tue May 10, 2005 12:02 am
Location: Brisbane, Australia
Timezone: +10
DM Avatar: Wintermute

PostAuthor: 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]
User avatar
NecroZombie
Team Member; Retired with Honors
 
Posts: 2744
Joined: Tue May 11, 2004 10:28 pm
Location: The Republic of Texas
Timezone: GMT -5

PostAuthor: 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
Moredo
CCC
CCC
 
Posts: 7396
Joined: Mon May 26, 2003 3:47 pm
Location: Norway (GMT +2)
Timezone: +2

PostAuthor: 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.
User avatar
CPU
Team Member; Retired with Honors
 
Posts: 5163
Joined: Sat Apr 05, 2003 4:27 pm
Location: NY. USA (-4GMT)

PostAuthor: 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
Moredo
CCC
CCC
 
Posts: 7396
Joined: Mon May 26, 2003 3:47 pm
Location: Norway (GMT +2)
Timezone: +2

PostAuthor: 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 (b. 1942) --


Sprucing up ye olde NWN | Modifying nwn.ini and nwnplayer.ini | ~Rare Items Wanted~ | Stealth Modifiers
User avatar
Gorgon
QA's 2nd|CCC Mobster
QA's 2nd|CCC Mobster
 
Posts: 5866
Images: 38
Joined: Fri Oct 17, 2003 10:14 pm
Location: Vancouver, BC, Canada
Timezone: PDT -7


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]