Is it possible to convert coordinates to say for example x, y z to F14?
Converting X, Y and Z coordinates to Map grid?Solved
Take a look at GrTeleport plugin code.
In response to 2CHEVSKII ():Take a look at GrTeleport plugin code.
I did. It converts map grid to coordinates... I need to convert coordinates to map grid. I have no idea how to reverse that.
Merged post
This is way out of my league so I'll close this. Hoped there was an easier way to accomplish this. Thanks 2CHEVSKII for trying to help.
Merged post
Ok... I tried using GrTeleport plugin... calling this part:
with:
Gives me how far I am from next map grid... but how can I make it return the grid I'm currently on?
Merged post
This is way out of my league so I'll close this. Hoped there was an easier way to accomplish this. Thanks 2CHEVSKII for trying to help.
Merged post
Ok... I tried using GrTeleport plugin... calling this part:
string GetGridReference(Vector3 position)
{
try
{
var distance = float.MaxValue;
int index = -1;
foreach (var s in spawnGrid)
{
if (Vector3.Distance(s.GroundPosition, position) < distance)
{
distance = Vector3.Distance(s.GroundPosition, position);
index = spawnGrid.IndexOf(s);
}
}
var direction = "";
if (index > -1)
{
if (position.z > spawnGrid[index].GroundPosition.z)
direction += "N";
else if (position.z < spawnGrid[index].GroundPosition.z)
direction += "S";
if (position.x > spawnGrid[index].GroundPosition.x)
direction += "E";
else if (position.x < spawnGrid[index].GroundPosition.x)
direction += "W";
var mesg = $"{distance.ToString("0.00")} meters {direction} of the {spawnGrid[index].GridReference} map marker.";
return mesg.Replace("{distance}", distance.ToString("0.00")).Replace("{direction}", direction).Replace("{gridreference}", spawnGrid[index].GridReference);
}
else
{
return "I don't know.";
}
}
catch (Exception ex)
{
throw new Exception($"GetGridReference {ex.Message}");
}
}with:
[ChatCommand("test")]
void chatCommandTest(BasePlayer player, string command, string[] args)
{
SendReply(player, GetGridReference(player.transform.position));
}Gives me how far I am from next map grid... but how can I make it return the grid I'm currently on?
Locked automatically