Jump to content

Recommended Posts

Hi guys, I'm trying to get a sector control module to execute a script when control of the sector changes. I want the script to grab that sectors name and append Flag to the end of it, then change the texture of a pre placed flag with that name to the appropriate side's flag. Here's what I have right now 

_MyFlag = format [_this,"flag"];
if (_this select 1 isEqualTo west) then
	{
		_MyFlag setFlagTexture "\A3\Data_F\Flags\Flag_nato_CO.paa"
		_Marker1 = createMarker ["Marker1", position _this];
		"Marker1" setMarkerType "flag_NATO";
	};
if (_this select 1 isEqualTo east) then
	{
		_MyFlag setFlagTexture "\A3\Data_F\Flags\Flag_CSAT_CO.paa"
		_Marker1 = createMarker ["Marker1", position _this];
		"Marker1" setMarkerType "flag_CSAT";
	};

I'm not sure how to do the concatenation between the flag and the sector name as I don't know if the sector control module passes that info, it says it passes <module>,<ownerSide> and <previousOwnerSide> I'm trying to avoid making a script for each flag/sector, also still struggling a little with the syntax.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/ScriptedEventHandlers

https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler

[<sectorName>, "ownerChanged",
{
	// code to execute upon sector change
}] call BIS_fnc_addScriptedEventHandler;

Events passed:

[_sector, _owner, _ownerOld]
[<sectorName>, "ownerChanged",
{
	params ["_sector", "_owner", "_ownerOld"];
	systemChat format ["%1 captured by %2. %3 are no longer in control of this sector.", _sector, _owner, _ownerOld];
}] call BIS_fnc_addScriptedEventHandler;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

A sector can already do this for you as long as your flag is typeOf "FlagCarrierCore". Just sync the flag to the sector. When the sector changes sides the flags texture will be updated.

It first looks for configfile >> "cfgfactionclasses" >> _ownerFaction >> "flag"

Where _ownerFaction is configfile >> "cfgvehicles" >> _unit >> "faction" of the first unit in the sector of the capturing side.

if that is unavailable then it just does _owner call bis_fnc_sidecolor

 

 

  • Like 1
  • Thanks 1

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

×