Jump to content
Sign in to follow this  
bolbies

High Command and FindSafePos Issue

Recommended Posts

So I am currently trying to rewrite DUWS so it works on dedicated servers and I got most of it to work. As of right now, from what I have experienced the only 2 1 problem I've found is that "_posx" is undefined in BIS_fnc_findSafePos. This means that both the HQ and enemy zones can't be randomly created, you must manually place them, which is funny because placing them manually requires BIS_fnc_findSafePos anyway. It also affects the side missions. The other problem is that high command doesn't work. I can switch to the high command view, but the icons don't "fill in" and I can't control them. Any help would be greatly appreciated.

Here's what I get in the RPT for the BIS_fnc_findSafePos errors.

13:52:00 Error in expression < BIS_fnc_isPosBlacklisted)) then

{

if ((_pos distance _testPos) >= _minDist) the>

13:52:00 Error position: <_pos distance _testPos) >= _minDist) the>

13:52:00 Error Undefined variable in expression: _pos

13:52:00 File A3\functions_f\misc\fn_findSafePos.sqf, line 98

13:52:00 Error in expression <["_newX", "_newY", "_testPos"];

_newX = _posX + (_maxDist - (random (_maxDist * >

13:52:00 Error position: <_posX + (_maxDist - (random (_maxDist * >

13:52:00 Error Undefined variable in expression: _posx

13:52:00 File A3\functions_f\misc\fn_findSafePos.sqf, line 90

Edited by bolbies

Share this post


Link to post
Share on other sites

Have you made sure your parameters are correct? Cause at a glance that looks to be the problem.

If you have post some code plz.

Share this post


Link to post
Share on other sites

Here's the script that creates the HQ randomly.

_found = false;
_foundSafePos = [];
while {!_found} do {
_foundSafePos = [center_of_map, 0,half_of_map,5,0,0.1,0,[],[[0,0],[0,0]]] call BIS_fnc_findSafePos;
if (_foundSafePos select 0 != 0 && _foundSafePos select 1 != 0) then {_found=true;};
};

_handle = [_foundSafePos] execVM "initHQ\bluHQinit.sqf"; 

center_of_map and half_of_map are created in here.

_unit = _this select 0;
_debug = _this select 1;

private ["_grid_size"];
disableserialization;

openMap [true, false];
WaitUntil {visibleMap};

x_mapsize = 0;
y_mapsize = 0;

_Map_display = findDisplay 12;
_map_cntrl = _Map_display displayCtrl 51;
// Temporarily zoom out as much as possible and measure the screen.
_map_cntrl ctrlMapAnimAdd [0, 1000, [9999999999, 9999999999]];
ctrlMapAnimCommit _map_cntrl;
waitUntil {ctrlMapAnimDone _map_cntrl};
_zoom_max = ctrlMapScale _map_cntrl;
_limit = _map_cntrl ctrlMapScreenToWorld [0.5, 0.5];
x_mapsize = _limit select 0;
y_mapsize = _limit select 1;


_Map_display = findDisplay 12;
_map_cntrl = _Map_display displayCtrl 51;
_map_cntrl ctrlmapAnimAdd [0, 1000, [x_mapsize/2, y_mapsize/2]];
ctrlMapAnimCommit _map_cntrl;
waitUntil {ctrlMapAnimDone _map_cntrl};

openMap [false, false]; 

// by Kempco

// get center of map:
_x_center = x_mapsize/2;
_y_center = y_mapsize/2;
center_of_map = [_x_center,_y_center];

if (_x_center > _y_center) then {
half_of_map = _x_center
}
else
{
half_of_map = _y_center
};

publicVariable "center_of_map";
publicVariable "half_of_map";

Share this post


Link to post
Share on other sites

It looks like your reference position is not correct.

replace this line:

center_of_map = [_x_center,_y_center];

with:

center_of_map = [_x_center,_y_center,0];
diag_log str center_of_map;

Share this post


Link to post
Share on other sites

Ok I think I may have figured out why mapsize.sqf isn't working (the one with center and half_of_map). After putting a few hints in there I found that the script doesn't get past "waituntil {visiblemap};". I already tried making both openmap arguments to true but that didn't work. Any ideas?

Share this post


Link to post
Share on other sites
Ok I think I may have figured out why mapsize.sqf isn't working (the one with center and half_of_map). After putting a few hints in there I found that the script doesn't get past "waituntil {visiblemap};". I already tried making both openmap arguments to true but that didn't work. Any ideas?

Try this instead

waitUntil {
((findDisplay 12) displayCtrl 51)
};

Share this post


Link to post
Share on other sites
Try this instead

waitUntil {
((findDisplay 12) displayCtrl 51)
};

I get "Error Type Control, expected Bool"

Share this post


Link to post
Share on other sites

If you're testing on dedicated server it's normal : it has no display therefore no map .

Call the map script on a player when the game start and pubVar the values (so server don't need the map script and already have the map size values) instead .

Share this post


Link to post
Share on other sites
If you're testing on dedicated server it's normal : it has no display therefore no map .

Call the map script on a player when the game start and pubVar the values (so server don't need the map script and already have the map size values) instead .

Is that not what the script does?

Share this post


Link to post
Share on other sites

Sorry by the bit off topic, DUWS does not support Dedi?????

Share this post


Link to post
Share on other sites
Sorry by the bit off topic, DUWS does not support Dedi?????

I've rewritten it. It's almost done. So far the only two problems I've found is this issue we've been trying to hammer out, and the High Command.

---------- Post added at 16:21 ---------- Previous post was at 15:51 ----------

If you're testing on dedicated server it's normal : it has no display therefore no map .

Call the map script on a player when the game start and pubVar the values (so server don't need the map script and already have the map size values) instead .

I figured it out and got it to work thank you! Now I just need to figure out the high command issue.

Share this post


Link to post
Share on other sites

Here is the script that initializes High Command

// create && synchronize HC
_grplogic = createGroup sideLogic;
_hc_module = _grplogic createUnit ["HighCommand",[0,0,0] , [], 0, ""];
_hc_module synchronizeObjectsAdd [player];
// done,

// make 1 HC subordinate so that the player will not control all blufor forces
_grplogic = createGroup sideLogic;
_sub_module = _grplogic createUnit ["HighCommandsubordinate",[0,0,0] , [], 0, ""];                    
_sub_module synchronizeObjectsAdd [_hc_module];

Share this post


Link to post
Share on other sites

Don't know if it will be useful for you, but here is the onPlayerRespawn from Antistasi, which checks if the player is the commander (variable stavros) and if so, it syncs all the supports, HC etc...

private ["_unit","_grupos","_oldUnit","_oldProviders","_HQ","_providerModule","_used"];
_unit = _this select 0;
_grupos = hcAllGroups stavros;
_oldUnit = stavros;

if (_oldUnit == _unit) exitWith {};

_oldProviders = _oldUnit getVariable ["BIS_SUPP_allProviderModules",[]];
_HQ = _oldUnit getVariable ["BIS_SUPP_HQ",nil];

if ((count _oldProviders) > 0) then {
{
_providerModule = _x;
  	{
  	if (typeOf _x == "SupportRequester" && _oldUnit in (synchronizedObjects _x)) then {
  	[_unit, _x, _providerModule] call BIS_fnc_addSupportLink;
  	};
  	}forEach synchronizedObjects _providerModule;
  	}forEach _oldProviders;
};

{
_used = _oldUnit getVariable [format ["BIS_SUPP_used_%1",_x], 0];
_unit setVariable [format ["BIS_SUPP_used_%1", _x], _used, true]
} forEach ["Artillery","CAS_Heli","CAS_Bombing","UAV","Drop","Transport"];
_unit setVariable ["BIS_SUPP_transmitting", false];
_unit kbAddTopic ["BIS_SUPP_protocol", "A3\Modules_F\supports\kb\protocol.bikb", "A3\Modules_F\supports\kb\protocol.fsm", {call compile preprocessFileLineNumbers "A3\Modules_F\supports\kb\protocol.sqf"}];
if (!(isNil "_HQ")) then
{
   player setVariable ["BIS_SUPP_HQ", _HQ];
   };
if (!isNil "_grupos") then
 {
 {
 _oldUnit hcRemoveGroup _x;
 } forEach _grupos;
 };
stavros = _unit;
publicVariable "stavros";
HC_comandante synchronizeObjectsAdd [_unit];
if (!isNil "_grupos") then
 {
 {_unit hcSetGroup [_x]} forEach _grupos;
 };

Share this post


Link to post
Share on other sites

Thanks barbolani! I'll definitely try that one I get back home next week!

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  

×