Author Topic: Trapdoor Script?  (Read 409 times)

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« on: August 24, 2011, 06:13:33 pm »


               Does anyone know the name of the default script Bioware made for the trap doors? I looked up the trap door placable thinking it already had the script setup, but it doesn't.

Thanks! 
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Trapdoor Script?
« Reply #1 on: August 24, 2011, 06:43:17 pm »


               It uses a couple for the different components.

www.nwnlexicon.com/compiled/tutorial.grimlar-guidetosecretdoors.html
               
               

               


                     Modifié par GhostOfGod, 24 août 2011 - 05:43 .
                     
                  


            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« Reply #2 on: August 24, 2011, 08:22:28 pm »


               So if i only want a trap door thats visible, i just need to assign nw_o2_trapdoor to it's OnUsed event, right? From what i gather on the comments, it takes the PC to the waypoint tagged. I tried doing that with the script the CRP trap doors from the CEP have and it didn't work, dunno...maybe i was doing it wrong.

I'll give this one a try when i get home later.

Thanks!
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« Reply #3 on: August 25, 2011, 12:54:14 am »


               Doesn't work...

How can i make a trap door with a simple waypoint destination? i don't want it to be hidden or anything.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Trapdoor Script?
« Reply #4 on: August 25, 2011, 12:58:38 am »


               what script are you trying to use?

edit: It looks like nw_o2_trapdoor  will work.
               
               

               


                     Modifié par Lightfoot8, 25 août 2011 - 12:06 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Trapdoor Script?
« Reply #5 on: August 25, 2011, 02:43:20 am »


               Hmm. This is one I made. The first time the player uses the trapdoor, it opens. Then they click it again and they will teleport/jump to the destination. It also has an autoclose option. Could give it a try:


void main()
{
    object oPC = GetLastUsedBy();
    int iOpen = GetIsOpen(OBJECT_SELF);
    object oDestWP = GetObjectByTag("DESTWP_" + GetTag(OBJECT_SELF));

    if (iOpen == TRUE)
    {
        object oMember = GetFirstFactionMember(oPC);
        while (GetIsObjectValid(oMember))
        {
            if (oMember == oPC || GetMaster(oMember) == oPC)
            {
                if (GetIsObjectValid(oDestWP))
                AssignCommand(oMember, ActionJumpToObject(oDestWP));
            }
            oMember = GetNextFactionMember(oPC);
        }
    }

    else
    {
        AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW));
        DelayCommand(1.0, ActionPlayAnimation(ANIMATION_PLACEABLE_OPEN));
        //For autoclose function uncomment line below:
        //DelayCommand(10.0, ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE));
    }
}

It requires that you give your trap door and destination waypoints unique tags. For this example we'll say the trapdoor tag is "TEST_TD". Then give the destination waypoint the tag "DESTWP_TEST_TD".

Hope this works for you. Good luck.
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« Reply #6 on: August 25, 2011, 03:32:28 am »


               That one seems to work GhostOfGod, is there any particular reason we have to give the trap door placable a unique tag? Can't a simpler oTarget = GetWaypointByTag be used?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Trapdoor Script?
« Reply #7 on: August 25, 2011, 04:16:57 am »


               You could do that. I'm just used to making reusable scripts. This way if you want to make more trapdoors in the future you can use this same script. If you use the GetWaypointByTag and want to make other trap doors, you will have to make a new script for each one with a different waypoint tag. Unless of course you did some type of naming convention like I did with the GetObjectByTag. And then you would just be doing the same thing I just did but with a different function. But that would also work for reusability.

You could also set a string variable on the trap door. Something like "MY_DEST_WP", "TD_WP_1" and then retrieve that to get your destination WP. Again it is just to make it so you only ever need the one script.
               
               

               


                     Modifié par GhostOfGod, 25 août 2011 - 03:29 .
                     
                  


            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« Reply #8 on: August 25, 2011, 06:35:57 am »


               Ahh, ok...gotcha. So all i have to do is change the waypoint tag and thats it? i.e DESTWP_Tag1, DESTWP_Tag2, etc?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Trapdoor Script?
« Reply #9 on: August 25, 2011, 07:09:54 am »


               Yep. That should be all you need to do.
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Trapdoor Script?
« Reply #10 on: August 25, 2011, 07:10:43 am »


               Thanks!