Jump to content

GetSafePosition


Dielos

Recommended Posts

Anybody know how the function GetSafePosition() works?

 

I might be implementing it wrong, as I get that this function does not exist when compiling. I'm calling it from a quest script, could this be the issue?

 

I'm trying to find a safe location not too far from the player and move him over there. I'm calling it like this:

float[] safeLocationArray = Game.GetPlayer().GetSafeLocation(2048.0,50.0)

I get the following errors when compiling:

GetSafeLocation is not a function or does not exist
type mismatch while assigning to a float[] (cast missing or types unrelated)

Although the type mismatch error description sounds quite enlightening, I just don't get it. :huh:

Link to comment
Share on other sites

Maybe assign Game.GetPlayer() to a variable Player, then use Player.GetSafeLocation()? The compiler shouldn't be confused by the daisy chained dots, but you never know.

 

Scavver uses MoveToNearestNavmeshLocation in his "navbump" (custom get unstuck function), but only because that's the first safe move function I found. It looks like both functions are spherical, meaning you might end up underground at times (ie. parts of Vault 111 are close to the hillside exterior), since we don't get to pick where the nearest safe spot is.

 

http://www.creationkit.com/fallout4/index.php?title=MoveToNearestNavmeshLocation_-_ObjectReference

Link to comment
Share on other sites

Thanks for the answer. I tried with Player assigned to a variable as well and got the same errors. Might try using a marker to see if I get it working with it.

 

I was aware of MoveToNearestNavmeshLocation, but it doesn't allow for a radius, so I expect that as the player is already in a navmeshed location, that it will probably just return that. Will test it nevertheless.

 

Another option is to just find a location a distance away and try MoveToNearestNavmeshLocation from there. Will play around with these options...

Link to comment
Share on other sites

Why are you using GetSafeLocation if the function name is GetSafePosition?

Doh! Mayor fail...

 

Corrected the typo and works straight away, of course... Way too many hours in front of the PC! Thanks, viennacalling!

Link to comment
Share on other sites

That's funny. I missed it too. Btw, let me know how that works for you. Wondering if there is any benefit vs MoveToNearestNavmeshLocation*.

 

* I'm moving a marker, then Scavver, which is how I'm able to query 10-second distances.

Link to comment
Share on other sites

Yesterday was a bad day... I also didn't read the description of the function too well. I think GetSafePosition is more oriented to find a safe position for a bigger object, like the landing spot for a vertibrid. MoveToNearestNavmeshLocation is probably better suited for actors, as they don't need that much space.

 

In GetSafePosition you can define a radius, and I thought this would be useful for me, but it isn't, that radius is just for max distance, so it always finds the nearest. I need to find a random position inside a radius with a minimum and maximum distance from origin. For this I will have to find the position by math (hope google helps) and then probably use MoveToNearestNavmeshLocation from that position with help of a marker...

 

By the way. Amazing mod Scavver!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...