Jump to content

Schatten

Member
  • Content Count

    769
  • Joined

  • Last visited

  • Medals

Posts posted by Schatten


  1. 4 minutes ago, Babylon1984 said:

    The trigger will activate only if all three mentioned units are absent from its radius. I am using this condition:

    
    !(unit1 inArea thisTrigger) && !(unit2 inArea thisTrigger) && !(unit3 inArea thisTrigger)

     

    You can use this instead:

    ([unit1, unit2, unit3] findIf { _x inArea thisTrigger }) < 0

     

    8 minutes ago, Babylon1984 said:

     But if I want to use a command like this one:
    x_ inArea thisTrigger

    to do the same thing. I had thought of that:

    
    [unit1, unit2, unit3] all {!(_x inArea thisTrigger)}

     Unfortunately, it doesn't work...

    There is no command all.


  2. 1 hour ago, kibaBG said:

    Its working fine in editor, but refuse to work on dedicated server ... I wonder where is the problem?

    The problem is that a server and clients have their own profile namespaces, therefore you should request data from the server:

    // initServer.sqf
    
    sendDataToClient = {
        private ["_data", "_varNames"];
    
        params ["_player"];
    
        _data = [];
    
        _varNames = switch (vehicleVarName _player) do { 
            case "kiba3x": { ["KIB_kibaPos", "KIB_kibaRating"] }; 
            case "kavhan": { ["KIB_kavhanPos", "KIB_kavhanRating"] }; 
            default { ["KIB_konalPos", "KIB_konalRating"] };
        };
    
        {
            _data pushBack (profileNamespace getVariable _x);
        } forEach _varNames;
    
        missionNamespace setVariable ["clientData", _data, if (_player == player) then { false } else { owner _player }];
    };
    
    
    // initPlayerLocal.sqf
    
    if (isServer) then {
        [player] call sendDataToClient;
    } else {
        [player] remoteExecCall ["sendDataToClient", 2];
    };
    
    waitUntil { !(isNil "clientData") };
    
    clientData params ["_position", "_rating"];
    
    clientData = nil;
    
    player setPosATL _position;
    player addRating _rating;

     

    • Like 1
    • Thanks 1

  3. 13 hours ago, hectrol said:

    The addAction does not work

    That's because your code is wrong. I guess it should be like this (pay attention to the formatting and readability):

    _x addAction [
        ":: Rescue - Rescatar :: ",
        {
            ["Task_CIV_REHEN_NAMUVAKA_1", "SUCCEEDED"] call BIS_fnc_taskSetState;
    
            {
                _x setCaptive false;
                _x enableAI "PATH";
                _x setUnitPos "AUTO";
            } forEach (units CIV_REHEN_NAMUVAKA_1);
    
            (units CIV_REHEN_NAMUVAKA_1) joinSilent (group player);
        }
    ];

     


  4. 1 hour ago, avibird 1 said:

    I would like to add this code to the above removing the red part

    If you were able to highlight the code, then you can remove it.

     

    1 hour ago, avibird 1 said:

    addMissionEventHandler ["entityRespawned",{  params ["_new","_old"];  if (_new isKindOf "CAManBase") then {  [_new,face _old] remoteExec ["setFace"];  [_new,speaker _old] remoteExec ["setSpeaker"];  }  }];

    This code should be executed once, therefore it should be placed, for instance, in initServer.sqf event script.

     

    2 hours ago, avibird 1 said:

    I can't seem to get the right bracket arrangement to see if this works.

    Make the code readable, don't use strings with code (since code highlighting doesn't work in strings), as I demonstrated, and use programmer's editor with code highlighting.


  5. 2 minutes ago, redarmy said:

    Can i ask.. "-1" is signaling a random distance in the area from centre point?

    No, according to the BIKI:

    Quote

    -1 can be used for exact waypoint placement

     

    Just noticed, that PositionASL should be used if radius is negative, so this is fixed version:

    _wp = BB addWaypoint [AGLToASL (randomPoint call BIS_fnc_randomPosTrigger), -1];

     

×