Author Topic: Scripting door going to two different areas  (Read 1152 times)

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Scripting door going to two different areas
« on: August 19, 2010, 11:58:32 pm »


               I think I know the answer (or at least the basics) to this question, but let me get some feedback.

I want to have a building that is ruined inside to begin with - a desecrated temple/church building.
So the char goes in, sees the desecration then gets quest.
Once they complete the quest - the church is restored.  So when the next enter the same building, they will enter another interior area that looks much the same except brighter, repaired, etc.

Best way to do this?

Thanks in advance.
               
               

               
            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Scripting door going to two different areas
« Reply #1 on: August 20, 2010, 12:26:02 am »


               What I'd do is put in an invalid target tag for the area transition to the temple so that although the blue highlight appears, it won't take you anywhere by default. Then what you do is have an OnAreaTransitionClick script for the door which has a script which will teleport the PC to one of the two areas depending on the status of the quest. So basiaclly, something like this:

void main()
{
    object oPC = GetClickingObject();

        if (GetLocalInt(oPC, "APPROPIATE_VARIABLE_NAME_HERE") ==1) // Or whatever number
        {
                AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("WAYPOINT_TAG_HERE"))));
        }
        else
        {
                AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("OTHER_WAYPOINT_TAG_HERE"))));
        }
}

As you may have guessed, you're going to need to put two waypoints with different tags where the player can end up by using the transition. After the quest's completion, you will want to set the local integer variable that is used in the script to the number required to make the script take you to the other area - namely "1" in the above example.
               
               

               


                     Modifié par C Writer, 19 août 2010 - 11:27 .
                     
                  


            

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Scripting door going to two different areas
« Reply #2 on: August 23, 2010, 09:18:47 pm »


               I think I've got it- thanks C Writer.
               
               

               
            

Legacy_Vipre

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Scripting door going to two different areas
« Reply #3 on: September 01, 2010, 06:52:29 pm »


               A thank you from me as well C Writer, I've been wondering how to do this for a while.