MadMage999 2 Posted March 2, 2018 Hi all, I was in the process of making a mod that store locations and lets you teleport back to them at will, and it seems that storing locations in kotor1/2 is done a bit differently than what I'm used to (coming from scripting for nwn2). What I want is to get the location of the speaker in a script fired from a conversation and store it. What I'm used to doing is using a local variable, but I don't see the function I need. Does anyone know how to store the current location of the speaker so that it can be used in another script later to teleport them back? Thanks! Quote Share this post Link to post Share on other sites
newbiemodder 37 Posted March 2, 2018 Can you create as Waypoint via scripting? I would think you would GetLocation of the object speaker then create a waypoint based on that which you would use to jump to. I was always a hack scripter...Just thinking out loud... Quote Share this post Link to post Share on other sites
MadMage999 2 Posted March 2, 2018 I'll look into your suggestion, thank you. Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted March 3, 2018 The documentation indicates you can spawn waypoints with CreateObject but I have a vague memory of trying it and it not working, so I can't confirm if they work. However, you could achieve the same result by spawning an invisible placeable. I'm curious, though - how would you go about it in NWN2? Quote Share this post Link to post Share on other sites
MadMage999 2 Posted March 3, 2018 Like so: void main(string sLocationName) { object oPC = GetPCSpeaker(); SetLocalLocation(oPC, sLocationName, GetLocation(oPC)); } When calling the script you pass in 1,2,3,4 or 5 from the dialog to choose a slot for storage, this is arbitrary you could have as many as you wanted, at least theoretically. I chose five because it seemed like a good number. Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted March 3, 2018 Interesting. I checked the NWN Lexicon to see how that function works. Looks like it stores info as a variable with the data type location (as opposed to the usual boolean, integer, or string). Yeah, there's no such function in KOTOR, and as far as I'm aware there's no support for that sort of variable either. You could theoretically do the same thing in KOTOR with four different integer variables for the X, Y, Z, and angle values, or with string and convert it to a location... but it would be a total waste of time. All you really need is CreateObject(OBJECT_TYPE_PLACEABLE, "invisible_placeable_here_with_a_much_shorter_template_name", GetLocation(GetFirstPC(), 0); and have some system for managing the placeables' tags and delete them as necessary, of course. Quote Share this post Link to post Share on other sites
MadMage999 2 Posted March 3, 2018 Not sure I understand how it works, I only see a placeable being created. Not sure what is meant when talking about "waypoints" either. It seems I've had it very easy in nwn2 where there are functions for just about everything. Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted March 3, 2018 Once you place the placeable, you can use GetLocation to get its location in the second script. Quote Share this post Link to post Share on other sites
MadMage999 2 Posted March 3, 2018 Okay, and then I guess you would use a jump function from there. Makes sense. Thanks for the advice. Quote Share this post Link to post Share on other sites
zbyl2 811 Posted March 3, 2018 The documentation indicates you can spawn waypoints with CreateObject but I have a vague memory of trying it and it not working, so I can't confirm if they work. However, you could achieve the same result by spawning an invisible placeable. It should work. Visas' intro cut-scene spawns a waypoint before it starts, so you're moved to the same place after it plays out. 1 Quote Share this post Link to post Share on other sites