Player Resource Consortium

 

Author Topic: Climb not possible?  (Read 3893 times)

0 Members and 1 Guest are viewing this topic.

February 01, 2012, 09:50:24 AM
  • Jr. Associate
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile

Hi again guys, i dont know if this issue has already been solved or not since we are currenly running 3.5b until we get 3.5 final :P, but, we are trying to apply climb feat and we are always getting:
"The target location is too far away to climb to. Please pick a closer target."

i took a look at prc_inc_skills, under DoClimb function and it seems that sctipt is checking distance, which is ok ofc.

Quote
     int iDistance = FloatToInt(MetersToFeet(GetDistanceBetweenLocations(GetLocation(oPC), lLoc ) ) );
     
     if (iDistance > 10)
     {
          SendMessageToPC(oPC, "The target location is too far away to climb to. Please pick a closer target.");
          return FALSE;
     }

now, i think issue comes into play now when we call GetDistanceBetweenLocations, since this function also takes into acount Z axis:
http://www.nwnlexicon.com/compiled/function.getdistancebetween.html
making climb impossible since 10 feets is way too close and we dont even cover the hight one intends to climb.
acording to nwnlexicon, we could use vectors to ignore Z axis, any suggestion ?



February 01, 2012, 10:49:25 AM
Reply #1
  • Hero Member
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

I replaced that code with this function:
Code: [Select]
float GetDistanceForClimbing(object oPC, location lLoc)
{
    object oArea = GetAreaFromLocation(lLoc);
    vector vTest1 = GetPositionFromLocation(GetLocation(oPC));
    vector vTest2 = GetPositionFromLocation(lLoc);
    float fDistance = GetDistanceBetweenLocations(Location(oArea, Vector(vTest1.x, vTest1.y, 0.0), 0.0),
                                                   Location(oArea, Vector(vTest2.x, vTest2.y, 0.0), 0.0));

    return MetersToFeet(fDistance);
}
As you can see it sets Z coordinates for both locations to 0.0 and then gets the distance. I've attached a script that uses this function.


February 01, 2012, 03:54:46 PM
Reply #2
  • Jr. Associate
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile

looks good! will test it asap! thanks a lot xwarren! :D as usual


February 01, 2012, 03:56:44 PM
Reply #3
  • Jr. Associate
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile

oh, btw xwarren, i have been looking at our nwnplayer.ini and saw that there are two variables we can change in order to increase performance: 2da cache size and 2da engine cache size.
what values do you recomend for prc servers?

2DA Cache Size=10   1-??   The number of .2da files to be cached for use with Get2DAString().
(Added in patch 1.69.)
2DA Engine Cache Size=11   11-??   The number of .2da files to be cached for the use of the game engine. Editing this value might improve performance for some people.
(Added in patch 1.69.)