Best way to "end mission" in large scale assault?

  1. ‹ Older
  2. 8 years ago

    I'm having some trouble, as I'm not very savvy with scripting. I make a trigger and paste what Spyder posted in his first message with the correct range to look for 'East' entities, does that translate to 'Opfor'? Or is it literally having to do with east and west sides of the map.

    I put a trigger in the center of my insurgency mission hoping that once insurgents were taken out in the range, it would kick on and complete for me, but I get an instant mission complete on booting up the preview in the editor. Are there any other things to edit in the trigger box to make this work?

  3. East = opfor, west = blufor, independant = AAF side

    Use this new code

    Condition:

    if (isServer) then {count ([getposATL thisTrigger, 15000, ["EAST","entity"]] call ALIVE_fnc_getNearProfiles) == 0 && {count ([getposATL thisTrigger, 15000, ["EAST","vehicle"]] call ALIVE_fnc_getNearProfiles) == 0}} else {false};

    On Activation: if (isServer) then { ["end1","BIS_fnc_endMission",true,true] call BIS_fnc_MP};

  4. Holy crap, that was fast! Thanks for all the help the last couple days, Spyder, if it weren't for you I might still be trying to figure out how to put ALiVE modules down in the editor. I guess the only way to test if this works quickly is to either make the range smaller and clear it, or delete all enemy entities by removing their modules?

  5. Edited 8 years ago by SpyderBlack723

    Just make a quick scenario using custom objective to spawn one group, in your unit init line put
    this setCaptive true; so you won't be attacked
    Then kill all the units and it should 'win'

  6. Wow, it works well from the looks of it. Thanks. I wish I understood the scripting part better but I guess with time and experience, I will.

  7. Edited 8 years ago by ZeroG

    I got a related question:

    I am currently using an active force counter, kind of a ticket display on screen telling how many unvirtualized entities are alive on the whole AOR from each side:

    while {alive FCOUNTER} do {
    
    BLUE = {side _x == WEST} count allunits;
    RED = {side _x == EAST} count allunits;
    
    (uiNameSpace getVariable "BLUE") ctrlSetText format ["BLUE: %1",BLUE];
    (uiNameSpace getVariable "RED") ctrlSetText format ["RED: %1",RED]; 
    
    sleep 2;
    };

    Now, 2 questions:

    • How would I also count the virtualized units by side?
    • How would I also count the virtualized reinforcements by side?

    Besides: the related trigger spans over the whole map...

    Thanks!

  8. Edited 8 years ago by SpyderBlack723
    _profilesWest = count ([ALiVE_profileHandler, "getProfilesBySide", "WEST"] call ALIVE_fnc_profileHandler);
    _profilesEast = count ([ALiVE_profileHandler, "getProfilesBySide", "WEST"] call ALIVE_fnc_profileHandler);
    hint format ["Force Matchup \n West: %1 total groups \n East: %2 total groups", _profilesWest, _profilesEast];
    
    _forcePool1 = [ALIVE_globalForcePool, _faction1] call ALIVE_fnc_hashGet;
    _forcePool2 = [ALIVE_globalForcePool, _faction2] call ALIVE_fnc_hashGet;
    hint format ["Forcepool Values \n West: %1 total groups \n East: %2 total groups", _forcePool1, _forcePool2];

    If you want to count forcepool by side, instead of faction, you will need to combine the forcepool of each faction that are on the same side and combine their count.

  9. Thank you for your quick help, Spyder. Though there is little to correct: missing closing brackets

    _profilesWest = count ([ALiVE_profileHandler, "getProfilesBySide", "WEST"] call ALIVE_fnc_profileHandler);
    _profilesEast = count ([ALiVE_profileHandler, "getProfilesBySide", "WEST"] call ALIVE_fnc_profileHandler);
    hint format ["Force Matchup \n West: %1 total groups \n East: %2 total groups", _profilesWest, _profilesEast];
  10. Edited 7 years ago by ski2060

    Wow, glad I stumbled upon this while looking for win conditions for my mission.

    I have 2 enemy forces on my map. One is an Insurgency, one is an Occupation. I would like to set Win conditions for BluFor clearing the map, or at least a large portion (with a trigger area), and/or by destroying a certain number of Insurgent IED factories and HQ's.

    How would I go about doing something like that? I assume for the former win condition, just use the above code in my trigger for checking Enemy (IND) Units. Just replace EAST with IND in the above code?
    But how would it be used to check for Insurgent HQ/IED factories? Is that even possible?

    Thanks for all the awesome help!

  11. 7 years ago
    Edited 7 years ago by SpyderBlack723

    Replace EAST with GUER

    It's possible to check for having all installations destroyed, but you'd have to figure either delay execution of it or figure out a way for it to avoid ending the mission immediately since there are no installations at mission start.

  12. What if you start off with Insurgent buildings via placement? Like low level installations to begin with?

  13. Edited 7 years ago by SpyderBlack723

    Untested, but worth a try

    In your init.sqf put

    [] execVM "script.sqf";

    In your script.sqf (in the root of your mission), put the contents of this link
    https://gist.github.com/SpyderBlack723/b15f59b6a1928842aeae

    All you have to do is change

    private _asymmFaction = "OPF_G_F";

    to whatever faction you have for the insurgents.

    This script begins checking after 20 minutes into the game to avoid an instant ending mission.

  14. Sweet, thanks Spyder.

  15. Edited 7 years ago by DaVidoSS

    Undefined variable _OPCOM_HANDLER?
    Exiting with ALiVE_installationsActive = true where
    ALiVE_installationsActive is defined as true already make any sense?
    I am asking because i am interested to implement any end mission to alive insurgency

  16. Edited 7 years ago by SpyderBlack723

    Ah, forget to change a variable name.

    Switch all instances of _OPCOM_HANDLER to _objective

  17. How to simply count current insurgents installations?

  18. Hi.

    I am trying to find a way to define dominant faction while mission is running.
    For now i have this:

    fnc_getdominant = {
    
    private ["_objectivePosW", "_aliveunitsW", "_entitiesCountW", "_objectivePosE", "_aliveunitsE", "_entitiesCountE", "_w", "_profiledEntCountW", "_profiledVehCountW", "_e", "_profiledEntCountE", "_profiledVehCountE", "_return"];
    
    	_objectivePosW = [];
    	_aliveunitsW = [];
    	_entitiesCountW = 0;
    	_objectivePosE = [];
    	_aliveunitsE = [];
    	_entitiesCountE = 0;
    
    	for "_w" from 0 to count ([OPCOM_instances select 0,"objectives",[]] call ALiVE_fnc_hashGet) -1 do {
    
    		_objectivePosW pushback (((([OPCOM_instances select 0,"objectives",[]] call ALiVE_fnc_hashGet) select _w ) select 2) select 1);
    		_profiledEntCountW = count ([_objectivePosW select _w, 500, ["WEST","entity"]] call ALIVE_fnc_getNearProfiles);
    		_profiledVehCountW = count ([_objectivePosW select _w, 500, ["WEST","vehicle"]] call ALIVE_fnc_getNearProfiles);
    		_entitiesCountW = _entitiesCountW + (_profiledEntCountW + _profiledVehCountW);
    
    	};
    
    	{
    		if (side _x == West) then {
    			
    			_aliveunitsW pushBack _x;
    		}
    	} forEach allunits;
    
    	
    	for "_e" from 0 to count ([OPCOM_instances select 1,"objectives",[]] call ALiVE_fnc_hashGet) -1 do {
    
    		_objectivePosE pushback (((([OPCOM_instances select 1,"objectives",[]] call ALiVE_fnc_hashGet) select _e ) select 2) select 1);
    		_profiledEntCountE = count ([_objectivePosE select _e, 500, ["EAST","entity"]] call ALIVE_fnc_getNearProfiles);
    		_profiledVehCountE = count ([_objectivePosE select _e, 500, ["EAST","vehicle"]] call ALIVE_fnc_getNearProfiles);
    		_entitiesCountE = _entitiesCountE + (_profiledEntCountE + _profiledVehCountE);
    
    	};
    
    	{
    		if (side _x == East) then {
    			
    			_aliveunitsE pushBack _x;
    		}
    	} forEach allunits;
    
    	_return = [_entitiesCountW + (count _aliveunitsW), _entitiesCountE + (count _aliveunitsE)];
    	_return
    };

    This is returning count of alive units + profiled for each side in format :

    [west, east]
    example:
    [145,193]

    Is that anyway useful to define dominant faction couple times under game play and even end the mission on some big difference between this two indexes?

  19. Edited 7 years ago by SpyderBlack723

    Try this

    _fnc_getGlobalUnitCountBySide = {
    	private _west = 0;
    	private _east = 0;
    	private _indep = 0;
    
    	// count spawned units
    
    	{
    		switch (side _x) do {
    			case EAST: {_east = _east + 1};
    			case WEST: {_west = _west + 1};
    			case GUER: {_indep = _indep + 1};
    		};
    	} foreach allUnits; // use foreach so you only need to iterate through allUnits once
    
    	// count inactive profiles
    
    	private _inactiveProfilesBySide = ([ALiVE_profileHandler,"profilesInActiveBySide"] call ALIVE_fnc_hashGet) select 2;
    	_east = _east + (count ((_inactiveProfilesBySide select 0) select 1));
    	_west = _west + (count ((_inactiveProfilesBySide select 1) select 1));
    	_indep = _indep + (count ((_inactiveProfilesBySide select 2) select 1));
    
    
    	[_east,_west,_indep]
    };

    You could also change the allUnits loop to allGroups if you want to only count groups (probably the better option since counting profiles is only taking account a single group, and not each individual unit)

  20. Thanks Spyder works perfect.

  21. 5 years ago

    Hi!

    I don't know if this thread is alive anymore but I had couple of questions of the scripts above.

    I tried these scripts on my radio trigger (The vanilla mode where you activate it with radio commands alpha or beta).

    _profilesWest = count ([ALiVE_profileHandler, "getProfilesBySide", "WEST"] call ALIVE_fnc_profileHandler);
    _profilesEast = count ([ALiVE_profileHandler, "getProfilesBySide", "EAST"] call ALIVE_fnc_profileHandler);
    hint format ["Force Matchup \n West: %1 total groups \n East: %2 total groups", _profilesWest, _profilesEast];
    
    _forcePool1 = [ALIVE_globalForcePool, _faction1] call ALIVE_fnc_hashGet;
    _forcePool2 = [ALIVE_globalForcePool, _faction2] call ALIVE_fnc_hashGet;
    hint format ["Forcepool Values \n West: %1 total groups \n East: %2 total groups", _forcePool1, _forcePool2];

    It seemed to work when I tested in local but doesn't work on our dedicated server. The first script gives "scalar" instead of numbers and the second script gives "<nil>" instead of numbers.

    I am not an expert using scripts in Arma/Alive so any help is welcome. :)

 

or Sign Up to reply!