Aller au contenu

Photo

Can I change the area transition trigger to something else after a certain point?


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

#1
andysks

andysks
  • Members
  • 1 651 messages

Hi all. So I have this situation, where you reach a place, through another place. All in one module here. More clear, there's a city, you transit to another area, and from that area to the next. Now, the middle one, shouldn't be accessible after you reach the final, and therefore from the final the trigger leads back to the city. But I was wondering, how I can make it so that you can reach this final area again if you actually go once back to the city?

 

Does this make sense? :D.

 

In transitioning it could look like this:

 

Area1>>>Area2>>>Area3

Area3>>>Area1

 

After this:

 

Area1>>>Area3



#2
4760

4760
  • Members
  • 1 212 messages

I use a similar principle in my campaign (depending on previous actions by the PC), but to achieve the results I wanted I use a trigger (which executes when the party tries to open the dear leading out).

 

I guess in your case you could use a script like the following one, executed when the PC enters a trigger located at the 

void main()
{
	object oPC = GetFirstPC();
	object oArea = GetArea(oPC);
        string sAreaTag = GetTag(oArea);
        int nJustArrived = GetLocalInt(oArea, "nJustArrived");
        // if we enter the trigger area coming from Area2, of course we don't want to go back to Area1. So let's just flag we arrived and do nothing else.
        if (nJustArrived == 0)
        {
            SetLocalInt(oArea, "nJustArrived", 1);
        }
        else
        {
	    if (sAreaTag == "Area3") // shouldn't be needed, since the trigger is only in Area3.
	    {
                SetLocalInt(oArea, "nJustArrived", 0); // moving back to Area1, we tell the engine we're not in Area3 any more
		object oWaypoint = GetObjectByTag("WP_Arrival_From_Area3"); // of course, this means there's a waypoint in Area1 where the party can go to!
		AssignCommand(oPC, ActionJumpToLocation(GetLocation(oWaypoint)));
	     }
        }
}

But maybe this one is more re-useable:

void main()
{
    object oPC = GetEnteringObject();
    if (oPC != GetFirstPC()) return; // we don't want other creatures wandering to Area1!
    object oArea = GetArea(oPC);
    int nJustArrived = GetLocalInt(oArea, "nJustArrived");
    // if we enter the trigger area coming from Area2, of course we don't want to go back to Area1. So let's just flag we arrived and do nothing else.
    if (nJustArrived == 0)
    {
        SetLocalInt(oArea, "nJustArrived", 1);
    }
    else
    {
        SetLocalInt(oArea, "nJustArrived", 0); // moving back to Area1, we tell the engine we're not in Area3 any more
string sLeadsTo = GetLocalString(oArea ,"sLeadsTo");

object oWaypoint = GetObjectByTag("sLeadsTo"); AssignCommand(oPC, ActionJumpToLocation(GetLocation(oWaypoint)))
}

}

Of course, it means the string variable sLeadsTo is defined in the area's properties, and set to the name of the waypoint to go to from Area3.


#3
kevL

kevL
  • Members
  • 4 070 messages

Here's an abstraction similar to 4760's method:


script the transitions manually, using onClicked or so.

in onEnter of the third area, set a flag (local_int on the Module perhaps) that your transition script will detect and hence shunt the characters through to the first/third areas. Eg,


if (Flag)
{
    if (getCurrentArea==third)
        JumpTo(object_in_first_area)
    else if (getCurrentArea==first)
        JumpTo(object_in_third_area)
}
else
{
    if (getCurrentArea==first)
        JumpTo(object1_in_second_area)
    else if (getCurrentArea==third)
        JumpTo(object2_in_second_area)
}



#4
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests

If there's a journal involved then this'll do it.

 

object oDeny;
string sDeny;
/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.c...&id=4683&id=625    */
//Put this script OnClick or OnFailToOpen
void main()
{
object oPC = GetClickingObject();
if (!GetIsPC(oPC)) return;
int nInt;
nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYvillage");
if (nInt <1)
   {
   FloatingTextStringOnCreature("Nothing this way yet",oPC);
   return;
   }
nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYvillage");
if (nInt < 6)
   {
   oDeny = GetWaypointByTag("wp_orccamp_1");
   AssignCommand(oPC, JumpToObject(oDeny));
   return;
   }
nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYvillage");
if (nInt =6)
   {
   oDeny = GetWaypointByTag("wp_slaver_camp");
   AssignCommand(oPC, JumpToObject(oDeny));
return;
   }
}

 

Courtesy of Lilac Soula nd tested thoroughly in my module with no complaints or bugs ever reported.



#5
andysks

andysks
  • Members
  • 1 651 messages

And these lines nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYvillage"); actually worked? Weird they never do for me. I always use

 

int iJournalEntry = GetJournalEntry("qu_dr_tablet", oPC);
    {
    if(iJournalEntry == 31)  

 

Anyways, some of all these should do. Thanks a lot.



#6
Tchos

Tchos
  • Members
  • 5 063 messages

I can confirm from my tests that the AddJournalQuestEntry and GetJournalEntry functions simply set and get local ints to the main PC with the name of the integer being NW_JOURNAL_ENTRY+[quest tag].  In my test, I used the AddJournalQuestEntry to set a quest stage to 50, then checked the stage using a GetLocalInt function, and it reported the correct stage.



#7
rjshae

rjshae
  • Members
  • 4 497 messages

I have an obtuse question: can you move (destroy/create) a transition Waypoint destination to a different area and thereafter have the door transition shift to that location? Or does it cache the location so you can't change it?



#8
PJ156

PJ156
  • Members
  • 2 985 messages

Use a conversation :)

 

PJ



#9
kamal_

kamal_
  • Members
  • 5 254 messages

I have an obtuse question: can you move (destroy/create) a transition Waypoint destination to a different area and thereafter have the door transition shift to that location? Or does it cache the location so you can't change it?

The Stronghold in the OC uses scripts on the doors to handle transitioning from one door to multiple areas, it's used when rebuilding the buildings.



#10
andysks

andysks
  • Members
  • 1 651 messages

That's actually true kamal_. Like the tower, you wanna give it to the guards or the mages? Then it transits accordingly.

PJ: It doesn't fit unfortunately :).

rjshae : I have no idea but I guess not. Otherwise what I do, placing a dynamic collision placeable on them to hide them, then destroying it, is a waste :D.



#11
kevL

kevL
  • Members
  • 4 070 messages

rjshae : I have no idea but I guess not. Otherwise what I do, placing a dynamic collision placeable on them to hide them, then destroying it, is a waste :D.


there's gotta be an easier way ...   :pinched:



#12
andysks

andysks
  • Members
  • 1 651 messages

It's ok sometimes it fits the plot :D. Like a snow boulder on it indicates that the way is blocked. On another one leading to the desert I have a collision box that is usable and has an one liner convo saying : "You don't know your way through the desert yet". So when you get a map, or the way is unblocked these get destroyed.



#13
kevL

kevL
  • Members
  • 4 070 messages

ah.. i was getting images of collision boxes on top of waypoints and PCs flying through the air ....

 

/better now.



#14
rjshae

rjshae
  • Members
  • 4 497 messages

rjshae : I have no idea but I guess not. Otherwise what I do, placing a dynamic collision placeable on them to hide them, then destroying it, is a waste :D.

 

Perhaps it's worth a test just to see? Even if it is cached (which it might not be), I suspect an area transition may clear it.



#15
Tchos

Tchos
  • Members
  • 5 063 messages

In a test I just did with destroyed/recreated waypoints at different locations with the same tag, the standard JumpToObject function sent the PC to the new locations.  The PC-only Area Transition Trigger blueprint uses a script that uses JumpToObject, so it would presumably work for the other "jump" functions.  I don't believe it caches the location.


  • rjshae aime ceci

#16
bealzebub

bealzebub
  • Members
  • 352 messages

I ran into this same problem, and found a script somewhere that changes transition destinations with variables. I'll dig it out tonight. I remember you had to change both the onenter and onclicked



#17
bealzebub

bealzebub
  • Members
  • 352 messages
// Put this onenter


// Script: cond_area_trans2.nss
// Author: Trinity
// Date: 20 November 2002
//
// This script goes into the On Enter script for the 
// area transition trigger. Some people just enter 
// AT triggers.
//
void main()
{
// Assign the variables.
object oPC = GetEnteringObject();
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 != 1)
{
    AssignCommand(oPC, JumpToObject(oWP1));
}
else
{
    AssignCommand(oPC, JumpToObject(oWP));
}
}
// Put this onclick


// 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 != 1)
{
    AssignCommand(oPC, JumpToObject(oWP1));
}
else
{
    AssignCommand(oPC, JumpToObject(oWP));
}
}

just set a local Int on your module called iVar to 1 when you want to change destinations.

I can't remember where this script came from.