Filter out the player(s) from my code (resolved).

  1. 8 years ago
    Edited 8 years ago by Fuhajins

    Hello, i am newbie in scripting and did this code to trigger some event in a mission for dedicated server i am working on.
    If the AAF ALIVE AI entities are great than 2 in a designated area, it should fire the trigger.
    But i found out that ALIVE take into account the player as an entity (?). I would like to know if there is a way to filter out the player.

    (this && (triggerActivated JoinTrig)) or
    count ([getposATL thisTrigger, 1300, ["GUER","entity"]] call ALIVE_fnc_getNearProfiles) > 2

    sorry for my bad English.

  2. Edited 8 years ago by SavageCDN

    Command called isPlayer is probably what you are looking for:

    https://community.bistudio.com/wiki/isPlayer

  3. Hello.
    I did try this and some other way and it does not work.
    I can't get the right count of player close to "Mark" then get it subtracted from the Alive entities count.
    I placed 2 ALIVE groups, then the player himself into the 1000 meters area.

    _playerCount = {isPlayer _x} count playableUnits;

    hint format ["Active players count is %1 .",_playerCount]; // give 1

    sleep 4;

    _playerClose = {isPlayer _x} count (position player nearEntities ["Mark", 1000]);

    hint format ["%1 player(s) supporting AAF forces.",_playerClose]; // give 0

    sleep 2;

    _number = count ([getposATL Mark, 1000, ["GUER","entity"]] call ALIVE_fnc_getNearProfiles);

    _result = (_number - _playerClose);

    sleep 2;

    if (_result > 1)
    then {
    hint format ["There are %1 AAF squads.",_result]}
    else {
    hint format ["There is %1 AAF squad left.",_result]
    }; // give 3

    My code must be wrong anyway but still i can't see where :x.

  4. Why use sleep in between lines? No need for that. Get rid of those and see what happens. You might be going through the AO too fast and then your code doesn't keep up.

  5. Good evening.
    I got some help and this is working:

    _radius = 800;
    _numPlayersByEntity = {_x distance getMarkerPos "Mark" < _radius} count allPlayers;

    _number = (count ([getMarkerPos "Mark", 1000, ["GUER","entity"]] call ALIVE_fnc_getNearProfiles));

    _result = (_number - _numPlayersByEntity);

    hint format [" %1 players. %2 ALIVE entities. %3 ALIVE AI entities.", _numPlayersByEntity, _number, _result];

    Now i can have the count without players included.

 

or Sign Up to reply!