Author Topic: smart trainsitions  (Read 396 times)

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
smart trainsitions
« on: August 22, 2011, 04:02:54 am »


               I am not sure how to state this but I do remember seeing a post for this on the Vault though now  I can't find it. 

What I am looking for is transitions that are if placed across the edge of an area will cause you to arrive in the same coordinate on the other side of the transition. 

so if you enter a transition here in area 1
                                      x    <--------------------(pc postiion)
--------------------------------------
|                                                 |      <--------------- (trigger)
--------------------------------------
in area 2 you end up here
--------------------------------------
|                                                 |
--------------------------------------
                                      x

I hope that his makes sense '<img'>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
smart trainsitions
« Reply #1 on: August 22, 2011, 04:14:31 am »


               Do you remember moondrake's desert of desolation module? He used this method in the desert. if you contacted him at robinson's workshop you could probably get his latest version of the module.

[edit]
That said... I think this system would not be too hard to do using vectors.
               
               

               


                     Modifié par henesua, 22 août 2011 - 03:15 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
smart trainsitions
« Reply #2 on: August 22, 2011, 04:35:33 am »


               This is my function for it.  I regret at times not putting better documenting into my code, but it works for n/s or e/w, you just have to feed the proper type into it.

location FB_GetMatchingTargetLocation (object oTarget, object oWP, int nType)
{
 vector vTarget = GetPosition (oTarget);
 vector vWP     = GetPosition (oWP);
 float fTargetX = vTarget.x;
 float fTargetY = vTarget.y;
 float fTargetZ = vTarget.z;
 float fWPX = vWP.x;
 float fWPY = vWP.y;
 float fWPZ = vWP.z;
 location lWP;
 object oArea  = GetArea   (oWP);
 float  fAngle = GetFacing (oTarget);
 vector vPosition;
 if (nType == 1)
    {
     vPosition = Vector (fTargetX, fWPY, fWPZ);
    }
 else if (nType == 2)
    {
     vPosition = Vector (fWPX, fTargetY, fWPZ);
    }
 lWP = Location (oArea, vPosition, fAngle);
 return lWP;
}


This is the trigger script, placed into a transition with no specified target.

// (5/18/2011) Failed Bard
// Long transition script.

void main()
{
 int    nType = 1;
 string sWP_NS = GetLocalString (OBJECT_SELF, "WP_TARGET_NS");
 string sWP_EW = GetLocalString (OBJECT_SELF, "WP_TARGET_EW");
 object oWP = GetObjectByTag (sWP_NS);
 if (!GetIsObjectValid (oWP))
    {
     oWP   = GetObjectByTag (sWP_EW);
     nType = 2;
    }
 // if neither is present just exit.
 if (!GetIsObjectValid (oWP)) return;
 object oTarget = GetEnteringObject();
 if (GetIsObjectValid (GetMaster (oTarget)) &&
     GetArea (GetMaster (oTarget)) == GetArea (oTarget)  )
    {
     return;
    }
 location lWP = FB_GetMatchingTargetLocation (oTarget, oWP, nType);
 AssignCommand (oTarget, JumpToLocation (lWP));
}


It's not perfect though.  Even though it goes into the OnEnter of the transition, I've had issues getting it to work for PCs walking into it in my mod.  It works fine for them clicking on it, or NPCs walking into it, so I never figured out the problem.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
smart trainsitions
« Reply #3 on: August 22, 2011, 04:56:46 am »


               One from the vault:
http://nwvault.ign.c...ts.Detail&id=89