Jump to content

viel.kuul.10

Member
  • Content Count

    47
  • Joined

  • Last visited

  • Medals

Posts posted by viel.kuul.10


  1. 22 hours ago, Harzach said:

     

    It does indeed work. In fact, 

     

    This, however:

     

    is new information.

     

    So perhaps you should explain exactly how you want this to go.

     

    All I want to know is simple, I would like to see the results of dead soldiers and destroyed vehicles after a battle but which I would activate myself, i.e. to see statistics whenever I want. I would also like to see the current number of living soldiers and vehicles.

    I have four triggers, every via radio (Alpha, Bravo, Charlie, Delta). 

     

    First trigger:

    _count = {side _x == east} count allunits;  
    hintSilent format ["Alive CSAT Units: %1", _count];

     

    Second trigger:

    0 = [] spawn { while {true} do { sleep 0.1; _csatScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 0} count allDeadMen; hintSilent format ["Dead CSAT Units: %1", _csatScore]; }; };

     

    Third trigger:

    _count = {side _x == resistance} count allunits;  
    hintSilent format ["Alive AAF Units: %1", _count];

     

    Fourth trigger:

    0 = [] spawn { while {true} do { sleep 0.1; _aafScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 2} count allDeadMen; hintSilent format ["Dead AAF Units: %1", _aafScore]; }; };

     

     

    20 hours ago, mr_centipede said:

    Are you perhaps trying to do something like this?

    Custom Debriefing Page

     

    That's something I'm actually looking for. Men, vehicles, vessels, aircraft, on every side. I'm currently testing this your, I'm playing with mod Arma Commander, the trigger is synced with the main module of the mod. But after the mission, this briefing is not shown.


  2. After trying for weeks with my scripting and googling everything to find some answers, I am still without success. The script should be small and simple, I knew scripting isn’t easy but I can’t believe this hurts so much. I'm trying to make a script that will count all the dead units and destroyed vehicles of one side and put it in the trigger and activate it via radio.

     

    _count = {side _x == resistance} count allunits;  
    hintSilent format ["Alive AAF Units: %1", _count];  // Count all alive units of Resistance side, it works fine.

     

    0 = [] spawn {while {true} do {sleep 0.1;} 
    _aafScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 2} count allDeadMen; 
    hintSilent format ["Dead AAF Units: %1", _aafScore]}; // Count all dead units but it works not fine.


  3. Works this with a group. I gave you a trophy.

     

    Earlier I tested with a turret and a vehicle, every works with that code in the first posts. Only I would like the group to be together with the turret, not just one AI, I usually set up several more AI in the same group. To protect the turret or to replace staff if they die. I realized that any AI that is located in a turret or vehicle, spawns normally but an AI that is outside of a turret or vehicle has to run a long way to find its leader.

     

    I'm definitely still learning to scripting. Your codes can help me. I visit community.bistudio.com/wiki often to learn. Of course, I’m going to look at the other links they left here.


  4. How to make a unit (or more units) start at a random position within a marker? I have a simple code for random select markers, but I don't have for radius, direction.

     

    this setpos (getMarkerPos (selectRandom ["marker1", "marker2"]));

     

    This code I put in a unit init. I don't like sqf.

     

    I am trying: this setpos getMarkerPos ["marker1", "marker2"] getPos [random(40), random(360). random(40) is radius. But doesn't works.


  5. I managed to split this script into three parts or three hints individually.

     

    Spoiler

    addMissionEventHandler ["entityKilled",{
      params ["_unit"];
      private _grp = group _unit;
      private _side = side _grp;
      private _type = getText (configOf _unit / "displayName");
      if (isNil {_grp getVariable "dataKilled"}) then {
        _grp setVariable ["dataKilled",[[_side,_type,0]]];
      } else {
        if !([_side,_type] in ((_grp getVariable "dataKilled") apply {[_x#0,_x#1]})) then {
          (_grp getVariable "dataKilled") pushBack [_side,_type,0];
        };
      };
      private _idx = (((_grp getVariable "dataKilled") apply {[_x#0,_x#1]}) find [_side,_type]);
      private _cnt = (_grp getVariable "dataKilled") #_idx#2;
      (_grp getVariable "dataKilled") set [_idx, [_side,_type,_cnt +1]];
    }];


    [] spawn {
      while {true} do {
        waitUntil {sleep 1; triggerActivated trig1};
        private _txtWEST = "DEAD HELLENIC UNITS ";

        {
          _grp = _x;
          {
            _x params ["_side","_type","_cnt"];
            call { 
              if (_side isEqualTo WEST) exitWith {
                if !(str _grp in str _txtWEST) then {
                  _txtWEST = composeText [_txtWEST,lineBreak,str _grp] 
                };
                _txtWEST = composeText [_txtWEST,' ' +_type + ' ' + str _cnt];
              };

            };
          } forEach (_grp getVariable "dataKilled");
        } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}});
        if (_txtWEST isEqualTo "DEAD HELLENIC UNITS ") then {_txtWEST = "DEAD HELLENIC UNITS: 0 casualty"};

        hint composeText [_txtWEST];
        waitUntil {sleep 1; !triggerActivated trig1};
      };
    };


    [] spawn {
      while {true} do {
        waitUntil {sleep 1; triggerActivated trig2};

        private _txtEAST = "DEAD TURKISH UNITS ";

        {
          _grp = _x;
          {
            _x params ["_side","_type","_cnt"];
            call { 

              if (_side isEqualTo EAST) exitWith {
                if !(str _grp in str _txtEAST) then {
                  _txtEAST = composeText [_txtEAST,lineBreak,str _grp] 
                };
                _txtEAST = composeText [_txtEAST,' ' +_type + ' ' + str _cnt];
              };

            };
          } forEach (_grp getVariable "dataKilled");
        } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}});

        if (_txtEAST isEqualTo "DEAD TURKISH UNITS ") then {_txtEAST = "DEAD TURKISH UNITS: 0 casualty"};

        hint composeText [_txtEAST];
        waitUntil {sleep 1; !triggerActivated trig2};
      };
    };


    [] spawn {
      while {true} do {
        waitUntil {sleep 1; triggerActivated trig3};

        private _txtINDEP = "DEAD MAIDEN UNITS ";
        {
          _grp = _x;
          {
            _x params ["_side","_type","_cnt"];
            call { 

              if (_side isEqualTo INDEPENDENT) exitWith {
                if !(str _grp in str _txtINDEP) then {
                  _txtINDEP = composeText [_txtINDEP,lineBreak,str _grp] 
                };
                _txtINDEP = composeText [_txtINDEP,' ' +_type + ' ' + str _cnt];
              };
            };
          } forEach (_grp getVariable "dataKilled");
        } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}});

        if (_txtINDEP isEqualTo "DEAD MAIDEN UNITS ") then {_txtINDEP = "DEAD MAIDEN UNITS: 0 casualty"};
        hint composeText [_txtINDEP];
        waitUntil {sleep 1; !triggerActivated trig3};
      };
    };

     


  6. On 4/30/2021 at 6:45 AM, beno_83au said:

     

    Into where, and how? This is the problem. No one knows where you've added _entity, but if you have only added it in the EntityKilled EH, then all _entity is doing is defining the killer. Which is what myself and Pierre have explained.

     

    Spoiler

    addMissionEventHandler ["entityKilled",{
      params ["_unit", "_entity"];
      private _grp = group _unit;
      private _side = side _grp;
      private _type = getText (configOf _unit / "displayName");
      if (isNil {_grp getVariable "dataKilled"}) then {
        _grp setVariable ["dataKilled",[[_side,_type,0]]];
      } else {
        if !([_side,_type] in ((_grp getVariable "dataKilled") apply {[_x#0,_x#1]})) then {
          (_grp getVariable "dataKilled") pushBack [_side,_type,0];
        };
      };
      private _idx = (((_grp getVariable "dataKilled") apply {[_x#0,_x#1]}) find [_side,_type]);
      private _cnt = (_grp getVariable "dataKilled") #_idx#2;
      (_grp getVariable "dataKilled") set [_idx, [_side,_type,_cnt +1]];
    }];


    [] spawn {
      while {true} do {
        waitUntil {sleep 1; triggerActivated trigEnd};
        private _txtWEST = "DEAD NATO UNITS ";
        private _txtEAST = "DEAD OPFOR UNITS ";
        private _txtINDEP = "DEAD GREEK UNITS ";
        {
          _grp = _x;
          {
            _x params ["_side","_type","_cnt"];
            call { 
              if (_side isEqualTo WEST) exitWith {
                if !(str _grp in str _txtWEST) then {
                  _txtWEST = composeText [_txtWEST,lineBreak,str _grp] 
                };
                _txtWEST = composeText [_txtWEST,' ' +_type + ' ' + str _cnt];
              };
              if (_side isEqualTo EAST) exitWith {
                if !(str _grp in str _txtEAST) then {
                  _txtEAST = composeText [_txtEAST,lineBreak,str _grp] 
                };
                _txtEAST = composeText [_txtEAST,' ' +_type + ' ' + str _cnt];
              };
              if (_side isEqualTo INDEPENDENT) exitWith {
                if !(str _grp in str _txtINDEP) then {
                  _txtINDEP = composeText [_txtINDEP,lineBreak,str _grp] 
                };
                _txtINDEP = composeText [_txtINDEP,' ' +_type + ' ' + str _cnt];
              };
            };
          } forEach (_grp getVariable "dataKilled");
        } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}});
        if (_txtWEST isEqualTo "DEAD NATO UNITS ") then {_txtWEST = "DEAD NATO UNITS: 0 casualty"};
        if (_txtEAST isEqualTo "DEAD OPFOR UNITS ") then {_txtEAST = "DEAD OPFOR UNITS: 0 casualty"};
        if (_txtINDEP isEqualTo "DEAD GREEK UNITS ") then {_txtINDEP = "DEAD GREEK UNITS: 0 casualty"};
        hint composeText [_txtWEST,lineBreak,_txtEAST,lineBreak,_txtINDEP];
        waitUntil {sleep 1; !triggerActivated trigEnd};
      };
    };

     

    How can I divide this script into three parts? Each side with its own hint? The hint doesn’t load whole because it’s too long, especially after a big battle.


  7. On 4/19/2021 at 8:28 PM, pierremgi said:

    https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled

    the second param of this MEH refers to the killer. So your.... _entity.

     

    https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityRespawned

     

    On 4/19/2021 at 8:28 PM, pierremgi said:

    https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled

    As usual, I'm not sure to understand your approach.

     

    Really? I speak English, not Chinese! I feel like I'm talking to an alien.

     

    On 4/19/2021 at 8:28 PM, pierremgi said:

    The MEH I gave you is just fine. What you have to do, (not me), is to treat your groups and manage your trigger hints. I gave you an example, but, as usual, there are extra inputs. It's endless... (til I decide it's over as far as I'm concerned).

     

    As usual you avoid answering my questions directly.


  8. 19 hours ago, pierremgi said:

     

    Probably because you are spawning these groups (spawned vehicles) after the trigger activation and before the trigger deactivation. I don't know what is your condition for spawning some vehicles. So, you can split the loop (i wrote) into two spawned loops, one for treating the groups, another one for trigger activation/hint/trigger deactivation.

    Try to do that yourself. It's a good exercise.

     

     

    I think I have already solved this by incorporating _entity among the params. Now this looks like this: params ["_unit", "_entity"];

     

    Which is the event among the addMissionEventHandler that helps count all living units? Can you help me?

×