Function for Prior Position

Post Reply
Avatarati
Posts: 53
Joined: Mon Jun 30, 2014 2:51 pm

Function for Prior Position

Post by Avatarati » Sun Nov 01, 2015 7:42 am

I created a custom command for @bazaar that takes you to Provenance. For the glimmering troves in the area, an OnTrigger will send the player back to their previous zone. The command that sends them there, however, only has the starting point coordinates.

I'd like to fine tune this further by sending the player back to their last known position in their previous zone. I do not see any function available to call for the last position like I can for the last zone.

Code: Select all

ZoneID = player:getPreviousZone();
        if (ZoneID == nil or ZoneID == 0) then
            player:PrintToPlayer( "Previous Zone was a Mog House or there was a problem fetching the ID.");
        else
            player:setPos( 0, 0, 0, 0, ZoneID );


Is there a way to define a custom function to get the last known coordinates from the previous zone? Or is there something already available I can use?

Appreciate the help, thanks.

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Function for Prior Position

Post by kjLotus » Sun Nov 01, 2015 12:27 pm

the "previous position" isn't saved anywhere, so you'd have to save it to the database yourself (using player:setVar probably) and then load it back

Avatarati
Posts: 53
Joined: Mon Jun 30, 2014 2:51 pm

Re: Function for Prior Position

Post by Avatarati » Sun Nov 08, 2015 12:41 pm

Thank you for the response, KJ. I don't know how to translate an entire position to a char variable just yet but I think I have an idea based on some strings I've seen in other lua files though...

I'll play around with it to see if I can do it before asking how.

Post Reply