Author Topic: Scripting a Conditional Door Transition  (Read 546 times)

Legacy_white_tigress

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Scripting a Conditional Door Transition
« on: December 09, 2010, 01:10:01 am »


               Can someone PLEASE help me? I am brand new to scripting and know next to nothing about it.

I want to make a door (or ANY kind of area transition) that will transport the PC from a wizard's shack to one area BEFORE you get a journal update, and a different one AFTER you get the journal update.

I have already set up all three areas and waypoints for each of the different areas, but I can't seem to figure out how to make a good script for this. I was using Lilac Soul's script editor, but couldn't get it to work right... then I found this script on the NWN wiki, but I can't figure out how to 'fill it in'.

Thank you in advance for your help!


//
// Script: cond_area_trans1.nss
// Author: Trinity
// Date: 20 November 2002
//
// This script goes into the On Click script for the
// area transition trigger. Some people click on
// AT triggers.
//
void main()
{
// Assign the variables
object oPC = GetClickingObject();
object oWP = GetWaypointByTag("WP_AT_NEWAREA");
object oWP1 = GetWaypointByTag("WP_AT_OLDAREA");
int iVar1 = GetLocalInt(GetModule(), "iVar");
// Now we test to make sure at iVar1 is what you need to
// go into the new area. If it isn't, you go to the old.
if (iVar1 != number)
{
    AssignCommand(oPC, JumpToObject(oWP1));
}
else
{
    AssignCommand(oPC, JumpToObject(oWP));
}
}
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Scripting a Conditional Door Transition
« Reply #1 on: December 09, 2010, 01:25:06 am »


               Try something like this:

void main()
{
// Assign the variables
object oPC = GetClickingObject();
object oWP1 = GetWaypointByTag("Waypoint Tag 1 here");
object oWP2 = GetWaypointByTag("Waypoint Tag 2 here");
int iVar = GetLocalInt(oPC, "NW_JOURNAL_ENTRY" + "Journal Entry Here");

if (iVar == 1)
    {
    AssignCommand(oPC, JumpToObject(oWP1));
    }
else if (iVar == 2)
    {
    AssignCommand(oPC, JumpToObject(oWP2));
    }
}

You will need to fill in/change a couple things:
-  Enter the name of the journal/quest tag where it says "Journal Entry Here"
- Change the 1 to the appropriate value for the quest state where is says "if (iVar == 1)" (Area 1 transition)
- Change the 2 to the appropriate value for the quest state where is says "if (iVar == 2)" ((Area 2 transition)

Lastly my usual self promotion - my tutorial linked in sig below is aimed at the novice scripter and may be of help to you.
               
               

               
            

Legacy_white_tigress

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Scripting a Conditional Door Transition
« Reply #2 on: December 09, 2010, 02:40:41 am »


               THANK YOU! And thanks for the quick reply!



The transition works perfectly now! I'd spent 2 days on this... bless you!