Author Topic: Script Request for CEP Door Placable  (Read 779 times)

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Script Request for CEP Door Placable
« on: September 07, 2011, 03:40:19 am »


               Is there any way to make the CEP doors, for example the Doorway under Custom > Civilization Exterior > Buildings > Doors have an open/close animation like a normal door?

If so, i'm looking for a script that when the door opens, the player is teleported to a waypoint (this, should obviously, be delayed by a second or two so that the door is seen opening '<img'> ) and then the door closes again.

Could anyone help out here? '<img'>

Thanks! 
               
               

               
            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #1 on: September 07, 2011, 05:50:35 am »


               Try looking at the scripts for a regular door and add the same script in the same slot to your cep door.It might work.
               
               

               


                     Modifié par Builder_Anthony, 07 septembre 2011 - 04:51 .
                     
                  


            

Legacy_Axe_Murderer

  • Full Member
  • ***
  • Posts: 199
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #2 on: September 07, 2011, 04:32:38 pm »


               PlayAnimation( ANIMATION_DOOR_OPEN1 );
or maybe
DoDoorAction( oCEPDoor, DOOR_ACTION_OPEN );
should make the animation go if there is one.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #3 on: September 07, 2011, 05:38:40 pm »


               Try this: http://pastebin.com/YXJ3NMiT

Its the script I wrote for handling placeable doors with additional features:

1) since this script is required in OnUsed even it allows to use UserDefined event for custom scripting, it fires UserDefined when used, opened, closed, teleported, or failed to open
2) it allows traps/locks to behave properly, if doors are trapped you cant open them, if they are locked, you cant open them unless you have right key
3) it has automatical closing mechanism and it also open (nearest) opposite door when you open them
4) its able to automatically lock door (note value 7 wont work as its dependant on custom OnExit script for each area)
5) if the target WP is in same area it teleports all your associates to that target as well
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #4 on: September 07, 2011, 06:38:09 pm »


               @Builder_Anthony: Doors, by default, only have an OnDeath script from what i can gather.

@Axe_Murderer: Neither method seems to work, i tried both and they did not give the placable door an animation.

@ShaDoOoW: Thanks, but that does not work either.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #5 on: September 07, 2011, 08:40:53 pm »


               The 3 default CEP door scripts are:

OnDeath: zep_doorkill
OnHearbeat: zep_doorspawn
OnUsed: zep_openclose

You will have to alter the OnUsed most likely if you want it to act as a transition. The top of the zep_openclose script explains how the doors work as far as opening and closing them gos.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #6 on: September 07, 2011, 08:46:05 pm »


               

Shiek2005 wrote...

@ShaDoOoW: Thanks, but that does not work either.


What do you mean doesnt work? I dont want to have a stupid questions but do you know what to do with it? How to add it into module/where to set this script/how to set up variables. Im using this script and it does work. Truth I have changed it a bit (removed my includes added my functions into script) but it should work.
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #7 on: September 07, 2011, 10:25:33 pm »


               

GhostOfGod wrote...

The 3 default CEP door scripts are:

OnDeath: zep_doorkill
OnHearbeat: zep_doorspawn
OnUsed: zep_openclose

You will have to alter the OnUsed most likely if you want it to act as a transition. The top of the zep_openclose script explains how the doors work as far as opening and closing them gos.


Stupid question, but this is my first time doing this, so i'm not familiar with it.

I'am using the door called "Doorway", how do i know which Gateblock is the appropriate one for this particular door?

@ShaDoOoW: I mean it doesn't work, as in it doesn't give my door an open/close animation, if it doesn't do that, for my needs, it does not work

I didn't mess with the variables, but from you mentioned, it goes on OnOpen with capabilities to support the use of OnUserDefined scripts.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #8 on: September 07, 2011, 10:52:14 pm »


               I don't think that particular door is supported by this system. It probably does not have an animation for it. All the ones that are supported and have animations, already have the scripts set up on them and have a variable on them to determine which gate block to use.

What you could do though is change its appearance to "Door: Basic 1(-5) (NWN2)".  These doors were made so that when rotated they turn on the side of the door, not in the middle. So you can fake an animation by making a script that rotates the door (SetFacing) and plays a sound.

I used something like this (found in my test mod but didn't retest) but I can't remember if it works or not. Been a long time since I messed with this but I had the same problem you are having.  Hopefully it helps. It could always be altered or streamlined or what not. You would need to make a waypoint to travel to that has the same tag as the door itself.


void AutoClose()
{
    if (GetLocalInt(OBJECT_SELF, "OPEN") == TRUE)
    {
        SetFacing(GetFacing(OBJECT_SELF) + 90.0);
        PlaySound("as_dr_woodmedcl1");
        SetLocalInt(OBJECT_SELF, "OPEN", FALSE);
    }
}
void main()
{
    object oPC = GetLastUsedBy();
    int iOpen = GetLocalInt(OBJECT_SELF, "OPEN");
    float fFace = GetFacing(OBJECT_SELF);
    if (GetLocked(OBJECT_SELF) == TRUE)
    {
        PlaySound("as_dr_locked1");
        FloatingTextStringOnCreature("*locked*", oPC, TRUE);
        return;
    }
    if (iOpen != TRUE)
    {
        PlaySound("as_dr_woodmedop1");
        SetFacing(fFace - 90.0);
        SetLocalInt(OBJECT_SELF, "OPEN", TRUE);
    }
    else
    {
        string sSelf = GetTag(OBJECT_SELF);
        object oDest = GetWaypointByTag(sSelf);
        AssignCommand(oPC, ActionJumpToObject(oDest));
        PlaySound("as_dr_woodmedcl1");
        SetFacing(fFace + 90.0);
        SetLocalInt(OBJECT_SELF, "OPEN", FALSE);
    }
    DelayCommand(10.0, AutoClose());
}
               
               

               


                     Modifié par GhostOfGod, 07 septembre 2011 - 10:11 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #9 on: September 07, 2011, 10:59:07 pm »


               <delicately painting...>

GhostOfGod wrote...

I don't think that particular door is supported by this system. It probably does not have an animation for it. All the ones that are supported and have animations, already have the scripts set up on them and have a variable on them to determine which gate block to use.


What about using a default door and changing the appearance?
(I haven't fooled around much with doors, yet :-P Too many other pots to stir :-)

<...his signature on some else's masterpiece>
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #10 on: September 07, 2011, 11:15:25 pm »


               

Rolo Kipp wrote...

<delicately painting...>

GhostOfGod wrote...

I don't think that particular door is supported by this system. It probably does not have an animation for it. All the ones that are supported and have animations, already have the scripts set up on them and have a variable on them to determine which gate block to use.


What about using a default door and changing the appearance?
(I haven't fooled around much with doors, yet :-P Too many other pots to stir :-)

<...his signature on some else's masterpiece>


Well the thing with the CEP doors that are supported by this system is that you can walk through the doors themselves and each one has it's own matching "gateblock" that is basically just an invisible object that matches the width of the door. When the door is closed the invisible object is spawned to prevent people from walking through the door. So if you alter the appearance you might have a mismatched width for the gateblock and I'm not entirely sure how the animations will react by changing appearances either.
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #11 on: September 07, 2011, 11:24:17 pm »


               

Rolo Kipp wrote...

<delicately painting...>

GhostOfGod wrote...

I don't think that particular door is supported by this system. It probably does not have an animation for it. All the ones that are supported and have animations, already have the scripts set up on them and have a variable on them to determine which gate block to use.


What about using a default door and changing the appearance?
(I haven't fooled around much with doors, yet :-P Too many other pots to stir :-)

<...his signature on some else's masterpiece>


The problem is that i'm trying to place a door in an exact position as oppossed to a doorway tile opening.

Can anyone point me towards where the CEP doors are? Under "doors" i can't find anything suitable so far o.O
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #12 on: September 07, 2011, 11:36:46 pm »


               <reaching in to a tall hat...>

Shiek2005 wrote...
The problem is that i'm trying to place a door in an exact position as oppossed to a doorway tile opening.

Have you tried the trick of putting in a door tile, adding the door, using "Adjust Location" to move the door to the precise place/orientation you want and deleting the doorway tile?

There was a tutorial somewhere... (Toolset Guide?) titled "How to make a free-standing door"

Or something like that..

I've used it to embed a vertical area transition in the side of an old tree...

<...and squealing in fright at whatever it was that licked his fingers>
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #13 on: September 08, 2011, 12:04:48 am »


               That works quite nicely Rolo, thanks.

One more question, are there any appropriate doors for the [NWN2] Building - Market 01 - 05 which can be found in Civilization Exterior > Buildings > Market? I tried browsing through the door models, but so far all of them are too big '<_<'
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Script Request for CEP Door Placable
« Reply #14 on: September 08, 2011, 02:14:49 am »


               

GhostOfGod wrote...

What you could do though is change its appearance to "Door: Basic 1(-5)
(NWN2)".  These doors were made so that when rotated they turn on the
side of the door, not in the middle. So you can fake an animation by
making a script that rotates the door (SetFacing) and plays a sound.


If you're not sure how to change a door appearance. Just grab that "Doorway" that you were using and place one in the toolset. Open up it's properties. Now in the first tab you see (Basic) you will see a line for Appearance Type with a drop down menu. Click the arrow and scroll to the doors. Change it to whatever appearance you want and then place the door wherever you want.

However, again, not all doors come with open and close animations. The only CEP doors that have pre-made animations are the ones in your blueprints/placeables with scripts and varaibles already attached to them. If you want to use a different door appearance you will have to make your own script to fake the animation.
               
               

               


                     Modifié par GhostOfGod, 08 septembre 2011 - 01:20 .