Jump to content

pierremgi

Member
  • Content Count

    4792
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by pierremgi


  1. I can confirm CBA patrol module is broken and returns error message like this one:

    16:51:29 Error in expression <et + _step*_i;

    _this set [1, _position getPos [_rad, _theta]];
    _this call CBA_f>
    16:51:29   Error position: <getPos [_rad, _theta]];
    _this call CBA_f>
    16:51:29   Error getpos: Type Bool, expected Array,Object
    16:51:29 File x\cba\addons\ai\fnc_taskPatrol.sqf, line 39

     

    No matter the parameter choices.

    Please do something. I can't imagine how many scenarii are waiting for a fix.

    Thanks


  2. I felt back with say3D and relative sound paths (called with description.ext classes) because I experienced some wrong paths for clients with playSound3D.

     

    I know the need to declare the entire path of .ogg or other working sound file, and I'm aware of the mission root in MP, with methods like:

    str missionConfigFile select [0, count str missionConfigFile - 15]

    or

    __EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])  then usage of the parsingNameSpace variable.

     

    That's not a typo problem because this works until you decide to change something in the process.

    I explain: This works after creating a mission and playing it on hosted server and clients ready.

    But I experienced some trouble on clients after 2 uncorrelated changes, each of them or both leading to the error (sorry, I didn't make all tests):

    So, after changing the mission name via editor and/or description.ext header,

    and / or

    allowing JIP, (I know also JIP can't hear a running sound but it's not the problem. I'm speaking about persistent error, reported in rpt file).

    something breaks the mission root on client. Hosted server still can find the sound file (normal so far) but the clients have a path error coming with __currentMPmission.anyWorldName.\...    I can't remember the exact message but clearly, the client path is not searched into the right place.

     

    This occurs on MP editor preview, MP mission local files session and even uploaded on Steam mission (hosted server subscription).

     

    No idea to correct that.


  3. Yep! known problem.

    You can work around with something like that (tank or land vehicle will stop for 5 seconds, adjustable):

     

    ["beQuiet","onEachFrame",{
        if !(isNil {player nearEntities ["landVehicle",6] select 0} && {!isNull driver (player nearEntities ["landVehicle",6] select 0)}) then {
          _veh = player nearEntities ["landVehicle",6] select 0;
          if (_veh != vehicle player && group driver _veh == group player) then {
            _unit = driver _veh;
            _unit disableAI "path";
            _unit spawn {
              _unit = _this;
              uisleep 5;
              if (alive _unit) then {_unit enableAI "path"}
            };
          };
        };
    }] call bis_fnc_addStackedEventHandler;

     

    • Like 1

  4. Here is my 2 cent contribution for thus who like to abort healing themselves. Run this code for player, then when healing yourself, just strike escape key.

    Escape key is not impacted for other stuff, of course. The most difficult was to cancel the healing result as the hit points are instantaneously healed. But this works.

     

    player addEventHandler ["animchanged", {
        params ["_plyr","_anim"];
        call {
          if (_anim in ["ainvpknlmstpslaywrfldnon_medic","ainvppnemstpslaywrfldnon_medic"]) exitWith {
              if (isnil "MGI_keysHealing") then {
                MGI_keysHealing = (findDisplay 46) displayAddEventHandler ["KeyDown",
                  "
                    _handled = false;
                    if ((_this select 1) == 1) exitWith {
                      _handled = true;
                      [] spawn {
                        waitUntil {!isNull findDisplay 49};
                        (findDisplay 49) closeDisplay 2;
                        [player,MGI_unitpos] remoteExec ['switchMove'];
                        sleep 0.1;
                        player setDamage (MGI_dam select 0);
                        for '_i' from 0 to count (MGI_dam select 1 select 0) - 1 do {
                          player setHitPointDamage [(MGI_dam select 1) select 0 select _i, (MGI_dam select 1) select 2 select _i]
                        };
                      };
                    };
                    (findDisplay 46) displayRemoveEventHandler ['keyDown',MGI_keysHealing];
                    MGI_keysHealing = nil;         
                    _handled
                "];
              };
            };
          MGI_unitpos = _anim;
          MGI_dam = [damage _plyr,getAllHitPointsDamage _plyr];
          };
    }];

     


  5. On 05/02/2017 at 2:35 AM, x3kj said:

    you can assign both the positive and negative axis to the throttle (and remove the brake), giving you full motion range. So its not like it doesnt work. Its just counter-intuitive to do.

    Hi, that doesn't work for me. Vanilla Apex, A-164 Wipeout, Logitech Force 3D PRO, (recognized). I put both "logitech force stick slide 1+" and "..1-" in thrust analog. I removed the setting for Brake analog...

    Gas starts at mid-throttle to 100% when pushed at full. Nothing works between idle (max pulled) and mid-position.

    I can see the analogical value, varying from 0 to 100% for each slide 1+ and 1- (0 is at middle), in the show controller customize (Arma control controller), but no way to make it work as any throttle of any jet in the world!

     

    • Like 2

  6. 1 All is question of choice. Mouse movement is fluid, and yes, easier than any  key.

     

    2 Driver 1st view is disabled because I think this view is not fine, too "tunneled". For this script, the realism is of course less important than the playability, then fast gaming action. But yes, this could easily become a player's choice.

     

    3 No turret movement for 10 sec, means you have to wait for this time before to drive as driver. But you can move the tank from the gunner seat of course. Perhaps a key could also do that. My problem was to avoid any "hard" key binding. Players keep their own settings. In this script, all actions (even marking a waypoint have to be as easy and natural as possible).  And no, it's the contrary, you have to be in external view to be back in the driver seat (after 10 sec of mouse inactivity). If you're in gunner view, you're supposed to be on a priority action, regardless of the mouse activity.

     

    4 any attempt with setVelocity failed on uneven terrain. Any little rock can lead to a flight into the air or weird vectoring. I'm not so skilled to reproduce the movements induced by the driver's keys. If I could, Agent were not mandatory anymore!

     

    Thanks for you comment. As shared, this script can evolve as you like, by your own, or asking here for modifications.

    • Like 1

  7. Hi all,
    Want to play with a "One man tank"? Here is a little script for "World of tank" aficionados.
    Works on all tanks in game, as far as you can jump into the driver's seat.

    Usage:
    you're driver until you move the mouse, pointing cannon at cursor direction. Driver is always in 3rd person.
    Then, you're gunner but you can use your keys to continue driving the tank.
    - in external view, you'll be back at driver's seat if no waypoint (see further) and no turret movement for 10 seconds.
    - in gunner view, you stay as gunner role and continue to drive.
    - if in gunner view and right click on landscape, you create a temporary waypoint where the tank goes as far as you don't touch any of the driver's keys. Driver's keys will delete this waypoint when strike.

    Hints to know:
    - when driving from gunner's seat, avoid maintaining the forward key when you need to turn. release all, strike left(/right), maintain if you want; As soon as the direction is good, release left(/right) key, strike forward key. The tank will start to sway a little around the desired direction but will go where you want. Remember release all keys to make change.
    - there is no rear clutch while in gunner, just because Arma's engine prefers a 180° turn instead of a 10 meter rear drive...
    So, I disabled the backward key in gunner.

    Other stuffs:
    There are 2 parameters O/1 for displaying:
    - tank icon, in order to have a clear view of the direction of the tank when you are in gunner view. Gun is always up, of course.
    - little radar displaying other vehicles in game, along with knowledge of these units.

    Now, the function. Just add it into init.sqf or initPlayer.sqf, or any script which run for player:

    MGI_1ManTank = {
    params [["_icon",1,[0]],["_radar",1,[0]]];
    if (!hasInterface) exitWith {};
    MGI_iTk = _icon;
    MGI_rdrTk = _radar;
    
    MGI_timerTurreting = 0;
    MGI_timerStopping = 0;
    MGI_icon_tk = "";
    coef_ratioTK = (getResolution select 4)/ 1.77778;
    coef_uiSpaceTK = 0.55/(getResolution select 5);
    MGI_keysMovingTk = ["carForward","Turbo","carSlowForward","carBack","carLeft","carRight"] apply {actionkeys _x select 0};
    MGI_destTk = [0,0,0];
    
    inGameUISetEventHandler ["Action", "
          if (_this select 0 isKindOf 'tank') then {
            MGI_icon_tk = getText (configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'icon');
            if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then {
              _units = crew (_this select 0);
              {unassignVehicle _x} forEach _units; _units allowGetIn false
            }; 
            if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true};
            if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true};
        }
    "];
    
    _MGI_EHTank =  ["MGI_TK","onEachFrame",
      {
        coef_zoomTK = ([0.5,0.5] distance worldToScreen positionCameraToWorld [0,10,10])* (getResolution select 5);
        _veh = vehicle player;
        if (inputAction "zoomTemp" == 1 && {!isnil "MGI_agent"}) then {
          MGI_destTk = screenToWorld [0.5,0.5];
         if (isnil "MGI_signTkDest") then {
            MGI_agent setDestination [MGI_destTk, 'VEHICLE PLANNED', true];
            MGI_destTk set [2,2];
            MGI_signTkDest = "Sign_Arrow_Large_F" createvehicle MGI_destTk
          };
        };
        if (!isnil "MGI_signTkDest" && {MGI_destTk isEqualTo [0,0,0] or (player distanceSqr MGI_destTk < 100) or driver _veh == player}) then {
          deleteVehicle MGI_signTkDest; MGI_signTkDest = nil};
        if (!(_veh isKindOf "tank") && !isNil "MGI_agent") exitWith {
          deleteVehicle MGI_agent; MGI_agent = nil; (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; (findDisplay 46) displayRemoveEventHandler ["keyUp",MGI_keysDrivingUp]; MGI_keysDriving = nil; MGI_keysDrivingUp = nil
        };
        if (player == driver _veh) then {
          {_veh lockTurret [_x,true]} forEach allTurrets _veh;
          if (cameraView != "external" && _veh isKindOf "tank") then {player switchcamera "external"}
        } else {
          if (player == gunner _veh  && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then {
            player action ["MoveToDriver", _veh];
            player setVariable ["gunning",false];
            if !(isnil "MGI_agent") then {deleteVehicle MGI_agent; MGI_agent = nil;{_veh lockTurret [_x,true]} forEach allTurrets _veh};
          };
        };
        if (isnil "MGI_keysDriving") then {
          MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown",
            "
              private _handled = false;
              if (!isnil 'MGI_agent') then {
                MGI_timerStopping = diag_tickTime;
                _veh = vehicle player;
                call {
                  if ((_this select 1) == MGI_keysMovingTk select 4) exitWith {
                     MGI_agent setDestination [_veh modelToWorldVisual [-30,10,0], 'VEHICLE PLANNED', true]; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                  if ((_this select 1) == MGI_keysMovingTk select 5) exitWith {
                    MGI_agent setDestination [_veh modelToWorldVisual [30,10,0], 'VEHICLE PLANNED', true]; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                  if ((_this select 1) == MGI_keysMovingTk select 1) exitWith {
                    MGI_agent setDestination [_veh modelToWorldVisual [0,100,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'FULL'; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                  if ((_this select 1) == MGI_keysMovingTk select 2) exitWith {
                    MGI_agent setDestination [_veh modelToWorldVisual [0,30,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'LIMITED'; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                  if ((_this select 1) == MGI_keysMovingTk select 0) exitWith {
                    MGI_agent setDestination [_veh modelToWorldVisual [0,100,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'NORMAL'; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                  if ((_this select 1) == MGI_keysMovingTk select 3) exitWith {
                    MGI_agent setDestination [_veh modelToWorldVisual [0,0,0], 'DoNotPlan', true]; MGI_destTk = [0,0,0];
                    _handled = true
                  };
                };
              };
              _handled
          "];
          MGI_keysDrivingUp = (findDisplay 46) displayAddEventHandler ["KeyUp",
            "
              if (!isnil 'MGI_agent' && diag_tickTime > MGI_timerStopping + 3 && (MGI_destTk isEqualTo [0,0,0])) then {
                MGI_agent setDestination [vehicle player modelToWorldVisual [0,0,0], 'DoNotPlan', true]
              };
          "];
        };
    }] call BIS_fnc_addStackedEventHandler;
    
    _MGI_DrawRadar = addMissionEventHandler ["draw3D",{
      if (cameraView == "gunner" && vehicle player isKindOf "tank") then {
        _veh = vehicle player;
        _aTurret = Deg (_veh AnimationPhase "mainturret");
        if (MGI_iTk == 1) then {
          _tkIconPos  =  positionCameraToWorld [0,-370/coef_zoomTK,1000];
          _damageTK = [2*(damage _veh),2 - 2 * (damage _veh),0.3,0.5];
          drawIcon3D [MGI_icon_tk, _damageTK,_tkIconPos, 2, 2, - _aTurret, "", 1, 0.05, "TahomaB"];
        };
        if (MGI_rdrTk == 1) then {
          for "_i" from 0 to 350 step 10 do {
            _posdiam = positionCameraToWorld [(sin _i) * 110 * coef_ratioTK / coef_zoomTK,(-370+ ((cos _i) * 110)) / coef_zoomTK,1000];
            drawIcon3D ["A3\ui_f\data\IGUI\Cfg\squadRadar\SquadRadarOtherGroupUnit_ca.paa", [0.7,1,0.3,0.8], _posdiam, 0.4, 0.4, 0, "", 1, 0.05, "PuristaMedium"];
          };
          if (!isnil "MGI_signTkDest") then {
            _dirS = (((_veh) getRelDir MGI_destTK) + _aTurret) mod 360;
            _d2S = ((player distanceSqr MGI_destTK) min 10^6) max 10^4;
            _xx = 100 - ((10^6-_d2S)/19800);
            _posWpt = positionCameraToWorld [(sin _dirS) * _xx * coef_ratioTK / coef_zoomTK,(-370+ ((cos _dirS) * _xx)) / coef_zoomTK,1000];
            drawIcon3D ["A3\ui_f\data\GUI\Cfg\Cursors\hc_move_gs.paa", [1,1,0.5,1], _posWpt, 0.5, 0.5, 0, "", 1, 0.05, "PuristaMedium"];
          };
          _allvehicles = vehicles select {alive _x &&  !(_x isKindOf "WeaponHolderSimulated") && side _x != civilian};
          _enyVehs = _allvehicles select {side _x getFriend side player < 0.6};
          _frdVehs = _allvehicles - _enyVehs;
          if ( count (_enyVehs + _frdVehs) > 0) then {
            private ["_icon","_color"];
            {
              if (_x isKindOf "air") then {
                _icon = "A3\ui_f\data\IGUI\Cfg\tacticalDisplay\targetAirTexture_gs.paa"
              } else {
                _icon = "A3\ui_f\data\IGUI\Cfg\tacticalDisplay\targetTexture_gs.paa"
              };
              _dir = ((_veh) getRelDir _x) + _aTurret;
              _d2 = ((player distanceSqr _x) min 10^6) max 10^4;
              _dd = 100 - ((10^6 - _d2)/19800);
              _posVeh = positionCameraToWorld [(sin _dir) * _dd * coef_ratioTK / coef_zoomTK,(-370+ ((cos _dir) * _dd)) / coef_zoomTK,1000];
              call {
                if (_x in _frdVehs) exitWith {
                  _kwn = player knowsAbout _x;
                  _color = if (_kwn < 1.5) then [{[0.3,0.3,0.3,0.3]},{[0.3,0.8,0.9,0.8]}];
                  };
                _kwn = playerSide knowsAbout _x;
                _color = [0.3 max (_kwn/2),((0.3 max (_kwn/2)) min (2 - (0.3 max (_kwn/2)))) max 0.3,0.3,0.3 + (0.5*_kwn/4)];
              };
              drawIcon3D [_icon, _color, _posVeh, 0.5, 0.5, 0, "", 1, 0.05, "PuristaMedium"];
            } forEach (_allvehicles - [_veh]);
          };
        };
      };
    }];
    
    _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving",
      {
        _veh = vehicle player;
        if (_veh isKindOf "tank") then {
          player setVariable ["gunning",true];
          if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]};
          MGI_timerTurreting = diag_tickTime;
          if (isnil "MGI_agent") then {
            MGI_agent = createAgent ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"];
            MGI_agent moveInDriver _veh;
            MGI_agent setBehaviour "COMBAT";
            MGI_agent setSpeedMode "FULL";
          };
       };
    }];
    
    };

     

    Then call this function with desired parameters:

    [1,1] call MGI_1ManTank; // 1 = enable tank icon, 1 = enable radar


    Hope you'll have fun!
    Pierre MGI

    • Like 5

  8. Yep, engine power should be from idle to full. It's a weird idea to place brakes in the first half of throttle. Air brakes should be apart (analogic with duration).  Post-combustion could be at the very end of throttle (max) or on on/off button.


  9. I'd like (in Arma IV perhaps), the commands and functions provide the intended effect. Not so evident!

    At this time, Arma engine overrides some behaviors, then what you intend to do. There aren't bugs, just a annihilation of scripted feature.

    You already know some of them:

    - when you decide to script "lights on" for a vehicle, the engine's behavior choose what to do along with the combat mode. All script writers need to write a fast and demanding loop to override the result of overridden  command;

    - same for trying to select a launcher, no matter what for. selectWeapon works but, as far as you don't play as 3 FPS, you can't see the shift gun-launcher-gun, because the engine decides there is no reason to maintain this command, despite the wish of the writer. "commands" are so bad named in this case, as the engine seems to disobey the code!

    - same for trying for an AI to fire any ammunition on any target or even on ground. This should be scripted within one or two lines of codes, no matter the vehicle or the target.

     

    I guess there is no simple mean to do that, changing the arma engine logic for a "hang" on some command/function triggered.

     

×