Any Ideas on this transition?
vonstorm
Member Posts: 66
I have a get location script that marks the position of PC (on rest atm).
It works on all except one area (my main town), and I can't figure out why. The Script fires and debug gives me the correct tag of the area (see debug). However, the port script below fails only on this one area. Ive checked tag duplication etc. The reason Id like this to work is because I want to put it on onclientleave.
port script
This works in every other area Ive tried so far except the one area. I do not get the invalid location line in port script. Any Ideas what could cause this?
object oPC = oPlayer; object oArea = GetArea(oPC); string sArea = GetTag(oArea); string sId = GetTag(oPC); vector v = GetPosition(oPC); float x = v.x; float y = v.y; float z = v.z; float o = GetFacing(oPC); SetCampaignFloat("LDB","LOC_X_"+sId,x); SetCampaignFloat("LDB","LOC_Y_"+sId,y); SetCampaignFloat("LDB","LOC_Z_"+sId,z); SetCampaignFloat("LDB","LOC_O_"+sId,o); SetCampaignString("LDB","LOC_A_"+sId,GetTag(oArea)); //SetCampaignInt("DB","HP_"+sId,GetMaxHitPoints(oPC)-GetCurrentHitPoints(oPC)); //debug SendMessageToPC(oPC,sArea);
It works on all except one area (my main town), and I can't figure out why. The Script fires and debug gives me the correct tag of the area (see debug). However, the port script below fails only on this one area. Ive checked tag duplication etc. The reason Id like this to work is because I want to put it on onclientleave.
port script
float fX = GetCampaignFloat("LDB","LOC_X_"+sId); float fY = GetCampaignFloat("LDB","LOC_Y_"+sId); float fZ = GetCampaignFloat("LDB","LOC_Z_"+sId); float fOrientation = GetCampaignFloat("LDB","LOC_O_"+sId); string sArea = GetCampaignString("LDB","LOC_A_"+sId); object oArea = GetObjectByTag(sArea); vector vPosition = Vector(fX, fY, fZ); location lLocation = Location(oArea, vPosition, fOrientation); // Verify that the location is valid before attempting to teleport. // (The script will stop here if no location was previously stored.) if ( GetAreaFromLocation(lLocation ) == OBJECT_INVALID ) { SendMessageToPC(oPC,"invalid location"); return; } // Teleport the PC. eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC); DelayCommand(3.0, AssignCommand(oPC, ClearAndJumpToLocation(lLocation)));
This works in every other area Ive tried so far except the one area. I do not get the invalid location line in port script. Any Ideas what could cause this?
0
Comments
Also just for information purposes you can store and retrieve persistent locations using 2 campaign variables rather than five. Something like so:
Store:
Retrieve, create new location and check for validity or what not:
I used to use the GetLocation with intermittent results, and someone advised it was broken. If it's reliable that's good to know. Also I know that grabbing location on client exit used to be hit or miss because the PC object was sometimes no longer in an area when it ran, is this still true to anyones knowledge?
Thanks again for any insights.
You are correct that GetLocation was one of those things you used to not be able to do OnClientLeave. It could be that it still has issues that I am unaware of though.
As far as your script still not working for one area I'm still not sure. One of those things you'd have to be able to see all the scripts, the trigger, tags, etc.
Could add a few more debug lines and see if it helps to track anything down. You did say you aren't seeing the "invalid location" message which would indicate that you still have a valid AREA at least but maybe the rest of the location is broken or missing. Not sure.
Alas, I would offer you scripting advice, but I fear you would end up helping me to help you.
Still learning NW script...