Advertisement

Author Topic: Team Status Script Problem  (Read 570 times)

0 Members and 1 Guest are viewing this topic.

Offline aceking

  • Members
  • *
Team Status Script Problem
« on: 24 Mar 2009, 13:37:22 »
Hi, I'm trying to use the Team Status script on one of my multiplayer coop missions. I used the same script in most of my Avgani and Afghan Village missions with no problems. However, I just recently tried it on the ACE Islands Gaia map, and for some reason, I keep receiving some script error. Can anyone help me fix this issue?



pos2grid.cpp file:
Code: [Select]
private ["_x","_y","_cfg","_offsetX","_offsetY","_stepX","_stepY","_el","_smallZoom"];
_cfg    =configFile>>"CfgWorlds">>worldName>>"Grid";

_offsetX=getNumber(_cfg>>"offsetX");
_offsetY=getNumber(_cfg>>"offsetY");

_smallZoom = "Zoom1"; // Zoom1/Zoom2 is default used by BIS/ArmA/Sara - _smallZoom can be Zoom0/Zoom1/Zoom2
if (isClass (_cfg>>"Zoom0")) then {_smallZoom = "Zoom0"}; // if Zoom0 exists, assume it uses Zoom0/Zoom1

_stepX=getNumber(_cfg>> _smallZoom >>"stepX");
_stepY=getNumber(_cfg>> _smallZoom >>"stepY");

switch toLower(worldName) do
{
  case 'sara': { _offsetY=-480*-1; }; // uses Zoom1 & Zoom2
  case 'saralite': { _offsetY=-480*5+120; }; // uses Zoom1 & Zoom2
  case 'sakakah': { _offsetY=-480*11+160; }; // uses Zoom1 & Zoom2
  case 'vte_australianao': { _offsetY=-480*30; };
  case 'map_ssara': { _offsetY=-480*5+120; }; // uses Zoom1 & Zoom2, offsetX = -4880; offsetY = -7480;
  case 'intro': { _offsetY=-480*-1; };
  case 'porto': { _offsetY=480*10+320; }; // uses Zoom1 & Zoom2
  case 'syr_darain': { _offsetY=480*10+320; };
  case 'tolafarush': { _offsetY=480*11+320; };
  case 'schmalfelden': { _offsetY=480*10+320; _stepX=100; _stepY=100; }; // uses Zoom0 & Zoom1
  case 'avgani': { _offsetY=480*10+320; _stepX=100; _stepY=100; }; // uses Zoom0 & Zoom1
  case 'map_3demap': { _offsetY=-480*15+0; };
  case 'watkins': { _offsetY=-480*11+160; }; // uses Zoom0 & Zoom1
  case 'uhao': { _offsetY=480*11+320; }; // uses Zoom1 & Zoom2, offsetY = -15360;
};

_x=(_this select 0 select 0)-_offsetX;
_y=(_this select 0 select 1)-_offsetY;


_el=
[
    ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],
    ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],
    ["0","1","2","3","4","5","6","7","8","9"],
    ["0","1","2","3","4","5","6","7","8","9"]
];

_xs=([1,-1]select(_x<0));
_x =((abs _x)-((abs _x)mod _stepX))/_stepX;

_y=100*_stepY-_y;
_ys=([1,-1]select(_y<0));
_y=((abs _y)-((abs _y)mod _stepY))/_stepY;

_xf=_x mod 10;
_xc=(_x-_xf)/10;
if(_xs<0)then{_xf=9-_xf;_xc=count(_el select 0)-1-_xc};_xc=_xc mod(count(_el select 0));_xc=_xc max 0;

_yf=_y mod 10;
_yc=(_y-_yf)/10;
if(_ys<0)then{_yf=9-_yf;_yc=count(_el select 2)-1-_yc};_yc=_yc mod(count(_el select 2));_yc=_yc max 0;

format["%1%2%3%4",_el select 0 select _xc,_el select 1 select _xf,_el select 2 select _yc,_el select 3 select _yf]

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Team Status Script Problem
« Reply #1 on: 24 Mar 2009, 16:59:36 »
This pos2grid script only works on islands that have been specifically added to the switch statement. You need to work out the Y-offset for the map you are using and add that to the list. You'll need to do that every time you want to use the script with a new island...

If you use SPON Map (mission script or addon), you could change pos2grid to use SPON_Map_worldToGrid which will generate coordinates for absolutely any position on any map (including ones I've never tested it on, because it works out the y-offset for itself).
Code: (pos2grid.sqf) [Select]
_this call SPON_Map_worldToGrid;

My function will also work on 6-digit co-ordinate maps, which is what all the ACE maps (and ACE versions of regular maps) use.

This is far from an ideal solution, but it is by far the easiest (especially for me ;) ).
« Last Edit: 24 Mar 2009, 17:02:48 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline aceking

  • Members
  • *
Re: Team Status Script Problem
« Reply #2 on: 27 Mar 2009, 14:35:40 »
Is there a way to fix it without using the SPON map? Cuz I like to implement ACE MAP logics, and I found that SPON map gives everyone maps with [shift + M]

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Team Status Script Problem
« Reply #3 on: 27 Mar 2009, 17:12:29 »
Yes, SPON Map has a known bug which is that it will be available even if the regular map is disabled (for example by ACE Map system). This is fixed in the version I am working on at the moment, which I want to release as soon as I can.

Although you could fix this script with offset for your specific map, it still uses 4-digit coordinates (Aa00), when ACE uses 6-digit coordinates (000000). You might want to contact Dr. Eyeball to see if he has an updated version of the script, but that is as much as I can do without rewriting the existing script (and, as I've said, I have a fully working, universal version already, so I think I'd be wasting my time working on this one).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline aceking

  • Members
  • *
Re: Team Status Script Problem
« Reply #4 on: 29 Mar 2009, 16:19:23 »

The SPON Map that is congruent with the ACE Map system would definitely be a nice addition. Good luck, and hope to see it on Armaholic soon. Anyways, I got it working, thanks for your guys help.





No need to quote the entire previous post. - Planck
« Last Edit: 29 Mar 2009, 17:06:35 by Planck »