removing custom objective via trigger

  1. 7 years ago

    Hi, I'm trying to use a trigger to remove a custom objective named CustomObjectiveTatters

    I've been calling the script (described here - (http://alivemod.com/forum/2684-alive-and-scripting/0)

    with this in the trigger activated option

    ["CustomObjectiveTatters","GUER"] call cjb_RemoveObjectiveToSides;

    I'm getting this error

    20:39:08 File C:\Users\Pete\Documents\Arma 3 - Other Profiles\Pistol%20Pete\mpmissions\Checkpoint%20Sandybottom.Takistan\Scripts\opcomrem.sqf, line 17
    20:39:08 Error in expression <ctive", _id] call ALiVE_fnc_OPCOM;
    };
    } forEach _factions;
    } forEach OPCOM_INSTA>
    20:39:08 Error position: <forEach _factions;
    } forEach OPCOM_INSTA>
    20:39:08 Error Generic error in expression

    I've packed up the script in a .sqf named opcomrem.

    I've been using the other 'addobjective' script in the same trigger without difficulty, but can't fugure out what's wrong with the remove option.

    Can anyone help and or suggest another option to switch off an objective no longer required in scenario?

    Many thx

  2. Anyone? Is there anyway to remove an objective once assigned?

  3. Edited 7 years ago by marceldev89

    The side parameter should be an array. Call it like ["CustomObjectiveTatters", ["GUER"]] call cjb_RemoveObjectiveToSides;.

  4. Thanks for the reply, appreciated. Will gave that a try.

  5. Still can't get this working, getting the same error:-

    21:03:23 Error in expression <ctive", _id] call ALiVE_fnc_OPCOM;
    };
    } forEach _factions;
    } forEach OPCOM_INSTA>
    21:03:23 Error position: <forEach _factions;
    } forEach OPCOM_INSTA>
    21:03:23 Error foreach: Type String, expected Array
    21:03:23 File C:\Users\Pete\Documents\Arma 3 - Other Profiles\Pistol%20Pete\mpmissions\Checkpoint%20Sandybottom.Takistan\Scripts\opcomrem.sqf, line 17
    21:03:23 Error in expression <ctive", _id] call ALiVE_fnc_OPCOM;
    };
    } forEach _factions;
    } forEach OPCOM_INSTA>
    21:03:23 Error position: <forEach _factions;
    } forEach OPCOM_INSTA>
    21:03:23 Error Generic error in expression
    21:03:23 File C:\Users\Pete\Documents\Arma 3 - Other Profiles\Pistol%20Pete\mpmissions\Checkpoint%20Sandybottom.Takistan\Scripts\opcomrem.sqf, line 17

    I'm not familiar with the debugging process/scripting in general. Can anyone point me to a worked example of this cjb_RemoveObjectiveToSides function?

    I'm lost here :(

  6. Show us how you're calling the function. It should work just fine with the call I gave you.

  7. Thanks for your time & assistance.

    I used the text exactly as you provided -

    ["CustomObjectiveTatters", ["GUER"]] call cjb_RemoveObjectiveToSides;

    Cut and pasted straight into trigger activation field. Checked trigger firing normally, however getting that same error above.

    In same trigger, calling the add objective script, I'm using

    [["OFCOMMIL1", getMarkerPos "opforComRetake", 200,"MIL"],["GUER"]] call cjb_addObjectiveToSides; which calls the sister script, opcomadd.sqf from the same location, which works perfectly without a hitch.

    Both scripts are called from the init,

    nul = [] execVM "Scripts\opcomadd.sqf";
    nul = [] execVM "Scripts\opcomrem.sqf";

    The ofcomrem.sqf looks like this:

    cjb_RemoveObjectiveToSides =
    {
    private["_factions","_faction","_opcom","_opcomSide"];
    _id = _this select 0;
    _factions = _this select 1;
    {
    _opcom = _x;
    {
    _faction = _x;
    _opcomSide = [_opcom,"side",""] call ALiVE_fnc_HashGet;

    if( _opcomSide == _faction) then {
    [_opcom, "removeObjective", _id] call ALiVE_fnc_OPCOM;
    };
    } forEach _factions;
    } forEach OPCOM_INSTANCES;
    };

  8. I don't see anything wrong. ["CustomObjectiveTatters", ["GUER"]] call cjb_RemoveObjectiveToSides; should work just fine, you will have to replace the objective name with the correct one. Do you perhaps have another old trigger with the wrong call?

  9. That's the correct objective name (it's works ok for the add objective script). Tried the same call on a brand new map/mission, same result on line17. Also tried calling it from local exec & using azeus. Can't figure it out.

  10. You might want to try doing the call through the A3 debug console. I'll try to test it myself later today or tomorrow (a repro mission without any mods besides CBA and ALiVE would be useful).

  11. Made a fresh mission, stripped of everything except alive and cba. Add trigger works as before with the name of the new objective showing up for Ofcom in debug. Remove objective now fires (in as far as I can tell) without error, however I see no evidence that the objective has been removed (ie alive debug still shows it as a # X. Have waited 10 mins in mission is see the next ofcom/Taccom summary, but same number of objectives listed as prior to trigger.
    I think that the problem with the full mission with addons seems to be that although the custom objective is added after alive has initalised, it might not be being recognised as an official objective by the OPCOM in time before remove trigger fires, hence the objective can't be removed from a list which doesn't contain it yet.!
    Queries: how long does it take to add/remove - at the end of each cycle?
    Should the debug marker dissappear if the objective has been removed, or will it persist as a ghost?

    The pre-exsisting objectives, compiled as the game starts list each objective as a # number. These include the placed official civil & military objectives as well as the other custom markers. It it possible to use the remove script to destroy one of them or is the script purely for user placed custom objectives?

    (and separate issue,)
    Using the option to profile all units after startup (eg adding zeused in groups to OPCOM) - does turning on this option include editor placed units prior to initiallising the mission which were previously marked as exempt?

    Apologies for the number of questions. (and probably end user inspired misconceptions of how this all works) - I can only say I'm enjoying using the mod so much, I'm hooked.

  12. Edited 7 years ago by SavageCDN

    @guttersnipe I can only say I'm enjoying using the mod so much, I'm hooked.

    That's our plan... get you hooked then start charging you micropayments - "$1.99 to have your reinforcements arrive immediately in a working convoy".

    @guttersnipe Using the option to profile all units after startup (eg adding zeused in groups to OPCOM) - does turning on this option include editor placed units prior to initiallising the mission which were previously marked as exempt?

    I believe so but I'm not 100% sure.

    @guttersnipe think that the problem with the full mission with addons seems to be that although the custom objective is added after alive has initalised, it might not be being recognised as an official objective by the OPCOM in time before remove trigger fires, hence the objective can't be removed from a list which doesn't contain it yet.!

    Try delaying the triggers using the Condition field ie: time > 60 or

    waitUntil {(player getVariable ["alive_sys_player_playerloaded",false])};
  13. @guttersnipe how long does it take to add/remove - at the end of each cycle?

    The cycle time for OPCOM is 300 seconds (5 minutes)

    @guttersnipe Should the debug marker dissappear if the objective has been removed, or will it persist as a ghost?

    It's possible that it leaves a ghost marker. One way to check it is through the Intel tablet and selecting the objectives option somewhere in there.

    @guttersnipe The pre-exsisting objectives, compiled as the game starts list each objective as a # number. These include the placed official civil & military objectives as well as the other custom markers. It it possible to use the remove script to destroy one of them or is the script purely for user placed custom objectives?

    Yes that function should work just as well for "normal" objectives.

    @guttersnipe Using the option to profile all units after startup (eg adding zeused in groups to OPCOM) - does turning on this option include editor placed units prior to initiallising the mission which were previously marked as exempt?

    To confirm @SavageCDN 's believes, yes that's correct. :)

  14. That's cleared up a lot for me.

    Thank you all for your time and patience.

 

or Sign Up to reply!