Jump to content

Recommended Posts

Hello,

Is there a way to get the grid in wich the player is ?

What I want is a script for MP use that gives you your grid in a hint box when you hit the GPS button.

Share this post


Link to post
Share on other sites

I dont recall seeing such a function, however... Does the map coordinate relate to actual position? There's a chance you can simply getPos and calculate the map coordinate from that.

Share this post


Link to post
Share on other sites

There is a function for this in the "Function Module". I believe the function is called BIS_fnc_PosToGrid (I'm not 100% sure of the name).

So to get the map grid position of unit "_unit" simply write:

_mapGrid = (getPos _unit) call BIS_fnc_PosToGrid;

"_mapGrid" is an array of two elements, the first is the horizontal grid no., the second is the vertical. Both elements are strings.

Share this post


Link to post
Share on other sites

thx,

but it doesn't seems to work, it returns me any as X coordonates, Y coordinates works fine.

here's my little GPS script

_unit = _this select 0;

player sidechat format["%1",_unit];//Debug

_mapGrid = (getPos _unit) call BIS_fnc_PosToGrid;

_mapgrigX = _mapgrid select 0;

_mapgridY = _mapgrid select 1;

hint format["X:%1/Y:%2",_mapgridX,_mapgridY];

Edited by luckyhendrix

Share this post


Link to post
Share on other sites

It seems to be a small error in the name of one of your variables.

_mapgrigX should be _mapgridX in your line "_mapgrigX = _mapgrid select 0;"

Then I believe it should work.

Share this post


Link to post
Share on other sites

I've corrected the mistake but wierdly I have any for X an Y. I don't remeber how I got the Y coordonates working before I forgat to save my mission :(

But if I activate my GPS script with , nul = [player] execVM "gps.sqf" in a radio trigger I get any for all coords.

Same if I activate the script via an addaction.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×