Aller au contenu

Photo

Trapdoor Script?


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
Shiek2005

Shiek2005
  • Members
  • 104 messages
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! 

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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 .


#3
Shiek2005

Shiek2005
  • Members
  • 104 messages
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!

#4
Shiek2005

Shiek2005
  • Members
  • 104 messages
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.

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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 .


#6
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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.

#7
Shiek2005

Shiek2005
  • Members
  • 104 messages
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?

#8
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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 .


#9
Shiek2005

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

#10
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Yep. That should be all you need to do.

#11
Shiek2005

Shiek2005
  • Members
  • 104 messages
Thanks!