Jump to content

rkemsley

Member
  • Content Count

    73
  • Joined

  • Last visited

  • Medals

Posts posted by rkemsley


  1. I am trying to make a repeating script that spawns a cargo box randomly on the map (within my trigger area).

     

    The cargo box spawns with an "holdAction" attached and a map marker to show the location the cargo box has spawned at. Once the "holdAction" has been completed, the cargo box is removed, "CuratorPoints" are added to the side that secured the box and the map marker is also removed.

     

    My current script can spawn the cargo box, with the map marker, at the start of the game. However, I am unsure how to repeat the trigger, or have the cargo box removed once the "holdAction" has been completed.

    Spoiler

    _randomPosition = [];

    _loopCount = 0;

    while { _randomPosition isEqualTo [] && _loopCount < 100 } do {

        _randomPosition = Zeus_T_DropZone1_1 call BIS_fnc_randomPosTrigger;

        _randomPosition = _randomPosition findEmptyPosition [ 0, 0 ];

        _loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found

    };

     

    _mrk = createMarker [ "Zeus_M_PickUp1_1", _randomPosition ];

    _mrk setMarkerShape "ICON";

    _mrk setMarkerSize [ 0.8, 0.8 ];

    _mrk setMarkerType "hd_pickup";

    _mrk setMarkerColor "ColorGUER";

     

    _cargoNet = createVehicle [ "CargoNet_01_box_F", getMarkerPos _mrk, [], 0, "NONE" ];

    if ( isTouchingGround _cargoNet ) then {

        _cargoNet setDamage 1;

    };

     

    [

        _cargoNet,

        "Secure Airdrop",

        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

        "_this distance _target < 3.5 && side _this == west && isPlayer _this",

        "_caller distance _target < 3.5 && side _this == west && isPlayer _this",

        {},

        {},

        {

            _this call {

                deleteVehicle _target; {

                    if ( ( side getAssignedCuratorUnit _x ) == west ) then {

                        [ _x, ( 0.3 / ( { ( alive _x ) and ( side _x == west ) } count playableUnits ) ) ] remoteExec [ "addCuratorPoints", 0, true ];

                    };

                } foreach allCurators;

                deleteMarker "Zeus_M_PickUp1_1";

            };

        },

        {},

        [],

        5,

        0,

        true,

        false

    ] remoteExec [ "BIS_fnc_holdActionAdd", 0, _cargoNet ];

     

    [

        _cargoNet,

        "Secure Airdrop",

        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

        "_this distance _target < 3.5 && side _this == independent",

        "_caller distance _target < 3.5 && side _this == independent",

        {},

        {},

        {

            _this call {

                deleteVehicle _target; {

                    if ( ( side getAssignedCuratorUnit _x ) == independent ) then {

                        [ _x, 0.3 ] remoteExec [ "addCuratorPoints", 0, true ];

                    };

                } foreach allCurators;

                deleteMarker "Zeus_M_PickUp1_1";

            };

        },

        {},

        [],

        5,

        0,

        true,

        false

    ] remoteExec [ "BIS_fnc_holdActionAdd", 0, _cargoNet ];

    Later on, I would like it to be like a proper airdrop, but currently, I'd just like it just to actually appear on the map.

     

    Please help!


  2. Ok, so I just made it so that when a BLUFOR Curator is killed, his rating is reduced to "-1e6" (basically making him sideEnemy and no longer west).

     

    So this is my current "onPlayerRespawn.sqf"

    Spoiler

    if ( side player == west ) then {
        _spawnPos = selectRandom 
        [ 
            [ "Zeus_M_BLUFORSpawn1_1", 340.945 ],
            [ "Zeus_M_BLUFORSpawn1_2", 324.523 ],
            [ "Zeus_M_BLUFORSpawn1_3", 33.747 ],
            [ "Zeus_M_BLUFORSpawn1_4", 230.808 ],
            [ "Zeus_M_BLUFORSpawn1_5", 253.321 ],
            [ "Zeus_M_BLUFORSpawn1_6", 45.909 ],
            [ "Zeus_M_BLUFORSpawn1_7", 177.269 ],
            [ "Zeus_M_BLUFORSpawn1_8", 0 ],
            [ "Zeus_M_BLUFORSpawn1_9", 180 ],
            [ "Zeus_M_BLUFORSpawn2_1", 48.2553 ] 
        ];
        player setPos ( getMarkerPos ( _spawnPos select 0 ) );
        player setDir ( _spawnPos select 1 );

        player enableSimulationGlobal false;
        [ player, true ] remoteExec [ "hideObjectGlobal", 0, true ];
        player allowDamage false;
        player enableStamina false;

        player addRating -1e6;

        [
            ZeusBLUFOR1_1_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [
            ZeusBLUFOR1_2_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [
            ZeusBLUFOR1_3_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [ true, true ] call BIS_fnc_forceCuratorInterface;
        openCuratorInterface;
    };

     


  3. So, I had a go at writing a short script to end the game once all BLUFOR Curators have died at least once.

     

    The idea is that I create a variable in my "initServer.sqf" that acts as a sort of counter. The game ends when the counter equals the number of BLUFOR playable units on the map.

    Spoiler

    publicVariable "EndgameBLUFOR";

    EndgameBLUFOR = 0;

     

    if ( EndgameBLUFOR = ( { ( side _x == west ) } count playableUnits ) ) then {

        independent addScoreSide 250;

        west addScoreSide -( scoreSide west );

        sleep 5;

        "SideScore" call BIS_fnc_endMissionServer;

    };

    In my "onPlayerKilled.sqf", I have made it so that it adds 1 to the variable every time a BLUFOR Curator dies.

    Spoiler

    if ( side player == west ) then {

        EndgameBLUFOR = EndgameBLUFOR + 1;

        [ true, true ] call BIS_fnc_forceCuratorInterface;

        openCuratorInterface;

    };

    Doesn't really work! Wondering if anyone has a better way of doing this.


  4. In my Zeus vs Guerilla Zeus game, there are three BLUFOR Curators vs one Independent Curator.

     

    The Independent Curator wins when all of the BLUFOR Curators have died. However, the games can last quite a long time, and it can be quite boring for the dead BLUFOR Curators to sit out for the rest of the game. What I have decided is that once a BLUFOR Curator is killed, he respawns and is forced to play just in Curator mode. He is now unable to spawn more units and is only able to command BLUFOR units already on the map or control said units.

     

    I have written a short "onPlayerRespawn.sqf" script to do this (however, it is untested because I am currently at work).

    Spoiler

    if ( side player == west ) then {
        _spawnPos = selectRandom 
        [ 
            [ "Zeus_M_BLUFORSpawn1_1", 340.945 ],
            [ "Zeus_M_BLUFORSpawn1_2", 324.523 ],
            [ "Zeus_M_BLUFORSpawn1_3", 33.747 ],
            [ "Zeus_M_BLUFORSpawn1_4", 230.808 ],
            [ "Zeus_M_BLUFORSpawn1_5", 253.321 ],
            [ "Zeus_M_BLUFORSpawn1_6", 45.909 ],
            [ "Zeus_M_BLUFORSpawn1_7", 177.269 ],
            [ "Zeus_M_BLUFORSpawn1_8", 0 ],
            [ "Zeus_M_BLUFORSpawn1_9", 180 ],
            [ "Zeus_M_BLUFORSpawn2_1", 48.2553 ] 
        ];
        player setPos ( getMarkerPos ( _spawnPos select 0 ) );
        player setDir ( _spawnPos select 1 );

        player enableSimulationGlobal false;
        player hideObjectGlobal true;
        player allowDamage false;
        player enableStamina false;

        [
            ZeusBLUFOR1_1_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [
            ZeusBLUFOR1_2_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [
            ZeusBLUFOR1_3_Curator, 

            [
                "ModuleRemoteControl_F", 0
            ]

        ]    call bis_fnc_curatorObjectRegisteredTable;

        [ true, true ] call BIS_fnc_forceCuratorInterface;
        openCuratorInterface;
    };

    Wondering if anyone has any advice on a better way of doing this! Also, I have a problem now with ending the game due to the BLUFOR Curators respawning. Before, I had it so that the game ended and Independent won when all BLUFOR players were dead, which obviously won't work now!

     

    Edit: Ok, so I just got back from work and tested my script. It does work, provided that in my "description.ext" I have specified "respawnOnStart = -1;".
     

    What I am wondering is how I would then make Independent win when all BLUFOR Curators have died (now that they can respawn). Before, I had a trigger:

    Spoiler


    Type: None

    Activation: None

    Activation Type:

    Repeatable: "Uncheck"
    Server Only: "Uncheck"

    Condition: ( { ( alive _x ) and ( side _x == west ) } count playableUnits ) < 1
    On Activation: independent addScoreSide 250; west addScoreSide -( scoreSide west ); "SideScore" call BIS_fnc_endMissionServer;

    Obviously, this will no longer work ^^


  5. @pierremgi

    Spoiler
    On 7/1/2021 at 12:25 AM, pierremgi said:

    Here is a little script for making things go well, locally, (so without any exchange on net, resource and net friendly):

     

    In initPlayerLocal.sqf (so the player already exists locally on his PC)


     

    
    
    MGI_restrictedArea = {
        params [["_trig",objNull]];
        private _timer = -1;
        private _timeToDeath = _trig getVariable ["timeToDeath",0];
        while {alive player && triggerActivated _trig && _timer <= _timeToDeath} do {
            _timer = _timer +1;
            titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 1, false, true ];
                    sleep 1;
        };
        if (triggerActivated _trig && alive player) then {
            vehicle player setDamage 1;
        };
    };
    
    private _trig = createTrigger ["emptyDetector",[1760.21,5787.81,0],FALSE];
    _trig settriggerInterval 2;
    _trig setTriggerArea [250, 250, 0, false, -1];
    _trig setTriggerActivation ["ANYPLAYER","PRESENT",TRUE];
    _trig setTriggerStatements ["thisList findIf {local _x} > -1",
      "thisTrigger spawn MGI_restrictedArea",
      "if (alive player) then {titleText [ '<t size=""4"" color=""#00ff00"" shadow=""2"" > AUTHORISED AREA </t><br/><t size=""2"" shadow=""2"" >You re leaving the forbidden zone</t>','PLAIN',1,false,true]};
    "];
    _trig setVariable ["timeToDeath",20];

    Explanation:
    The function MGI_restrictedArea is spawned by trigger activation.
    I created a trigger, on coordinates I picked in editor on a due position for test. False here means local effect (makeGlobal false), on the contrary of all edited triggers which are EG.
    The trigger interval is just the interval for the condition to be checked. It's so easy here, I didn't resist to add it but you can skip this line and the trigger will check every 0.5 sec as usual. It's just as reminder for saving resource (always in mind for MP)

    The area is 250 radius, circle, no ceiling...

    the activation is any player (There are other means but it's a working example), present , repeatable;

    the statements (must be stringed unfortunately but it's not so difficult:

     *  the condition: ⚠️ As I'm using the preset condition "any player present", of course, even locally, the trigger will fire on every pc! So I'm just checking for thisList (players) containing a local entities (a player is always local to his PC lol) This way, only one trigger is concerned!

    * now, I'm really local and I can do what I want with the area and a timer. While the trigger is activated, the timer increases and the player must leave or die.

    * I added a little code for player leaving the area. Feel free to change any parameter for timer or sleep or text time ...

     

    As you can see, I kill vehicle player instead of player. It's up to you. Player inside a vehicle will blow up with it, player on foot will die.

    There is no code for units in player group, or abandoned vehicles...

    You can kill, for example : units player select {_x in area _trig}    or else.

     

     

     

    I am planning on combining your "MGI_restrictedArea" function (because it works extremely well!) with my original plan. (Yeah, I know I am being awkward, but I really need CuratorEditable units to also die if they leave the area).

     

    Basically, I am going to have sided kill zones, one for BLUFOR and one for Independent.


    BLUFOR kill zone:

    Spoiler

    ZeusBLUFOR_T_ZoneRestriction1_1
    Type: None

    Activation: BLUFOR

    Activation Type: Present

    Repeatable: "Check"
    Server Only: "Uncheck"

    Condition: this && round ( time %1 ) == 1
    On Activation: { if ( alive _x && [ _x ] call BIS_fnc_isCuratorEditable isEqualTo true ) then { _x setDamage 1; }; } foreach thisList;

    CountdownMin: 10 Mid: 10 Max: 10

    Independent kill zone:

    Spoiler

    ZeusIndependent_T_ZoneRestriction1_1
    Type: None

    Activation: Independent

    Activation Type: Present

    Repeatable: "Check"
    Server Only: "Uncheck"

    Condition: this && round ( time %1 ) == 1
    On Activation: { if ( alive _x && [ _x ] call BIS_fnc_isCuratorEditable isEqualTo true ) then { _x setDamage 1; }; } foreach thisList;

    CountdownMin: 10 Mid: 10 Max: 10

    (Would you recommend "Checking" server only for these kills zones?)

     

    Then I was going to use your script to create the warning message for the players, so I can confirm that the message is local to the unit in the zone.

     

    "initPlayerLocal.sqf"

    Spoiler

    MGI_restrictedArea = {

        params [ [ "_trig", objNull ] ];

        while { alive player && triggerActivated _trig } do {

            titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 0.1, false, true ];

            sleep 1;

        };

    };

    Spoiler

    private _trig = createTrigger [ "emptyDetector", [ 16600, 24350, 0 ], false ];

    _trig settriggerInterval 2;

    _trig setTriggerArea [ 4000, 1050, 0, true, -1 ];

    _trig setTriggerActivation [ "ANYPLAYER", "PRESENT", true ];

    _trig setTriggerStatements [ "thisList findIf {local _x} > -1", "thisTrigger spawn MGI_restrictedArea", "" ];

     

    private _trig = createTrigger [ "emptyDetector", [ 19550, 20800, 0 ], false ];

    _trig settriggerInterval 2;

    _trig setTriggerArea [ 1050, 2500, 0, true, -1 ];

    _trig setTriggerActivation [ "ANYPLAYER", "PRESENT", true ];

    _trig setTriggerStatements [ "thisList findIf {local _x} > -1", "thisTrigger spawn MGI_restrictedArea", "" ];

     

    private _trig = createTrigger [ "emptyDetector", [ 16600, 17250, 0 ], false ];

    _trig settriggerInterval 2;

    _trig setTriggerArea [ 4000, 1050, 0, true, -1 ];

    _trig setTriggerActivation [ "ANYPLAYER", "PRESENT", true ];

    _trig setTriggerStatements [ "thisList findIf {local _x} > -1", "thisTrigger spawn MGI_restrictedArea", "" ];

     

    private _trig = createTrigger [ "emptyDetector", [ 13650, 20800, 0 ], false ];

    _trig settriggerInterval 2;

    _trig setTriggerArea [ 1050, 2500, 0, true, -1 ];

    _trig setTriggerActivation [ "ANYPLAYER", "PRESENT", true ];

    _trig setTriggerStatements [ "thisList findIf {local _x} > -1", "thisTrigger spawn MGI_restrictedArea", "" ];

     

     

    There's another thing I am wondering about this script. Could I make it local to all BLUFOR\Independent units that enter the zone rather than only players (or would that be too taxing for the system)?

     

    Having the message pop up, for units currently being controlled by Zeus (within the kill zone), would be a nice little effect. However, Arma doesn't recognise units being controlled by Zeus to be players, so the message won't appear on them (that's why it would need to be local to all BLUFOR\Independent units in the zone).

     

    I would test this stuff first before asking, however, it's quite difficult for me to test this sort of trigger just on my own (because I am unable to test whether it is local or displayed to all players), so I was wondering about your theory/idea first before I give it a try. Just to see if you think it would work?


  6. @pierremgi

    Spoiler
    1 hour ago, pierremgi said:

    Here is a little script for making things go well, locally, (so without any exchange on net, resource and net friendly):

     

    In initPlayerLocal.sqf (so the player already exists locally on his PC)


     

    
    
    MGI_restrictedArea = {
        params [["_trig",objNull]];
        private _timer = -1;
        private _timeToDeath = _trig getVariable ["timeToDeath",0];
        while {alive player && triggerActivated _trig && _timer <= _timeToDeath} do {
            _timer = _timer +1;
            titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 1, false, true ];
                    sleep 1;
        };
        if (triggerActivated _trig && alive player) then {
            vehicle player setDamage 1;
        };
    };
    
    private _trig = createTrigger ["emptyDetector",[1760.21,5787.81,0],FALSE];
    _trig settriggerInterval 2;
    _trig setTriggerArea [250, 250, 0, false, -1];
    _trig setTriggerActivation ["ANYPLAYER","PRESENT",TRUE];
    _trig setTriggerStatements ["thisList findIf {local _x} > -1",
      "thisTrigger spawn MGI_restrictedArea",
      "if (alive player) then {titleText [ '<t size=""4"" color=""#00ff00"" shadow=""2"" > AUTHORISED AREA </t><br/><t size=""2"" shadow=""2"" >You re leaving the forbidden zone</t>','PLAIN',1,false,true]};
    "];
    _trig setVariable ["timeToDeath",20];

    Explanation:
    The function MGI_restrictedArea is spawned by trigger activation.
    I created a trigger, on coordinates I picked in editor on a due position for test. False here means local effect (makeGlobal false), on the contrary of all edited triggers which are EG.
    The trigger interval is just the interval for the condition to be checked. It's so easy here, I didn't resist to add it but you can skip this line and the trigger will check every 0.5 sec as usual. It's just as reminder for saving resource (always in mind for MP)

    The area is 250 radius, circle, no ceiling...

    the activation is any player (There are other means but it's a working example), present , repeatable;

    the statements (must be stringed unfortunately but it's not so difficult:

     *  the condition: ⚠️ As I'm using the preset condition "any player present", of course, even locally, the trigger will fire on every pc! So I'm just checking for thisList (players) containing a local entities (a player is always local to his PC lol) This way, only one trigger is concerned!

    * now, I'm really local and I can do what I want with the area and a timer. While the trigger is activated, the timer increases and the player must leave or die.

    * I added a little code for player leaving the area. Feel free to change any parameter for timer or sleep or text time ...

     

    As you can see, I kill vehicle player instead of player. It's up to you. Player inside a vehicle will blow up with it, player on foot will die.

    There is no code for units in player group, or abandoned vehicles...

    You can kill, for example : units player select {_x in area _trig}    or else.

     

    I'd like this to also affect all CuratorEditable units as well (so the Curator doesn't just send AI out of the map).

     

    Would I change the "Any Player" part to west/independent? Then in the conditions, use what I had for my initial script ("{ if ( alive _x && [ _x ] call BIS_fnc_isCuratorEditable isEqualTo true ) then { _x setDamage 1; }; } foreach thisList;")?

     

    Edit: Does the name of the trigger matter as I am creating the triggers locally, there wont be an issue of potentially 4 triggers of the same name spawned in one map (My map has max players of 4, so that's means there could be up to 16 triggers being loaded into the game. 4 for every side of the playable area.)


  7. 55 minutes ago, pierremgi said:

    Yes, fine. If you are using a anyPlayer present   as preset condition, you don't need to specify if (isPlayer _x) then {...} because thisList is composed with players only.
    On the other hand the first player entering a area will activate the trigger, and, as you made it not server only, the trigger will fire on each PC, no matter the player who acted it. (So, any player will read the message!).

    Here you should write:

    { if ( local _x ) then { titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 0.1, false, true ]; }; } foreach thisList;

     

    Imho, there is a better solution with scripted triggers local (see above) from initPlayerLocal.sqf. If I have time I'll send you a code for this zone restriction.

    I think you are probably right about using "local scripted triggers".

     

    What I am wondering is about the name of the local trigger when it is created. If I write something like this:

    Spoiler

    Zeus_T_ZoneRestriction1_1 = createTrigger [ "EmptyDetector", [ 16600, 24350, 0 ], false ];
    Zeus_T_ZoneRestriction1_1 setTriggerArea [ 4000, 1050, 0, true, -1 ];
    Zeus_T_ZoneRestriction1_1 setTriggerActivation [ "ANYPLAYER", "PRESENT", true ];
    Zeus_T_ZoneRestriction1_1 setTriggerStatements [
        "this && round ( time %1 ) == 1",
        "{
            if ( local _x ) then { titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 0.1, false, true ];
            };
        } foreach thisList;",
        ];

    ...and have this located in my "initPlayerLocal.sqf", should do the trick on making the message local? (I'll also need to have another 3 more, so I have 4 in total).


  8. Sorry, I didn't update what I did in the end.

     

    So I took a look at how BI creates the kill zones around their map. They seem to occasionally just use two triggers, one which gives a warning, then another one further back which kills the player (I have just done this).

     

    Quote

    Zeus_T_ZoneRestriction1_1
    Type: None

    Activation: Any Player

    Activation Type: Present

    Repeatable: "Check"
    Server Only: "Uncheck"

    Condition: this && round ( time %1 ) == 1
    On Activation: { if ( isPlayer _x ) then { titleText [ "<t size='4' color='#ff0000' shadow='2' > UNAUTHORISED ZONE </t> <br/> <t size='2' shadow='2' > Return to the playable area </t>", "PLAIN", 0.1, false, true ]; }; } foreach thisList;

     

    Quote

    Zeus_T_ZoneRestriction2_1
    Type: None

    Activation: Anybody

    Activation Type: Present

    Repeatable: "Check"
    Server Only: "Uncheck"

    Condition: this && round ( time %1 ) == 1
    On Activation: { if ( alive _x && [ _x ] call BIS_fnc_isCuratorEditable isEqualTo true ) then { _x setDamage 1; }; } foreach thisList;

    CountdownMin: 10 Mid: 10 Max: 10

     

    • Like 1

  9. Currently attempting to make a multiplayer friendly Zeus zone restrictions script.

     

    Basically, around my map, I need a kill zone that kills all units, players, or units editable by the curator, that leave the playable map area (enter the kill zone) after a ten second delay. I also need it so that if a player unit leaves the zone, they get a warning message too.

    I am using the "ModuleCoverMap" to show the playable area. Around the edges of the playable map area I have four triggers that start the kill script for the player/Curator editable AI.

    Quote

    Zeus_T_ZoneRestriction1_1
    Type: None

    Activation: Anybody

    Activation Type: Present

    Repeatable: "Check"
    Server Only: "Uncheck"

    Condition: this && round ( time %1 ) == 1
    On Activation: zoneR = [ thisTrigger ] execVM "zoneRestriction.sqf";

     

    Quote

    // zoneRestriction.sqf

     

    _triggerActivated = _this select 0;

     

    {

        if ( ( _x in ( list _triggerActivated ) ) && ( [ _x ] call BIS_fnc_isCuratorEditable isEqualTo true ) && ( alive _x ) ) then {

            titleText [ "<t size='4' color='#ff0000' font='PuristaSemibold' shadow='0' > UNAUTHORISED ZONE </t> <br/> <t size='2' font='PuristaSemibold' shadow='0' > Turn back now </t>", "PLAIN", 1, false, true ];

            sleep 10;

            _x setDamage 1;

        };

    } foreach allUnits + vehicles;

    Above is a very basic (semi) working zone restriction script. 

     

    Currently, if a single unit enters the trigger, the script starts running, the problem is, if another unit enters two seconds later, they only have eight seconds to leave the restriction zone, rather than the ten seconds they are supposed to have (they should be killed later than the first unit, but the two units die at the same time). Also, I am unsure how the titleText function works for clients. It says on Biki that the titleText is a local effect, however, I am wondering if there is a better function for showing a warning message.


  10. 15 hours ago, pierremgi said:
    
    private _CacheN =
    [
      ["Zeus_M_Unknown1_1", FIAWeaponCacheN1_1],
      ["Zeus_M_Unknown1_2", FIAWeaponCacheN1_2],
      ["Zeus_M_Unknown1_3", FIAWeaponCacheN1_3]
    ];
    _CacheN deleteAt selectRandom [0,1,2];
    {
      deleteMarker (_x#0);
      deleteVehicle (_x#1);
    } count _CacheN;
    
    private _CacheS =
    [
      [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],
      [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],
      [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]
    ];
    _CacheS deleteAt selectRandom [0,1,2];
    {
      deleteMarker (_x#0);
      deleteVehicle (_x#1);
    } count _CacheS;

    No reason for making things complicated. No reason for remote executing deleteMarker command, if you didn't create them locally (in editor, you didn't).

     

    I tried a method similar to this earlier (without remote executing deleteMarker) and it worked fine when testing it by starting the map in Multiplayer (where I am the server). However, as soon as I test it when I am just a client, if I don't remote execute the markers they still appear on map initiation for everyone.

    On another note, I have changed what the caches are, basically making them spawn in buildings that have a bunch of stuff inside them (removing the stuff if the cache hasn't been chosen to spawn there).

    Spoiler

    private _Cache1 =

    [

        [ "Zeus_M_Unknown1_1", getMissionLayerEntities "Layer_FIASupplyCache1_1" select 0 ],

        [ "Zeus_M_Unknown1_2", getMissionLayerEntities "Layer_FIASupplyCache1_2" select 0 ],

        [ "Zeus_M_Unknown1_3", getMissionLayerEntities "Layer_FIASupplyCache1_3" select 0 ]

    ];

    _deleteCache1 = selectRandom _Cache1;

    _Cache1 deleteAt ( _Cache1 findIf { _deleteCache1 isEqualTo _x } ); {

        [ _x select 0 ] remoteExec [ "deleteMarker", 0, true ];

        [ { deleteVehicle _x } forEach (  _x select 1 ) ] remoteExec [ "call", 0, true ];

    } foreach _Cache1;

     

    private _Cache2 =

    [

        [ "Zeus_M_Unknown2_1", getMissionLayerEntities "Layer_FIASupplyCache2_1" select 0 ],

        [ "Zeus_M_Unknown2_2", getMissionLayerEntities "Layer_FIASupplyCache2_2" select 0 ],

        [ "Zeus_M_Unknown2_3", getMissionLayerEntities "Layer_FIASupplyCache2_3" select 0 ]

    ];

    _deleteCache2 = selectRandom _Cache2;

    _Cache2 deleteAt ( _Cache2 findIf { _deleteCache2 isEqualTo _x } ); {

        [ _x select 0 ] remoteExec [ "deleteMarker", 0, true ];

        [ { deleteVehicle _x } forEach ( _x select 1 ) ] remoteExec [ "call", 0, true ];

    } foreach _Cache2;

    This seems to be working as intended, but I haven't tested it as a client yet. Only as the server.

     

    Edit: it does work client-side as well.

     

    Edit Edit: pierremgi, what are you confused about? When you wrote your version of the script, did you test it by having your computer remotely run the server, then join as a client, rather than hosting the server through Arma 3 yourself? Because I tried a method which was pretty much what you wrote, and it doesn't work client-side.

    • Confused 1

  11. Quote

    private _CacheN =

    [

        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],

        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],

        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]

    ];

    _deleteCacheN = selectRandom _CacheN;

    _CacheN deleteAt ( _CacheN findIf { _deleteCacheN isEqualTo _x } ); {

        [ _x select 0 ] remoteExec [ "deleteMarker", 0, true ];

        deleteVehicle ( _x select 1 );

    } foreach _CacheN;

     

    private _CacheS =

    [

        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],

        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],

        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]

    ];

    _deleteCacheS = selectRandom _CacheS;

    _CacheS deleteAt ( _CacheS findIf { _deleteCacheS isEqualTo _x } ); {

        [ _x select 0 ] remoteExec [ "deleteMarker", 0, true ];

        deleteVehicle ( _x select 1 );

    } foreach _CacheS;

    Ok, this is now working for multiplayer.


  12. Spoiler
    11 hours ago, sarogahtyp said:

    not strange, just how sqf code works.

     

    What strikes me is that you just throw one question after the other without learning bout the answers. That way you ll produce patched up scripts and missions full of slow code and full of bugs...

    Nice advice: Read the biki-entries for any command you use carefully. This is the way to learn sqf-scripting effective and it is the fastest way as well.

     

    https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands

     

    Anyways this is not tested but should work:

     

    
    
    private ["_dummy"];
    
    private _CachesN =
    [
        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],
        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],
        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]
    ];
    
    private _CachesS =
    [
        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],
        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],
        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]
    ];
    
    _leftOverCacheN = selectRandom _CachesN;
    _leftOverCacheS = selectRandom _CachesS;
    
    _dummy = _CachesN deleteAt findIf { _leftOverCacheN isEqualTo _x };
    _dummy = _CachesS deleteAt findIf { _leftOverCacheS isEqualTo _x };
    
    _CachesN append _CachesS;
    
    {
     deleteMarker ( _x select 0 );
     deleteVehicle ( _x select 1 );
    } count _CachesN;

     

     

    Gave this a go, unfortunately, it didn't seem to work. It keeps telling me there "_dummy = _CachesN deleteAt |#|findIf { _leftOverCache isEqualTo _x };...", "Error Undefined variable in expression: findif" and "Error Mission ;"

     

    I think I see what you are doing. Taking away one Array from the other. I tried this but it didn't like this either.

    Spoiler

    private _CacheN =

    [

        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],

        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],

        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]

    ];

    _deleteCacheN = selectRandom _CacheN;

    _CacheN = _CacheN - [ [ _deleteCacheN ] ];

    { deleteMarker _x } foreach ( _CacheN select 0 );

    { deleteVehicle _x } foreach ( _CacheN select 1 );

     

    private _CacheS =

    [

        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],

        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],

        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]

    ];

    _deleteCacheS = selectRandom _CacheS;

    _CacheS = _CacheS - [ [ _deleteCacheS ] ];

    { deleteMarker _x } foreach ( _CacheS select 0 );

    { deleteVehicle _x } foreach ( _CacheS select 1 );

     

    Edit: I kinda feel like this is starting to become a test. Anyway, the code below now works. (Feel free to add your criticism about how little I know about coding).

    Spoiler

    private _CacheN =

    [

        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],

        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],

        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]

    ];

    _deleteCacheN = selectRandom _CacheN;

    _CacheN deleteAt ( _CacheN findIf { _deleteCacheN isEqualTo _x } ); { 

        deleteMarker ( _x select 0 );

        deleteVehicle ( _x select 1 );

    } foreach _CacheN;

     

    private _CacheS =

    [

        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],

        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],

        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]

    ];

    _deleteCacheS = selectRandom _CacheS;

    _CacheS deleteAt ( _CacheS findIf { _deleteCacheS isEqualTo _x } ); {  

        deleteMarker ( _x select 0 );

        deleteVehicle ( _x select 1 );

    } foreach _CacheS;

     

    Edit Edit: It works fine when testing it as the server, however, when I test it as a client, it doesn't work. So, on map initiation, the weapon caches get deleted, but all of the map markers are still visible. I have the script located in my "initServer.sqf".


  13. 6 hours ago, sarogahtyp said:

    Those curly brackets above and below your deletion parts are nonsense. Idk if it causes this but it could.

    Strangely, that was actually the cause.

    Spoiler

    _deleteCacheN = selectRandom

    [

        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],

        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],

        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]

    ];

    deleteMarker ( _deleteCacheN select 0 );

    deleteVehicle ( _deleteCacheN select 1 );

     

    _deleteCacheS = selectRandom

    [

        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],

        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],

        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]

    ];

    deleteMarker ( _deleteCacheS select 0 );

    deleteVehicle ( _deleteCacheS select 1 );

    So this script obviously deletes one of the FIAWeaponCaches from each weapon cache Array. What I am wondering how to do is get it so that it deletes all the weapons caches except for the ones picked randomly from each group.


  14. 15 minutes ago, pierremgi said:

    For BLUFOR_Player1_1:

     

    
    if (isServer) then {
         [] spawn {
           while {true} do {
             waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } >-1};
             ZeusBLUFOR1_1_Curator removeCuratorEditingArea 1;
             waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } == -1};
             ZeusBLUFOR1_1_Curator addCuratorEditingArea [1, position BLUFOR_Player1_1, 40];
          };
        };
    };

     

    Just a quick question about why this is a better way of writing what I've already put.

     

    I can see that the check for Independent/East is a much cleaner way of doing what my script already does, I'm just wondering why you suggest using:

    14 minutes ago, pierremgi said:

    if (isServer) then {

    and:

    15 minutes ago, pierremgi said:

    {BLUFOR_Player1_1 distance2D _x < 40} } >-1};

    15 minutes ago, pierremgi said:

    {BLUFOR_Player1_1 distance2D _x < 40} } == -1};

     


  15. I have 6 potential FIA Weapon Caches scattered around the map. (3 normal weapon caches, 3 special weapon caches). At the start of the mission, I would like all except for 1 from each weapon cache type to be deleted from the map, so I am only left with 2 weapon caches on the map. (Each weapon cache has a local map icon that shows the BLUFOR player where the weapon cache is located, which needs to be deleted as well).

    My current script, located in my "initServer.sqf".

    Spoiler

    _deleteCacheN = selectRandom

    [

        [ "Zeus_M_Unknown1_1", FIAWeaponCacheN1_1 ],

        [ "Zeus_M_Unknown1_2", FIAWeaponCacheN1_2 ],

        [ "Zeus_M_Unknown1_3", FIAWeaponCacheN1_3 ]

    ];

     

    {

        ( deleteMarker _deleteCacheN select 0 );

        ( deleteVehicle _deleteCacheN select 1 );

    };




     

    _deleteCacheS = selectRandom

    [

        [ "Zeus_M_Unknown2_1", FIAWeaponCacheS1_1 ],

        [ "Zeus_M_Unknown2_2", FIAWeaponCacheS1_2 ],

        [ "Zeus_M_Unknown2_3", FIAWeaponCacheS1_3 ]

    ];

     

    {

        ( deleteMarker _deleteCacheS select 0 );

        ( deleteVehicle _deleteCacheS select 1 );

    };

     

    This doesn't seem to do anything (no error message or anything) on mission start and I am not sure why.

     

    Please help!


  16. 21 hours ago, pierremgi said:

    Which "short piece of code"?

     

    Place into the init of BLUFOR_Player1_1 (and so on for the other BLUFOR players).

    Quote

    [] spawn { 
     while { alive BLUFOR_Player1_1 } do { 
      if ( { _x distance2D BLUFOR_Player1_1 < 40 && ( side _x == independent || side _x == east ) } count allUnits > 0 ) then { 
       ZeusBLUFOR1_1_Curator removeCuratorEditingArea 1; 
        } else { 
         ZeusBLUFOR1_1_Curator addCuratorEditingArea [ 1, position BLUFOR_Player1_1, 40 ]; 
         sleep 0.05; 
        }; 
      }; 
    };

     


  17. On 6/16/2021 at 12:42 AM, pierremgi said:

     

    If you read from the beginning, the problem is not making Zeus working, but script for them, along with the side of the units played.

    I guess you suggest to write the owner's name in owner field of the module, that's already described above, (as you can't name two objects, whatever they are (module/unit/crate/trigger...) with the same name).

    I placed my short piece of code into the init of all the BLUFOR Curators. Seems to be doing the trick nicely!


  18. On 6/22/2021 at 7:02 PM, pierremgi said:

    Really, with all your tests, I can't guess if you already test :
     

    
    getAssignedCuratorLogic player addEventHandler [ "CuratorObjectPlaced", {
      params [ "_curator", "_entity" ];
      if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F") || ( _entity isKindOf "ModuleMine_APERSMine_F") || ( _entity isKindOf "ModuleMine_ATMine_F") ) then {
        [_curator, [ [ _entity ], true ] ] remoteExec ["removeCuratorEditableObjects",2];
      };
    }];

    in initPlayerLocal.sqf

      Yes or No ?

    I tested it and that work for me. (Last post btw)

    Yes, it's located in the "initPlayerLocal.sqf", and yes, it is now working. No idea why it wasn't before!

     

    Anyway, for anyone else having the same problem, the script below is working for me (and it's not that much different from the one posted by pierremgi!).

    Quote

    {

        _x addEventHandler [ "CuratorObjectPlaced", {

            params [ "_curator", "_entity" ];

            if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F" ) || ( _entity isKindOf "ModuleMine_APERSMine_F" ) || ( _entity isKindOf "ModuleMine_ATMine_F" ) ) then {

                [ _curator, [ [ _entity ], true ] ] remoteExec [ "removeCuratorEditableObjects", 0, true ];

                };

            }

        ];

    } foreach allCurators;

     


  19. Spoiler

    {

        if ( ( alive _x ) && ( [ _x ] call BIS_fnc_isCuratorEditable isEqualTo false ) && ( ( side _x ) == east ) && !( _x in getMissionLayerEntities "CampZeloran_Units" ) ) then {

            [ ZeusEast1_1_Curator, [ [ _x ], true ] ] remoteExec [ "addCuratorEditableObjects", 0, true ];

        }

    } forEach thisList;

    I have a trigger that adds all OPFOR units to the OPFOR Curator (basically reinforcements) when the units enter an area. However, I already have some units in the area that I don't want automatically added to the OPFOR Curator.

     

    I have them all grouped in the "MissionLayerEntities" called CampZeloran_Units, however, I am not sure how to tell the computer to check if the unit is in the "getMissionLayerEntities".

     

    Please help!


  20. 43 minutes ago, pierremgi said:

    Yes my bad!

    in initPlayerLocal:

    
    getAssignedCuratorLogic player addEventHandler [ "CuratorObjectPlaced", {
      params [ "_curator", "_entity" ];
      if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F") || ( _entity isKindOf "ModuleMine_APERSMine_F") || ( _entity isKindOf "ModuleMine_ATMine_F") ) then {
         [_curator, [ [ _entity ], true ] ] remoteExec ["removeCuratorEditableObjects",2];
       };
    }];

     

    I tried your advised method, with a slight change because of a few things I noticed in previous testing, and it still doesn't work. No error message, just no change from what normally happens when you place a mine as the Curator.
     

    Spoiler

    getAssignedCuratorLogic player addEventHandler [ "CuratorObjectPlaced", {

        params [ "_curator", "_entity" ];

        if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F" ) || ( _entity isKindOf "ModuleMine_APERSMine_F" ) || ( _entity isKindOf "ModuleMine_ATMine_F" ) ) then {

            [ _curator, [ [ _entity  ], true ] ] remoteExec [ "removeCuratorEditableObjects", 0, true ];

            };

        }

    ];

     


  21. 9 hours ago, mrcurry said:
    
     { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 );

    Is the objects in a Eden Editor Layer called WeaponCache1_1?

    @rkemsley

    There are 3 objects which are not named, all grouped together in the Eden Editor Layer called WeaponCache1_1.

     

    (Some of the boxes are located in buildings) I have a trigger that destroys the boxes if the building they are in is destroyed, which works fine. It only seems to be an issue with the BIS_fnc_holdActionAdd.


  22. 9 hours ago, sarogahtyp said:

     

     

    The "SE" icon means as of biki:

     

    It is not automatically executed on the server. The scripter must ensure that it is executed on the server machine.

    Ohh, I think I see what you mean.

     

    Let me do some testing and get back to you.

     

    Edit: Ok, so I did some testing and found something quite useful!
    I placed 3 pieces of code into my "initPlayerLocal.sqf" to see which ones work with what type of player. (I'm sure we are all aware that when testing a multiplayer server using the "PLAY SCENARIO in multiplayer" button in the Eden Editor, it considers the host player to be the server and not just a client, so certain pieces of code will work when they don't work for clients.)

     

    Basically, I have 3 civilian units which are added to all Curators at the start of the game (for testing). Each civilian has a different version of the "addCuratorEditableObjects" to see which one works with what type of player. Here are the results.

    Spoiler

    {

        [ _x, [ [ Civ1 ], false ] ] remoteExec [ "addCuratorEditableObjects", 0, true ];

    } foreach allCurators;

    Works for the server player.
    Works for the client players.

     

    Spoiler

    {

        [ _x, [ [ Civ2 ], false ] ] remoteExec [ "addCuratorEditableObjects", 2, true ];

    } foreach allCurators;

    Doesn't work for the server player.
    Doesn't work for the client players.

     

    Spoiler

    {

        _x addCuratorEditableObjects [ [ Civ3 ], true ];

    } foreach allCurators;

     

    Works for the server player.

    Doesn't work for the client players.


  23. 13 hours ago, pierremgi said:
    
    player addEventHandler [ "CuratorObjectPlaced", {
      params [ "_curator", "_entity" ];
      if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F" ) || ( _entity isKindOf "ModuleMine_APERSMine_F" ) || ( _entity isKindOf "ModuleMine_ATMine_F" ) ) then {
        [_curator, [ [ _entity ], true ] ] remoteExec ["removeCuratorEditableObjects",2];
      };
    }];

     

    How come you are telling the "remoteExec" to only execute the function on the server when "removeCuratorEditableObjects" is already a server exec?
     

    11 hours ago, pierremgi said:

    You just have to test the initPlayerLocal version (above) with the remoteExec on server (as written).

    Also, apologies that was wasn't very clear.

     

    I had initially had this...

    Spoiler

    {

        _x addEventHandler [ "CuratorObjectPlaced", {

            params [ "_curator", "_entity" ];

            if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F" ) || ( _entity isKindOf "ModuleMine_APERSMine_F" ) || ( _entity isKindOf "ModuleMine_ATMine_F" ) ) then {

                _curator removeCuratorEditableObjects [ [ _entity ], true ];

                };

            }

        ];

    } foreach allCurators;

    ...located in my "initServer.sqf". Which I then changed the "removeCuratorEditableObjects" part to be "[ _curator, [ [ _entity ], false ] ] remoteExec [ "removeCuratorEditableObjects ", 0, true ];" (Didn't work).

     

    I then tried these two versions of the piece of code, but had it located in my "initPlayerLocal.sqf" instead of my "initServer.sqf" (Didn't work).

     

    Then I tried the two versions again in the "init" of the Curator Module (Still, didn't work).

     

    This is why I am really confused...

    Edit: 

    Spoiler
    13 hours ago, pierremgi said:
    
    
    player addEventHandler [ "CuratorObjectPlaced", {
      params [ "_curator", "_entity" ];
      if ( ( _entity isKindOf "ModuleMine_APERSBoundingMine_F" ) || ( _entity isKindOf "ModuleMine_APERSMine_F" ) || ( _entity isKindOf "ModuleMine_ATMine_F" ) ) then {
        [_curator, [ [ _entity ], true ] ] remoteExec ["removeCuratorEditableObjects",2];
      };
    }];

     

    Just realised this wouldn't work, because you have to add the "CuratorObjectPlaced" EH to the Curator Module, it doesn't work with the player.

×