Page MenuHomeFeedback Tracker

Creating sector module by script doesnt work after update 1.86
New, NormalPublic

Description

Creating sector module by script after mission start doesn't work after update 1.86. (Worked before 1.86)

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
Windows 10 Home
Category
Scripting
Steps To Reproduce

In EDEN editor:
Place unit for player
Place object, set variable name: objectAlpha
save

place script <sector.sqf> into the mission files

sector.sqf

//Create the sector logic
_pos = getPos objectAlpha;
sectorA = (createGroup sideLogic) createUnit ["ModuleSector_F",_pos,[],0,"NONE"];

//Default setting,  which are optional
sectorA setVariable ["CostAir","0.1"];
sectorA setVariable ["CostInfantry","0.1"];
sectorA setVariable ["CostPlayers","0.1"];
sectorA setVariable ["CostTracked","0.1"];
sectorA setVariable ["CostWater","0.1"];
sectorA setVariable ["CostWheeled","0.1"];
sectorA setVariable ["DefaultOwner","-1"]; //"-1" = None, "0"= West, "1" = East, "2"= independent 
sectorA setVariable ["Designation","A"];
sectorA setVariable ["Name","ALPHA"];
sectorA setVariable ["OnOwnerChange",""];
sectorA setVariable ["OwnerLimit","1"];
sectorA setVariable ["ScoreReward","0"];
sectorA setVariable ["TaskDescription","Capture sector ALPHA"];
sectorA setVariable ["TaskOwner","3"];
sectorA setVariable ["TaskTitle","ALPHA"];

//Set the sides for the sector
sectorA setVariable ["sides",[west, east]];

//Wait until sector is initialised
waitUntil {
!isNil { sectorA getVariable [ "finalized", nil ] } &&
{ !( sectorA getVariable [ "finalized", true ] ) }
};

//A size for the trigger
_trgSize = 50;
//Set the trigger size on the sector
sectorA setVariable [ "size", _trgSize ];
//Make the module update its trigger
[ sectorA, [], true, "area" ] call BIS_fnc_moduleSector;

//Unfortunately the sector has not been written to also update its marker so..
//Get the modules trigger
_trg = ( sectorA getVariable "areas" ) select 0;
//Get the triggers marker
_mrk = ( _trg getVariable "markers" ) select 0;
//Update the markers size
_mrk setMarkerSize [ _trgSize, _trgSize ];

Start mission
Run script: [] execVM "sector.sqf";

script stops at line 26 (//Wait until sector is initialised)

Additional Information

Hello.
I woul like to ask you for help. I used this script for creating sectors in my missions (game mode).
https://forums.bohemia.net/forums/topic/213237-warmachine-game-mode-spcooppvepvp/

It worked well until last update 1.86. It looks like part of the code Waiting until sector is initialised doesn't return true now.

waitUntil {
!isNil { sectorA getVariable [ "finalized", nil ] } &&
{ !( sectorA getVariable [ "finalized", true ] ) }
};

If you can tell me what changed in the moduleSector , or how to change the script to work again, I'll be glad.
I spend one year by developing this missions. And now core mechanics doesn't work.
Thank You for your help.

Event Timeline

ivosh_cz created this task.Dec 4 2018, 8:57 AM
ivosh_cz edited Steps To Reproduce. (Show Details)Dec 4 2018, 9:00 AM
ivosh_cz edited Steps To Reproduce. (Show Details)

I suspect the culprit is sectorA = (createGroup sideLogic) createUnit ["ModuleSector_F",_pos,[],0,"NONE"];. The module function of ModuleSector_F does not get called, and thus "finalized" will never set to be true. The update likely broke something in the createUnit command.

ivosh_cz added a comment.EditedDec 7 2018, 8:54 AM

Solved:
Place any object in the editor. Set variable name to: objectAlpha
Run script

_pos = getPos objectAlpha;	
"ModuleSector_F" createUnit [_pos,createGroup sideLogic,format
	["
		sectorA=this; //to set variable name
		this setvariable ['BIS_fnc_initModules_disableAutoActivation',false];
		this setVariable ['name','ALPHA'];
		this setVariable ['Designation','A'];
		this setVariable ['OwnerLimit','1'];
		this setVariable ['OnOwnerChange',''];
		this setVariable ['CaptureCoef','0.05']; 	
		this setVariable ['CostInfantry','0.2'];
		this setVariable ['CostWheeled','0.2'];
		this setVariable ['CostTracked','0.2'];
		this setVariable ['CostWater','0.2'];
		this setVariable ['CostAir','0.2'];
		this setVariable ['CostPlayers','0.2'];
		this setVariable ['DefaultOwner','-1'];
		this setVariable ['TaskOwner','3'];
		this setVariable ['TaskTitle','ALPHA'];
		this setVariable ['taskDescription','Capture sector Alpha'];
		this setVariable ['ScoreReward','0'];
		this setVariable ['Sides',[west,east]];
		this setVariable ['objectArea',[50,50,0,false ]];
	"]];
ookexoo added a comment.EditedDec 7 2018, 2:18 PM

OMG, thx! Setting BIS_fnc_initModules_disableAutoActivation to false does the trick!