Skip to content

Broken Function: JumpToLocation

I'm having a nightmare with the JumpToLocation in that it seems to have completely broken somehow. This in when calling it on a conversation. It used to work fine but now, it doesn't.

I usually do all the ClearAllActions stuff before scripting the AssignCommand( JumpToLocation... Buisness, but that doesn't work.

Is there any possibility that there might be some underlying code conflicting with this function? Perhaps a script that I've imported that somehow conflicts with the function definition at the global level? Would re-defining a new function that did a similar job work?

At the moment, triggers (fingers crossed) are still working ok, but even those are becoming temperamental.

This is only dealing with oPC, not with other NPC's.

Perhaps there are some Programmers out there with experience that might have experienced the same problem and might have a solution.

Thanks!

Comments

  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Just tested it from a conversation and so far seems to be working fine for me. Tested it for a location in the same area and a location in a different area. No hiccups. Worked every time.

    My simple test script:
    void main()
    {
        object oPC = GetPCSpeaker();
        object oLocationObject = GetObjectByTag("test_loc_object");
        location lLoc = GetLocation(oLocationObject);
    
        AssignCommand(oPC, ClearAllActions(TRUE));
        AssignCommand(oPC, JumpToLocation(lLoc));
    }
    
  • nwfan87nwfan87 Member Posts: 99
    @NeverwinterWights This is the exact set up I'm using, with the exception of you calling an object instead of a Waypoint . However, it seems to have broken now. Will try using an object instead of a waypoint to see how that works, but not ideal, as WP should work too.

    Is there perhaps a nw_ or x2_ or some other game script that deals with teleporting through conversation, that I might have accidently overwritten with some other script that has, conflicted somehow?
  • TarotRedhandTarotRedhand Member Posts: 1,481
    Have you tried verifying your game? If that is OK I would suggest that you check your override, hak and development folders. Also look inside any haks especially for 2da, nss and ncs files. These suggestions are an attempt to save you time just in case your problem lies there and, if it is, save you pulling your hair out looking through your code.

    Just a thought have you imported a "stone of recall" type script that could be messing with it or maybe a waypoint management system? Oh, lastly, for now, have you double checked that the targets of your JumpToLocation() have the correct case for all letters?

    Just a few thoughts.

    TR
  • meaglynmeaglyn Member Posts: 151
    nwfan87 wrote: »
    @NeverwinterWights This is the exact set up I'm using, with the exception of you calling an object instead of a Waypoint . However, it seems to have broken now. Will try using an object instead of a waypoint to see how that works, but not ideal, as WP should work too.

    Is there perhaps a nw_ or x2_ or some other game script that deals with teleporting through conversation, that I might have accidently overwritten with some other script that has, conflicted somehow?

    That first part doesn't really make sense. A waypoint _is_ an object. Nothing here is "calling" either. There's something wrong with your script or your setup. Maybe the waypoint is not uniquely tagged? Are you actually getting the right waypoint object of which to get the location to jump? If you post your script we might be able to help more.

    JumpToLocation() does not rely on any other scripts so it's not something else you overwrote. There's nothing wrong with it.
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Might help to add a few lines to debug or narrow down your problem:
    void main()
    {
        object oPC = GetPCSpeaker();
        object oLocationObject = GetObjectByTag("test_loc_object");
        location lLoc = GetLocation(oLocationObject);
    
        //debug lines to see if location/area, object or WP, and player are all valid:
        object oArea = GetAreaFromLocation(lLoc);
        SendMessageToPC(GetFirstPC(), "Conversation jump script should be running.");
        if (GetIsObjectValid(oLocationObject))
        {
            SendMessageToPC(GetFirstPC(), "Location object or WP is valid.");
        }
        else
        {
            SendMessageToPC(GetFirstPC(), "Location object or WP can NOT be found.");
        }
    
        if (GetIsObjectValid(oPC))
        {
            SendMessageToPC(oPC, "PC Speaker is valid.");
        }
        else
        {
            SendMessageToPC(GetFirstPC(), "No valid PC Speaker found.");
        }
    
        if (GetIsObjectValid(oArea))
        {
            SendMessageToPC(oPC, "Area and location are valid. You should be jumping.");
        }
        else
        {
            SendMessageToPC(oPC, "Area or location is NOT valid. Player can not jump.");
        }
        //
    
        AssignCommand(oPC, ClearAllActions(TRUE));
        AssignCommand(oPC, JumpToLocation(lLoc));
    }
    
  • nwfan87nwfan87 Member Posts: 99
    Sorry for the slow response, very busy last few days

    @TarotRedhand That's what I'm thinking, I've likely used some sort of hak or something that is causing issues. Perhaps it is also possible if you import a blueprint and override a script? I've imported stuff quite a lot so... I'm not sure, I suppose I would have to try and remember what blueprints were imported and see what scripts were effected?

    @meaglyn Pretty sure that the scripts I'm using is correct. Here is the basic structure of what I'm using. The only time I've had problems is when I'm using a tag that is not unique enough. I've found using a long tag, with only minor differences, seems to confuse things.
    void main()
    {
    object oPC = GetEnteringObject();
    
    if (!GetIsPC(oPC)) return;
    
    object oArea2 = GetWaypointByTag("AREA2");
    location lTarget = GetLocation(oArea2);
    
    if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
    
    AssignCommand(oPC, ClearAllActions());
    AssignCommand(oPC, ActionJumpToLocation(lTarget));
    }
    

    @NeverwinterWights That's very useful, thank you! I'll have to try that out.
  • meaglynmeaglyn Member Posts: 151
    Heh, if the script and setup is correct then it would be working. The function is not broken, honest :) Try using JumpToLocation() instead of ActionJumpToLocation(). With the latter a mouse click can cancel it (or keyboard movement command... etc).

    It's not something you pulled in with a hak either...

    The debug stuff nwwights posted is a good idea to make sure you are finding the objects etc. Note that both of his scripts use JumpToLocation() already.
Sign In or Register to comment.