Jump to content
smacker909

sector module expression

Recommended Posts

Hello,  I'm trying to use Expression field in the Sector module to run a script.  the module says "Code executed when ownership changes"  however, it seems to be executing right when the mission starts.  Anyone have any experience with it? 

Share this post


Link to post
Share on other sites

I got a demo of one at home and I seem to remember having an issue like that as well.  I'll post again when I get home in a few hours. :)

Share this post


Link to post
Share on other sites

Thanks Kylania!  

 

I found that it does execute on startup but also on owner change afterword,  so I tried implementing something like;

 

Expression in Sector Module:    ->   [_this select 0, _this select 1, _this select 2] execVM "script.sqf";

 

 

//   from script.sqf

 

_sector = _this select 0;
 
 
waitUntil {(_sector getVariable "owner") != "UNKNOWN"};   %% and tried UNKNOWN without quotes
 
But getting generic error in expression   :(  UNKNOWN is what hint format shows for _owner.
  • Like 1

Share this post


Link to post
Share on other sites

Well.. this worked.

 

 

waitUntil { ( ((_sector getVariable "owner") == EAST)   ||   ((_sector getVariable "owner") == WEST)   || ((_sector getVariable "owner") == RESISTANCE) )  };

  • Like 1

Share this post


Link to post
Share on other sites
_owner = _sector getVariable "owner";
waitUntil { _owner in [EAST, WEST, RESISTANCE] };

:P

  • Like 1

Share this post


Link to post
Share on other sites

Yours like much nicer :)      Now I have a problem with two teams spawning!!  

 

The only idea is to have a little defense on sector after capture to avoid sector hopping 

 

// place [_this select 0, _this select 1, _this select 2] execVM "sectorDefense.sqf"; 
// in the Expression field of your Sector Modules
 
waitUntil { !isNil "bis_fnc_init" };
 
Private ["_grp","_sector","_owner","_trigMarker"];
 
_sector = _this select 0;
 
waitUntil { ( ((_sector getVariable "owner") == EAST)   ||   ((_sector getVariable "owner") == WEST)   || ((_sector getVariable "owner") == RESISTANCE) )  };
sleep 2;
 
 
_owner = (_sector getVariable "owner");
_areasA = _sector getVariable "areas";
_trigger = _areasA select 0;
_trigMarker = (_trigger getVariable "markers") select 0;
 
 
switch (_owner) do
{
 
case west: 
{
_direction = [getMarkerPos _trigMarker, getPos NATO_FLAG] call BIS_fnc_dirTo;
_pos = [getMarkerPos _trigMarker, 50,_direction] call BIS_fnc_relPos;
_grp = [_pos, west, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup;
};
case resistance:
{
_direction = [getMarkerPos _trigMarker, getPos GUER_FLAG] call BIS_fnc_dirTo;
_pos = [getMarkerPos _trigMarker, 50,_direction] call BIS_fnc_relPos;
_grp = [_pos, resistance, (configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfTeam")] call BIS_fnc_spawnGroup;
};
case east:
{
_direction = [getMarkerPos _trigMarker, getPos EAST_FLAG] call BIS_fnc_dirTo;
_pos = [getMarkerPos _trigMarker, 50,_direction] call BIS_fnc_relPos;
_grp = [_pos, east, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfTeam")] call BIS_fnc_spawnGroup;
};
 
};
 
_wp = _grp addWaypoint [getMarkerPos _trigMarker, 5];
_wp setWaypointBehaviour "COMBAT"; 
_wp setWaypointCombatMode "GREEN";
_wp setWaypointType "HOLD";

Share this post


Link to post
Share on other sites

Okay.... adding ;     

 

      if ((_this select 1) in [EAST, WEST, RESISTANCE]) then {[_this select 0] execVM "sectorDefense.sqf";}

 

..to the expression field and removing that check from the script corrected the double spawning issue. 

  • Like 1

Share this post


Link to post
Share on other sites
if !(_this select 1 isequalto sideUnknown) then {//call script};
If a sector does not have an owning side then it is sideUnknown

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

×