Jump to content


  • Content count

  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

490 Excellent


About pierremgi

  • Rank
    Sergeant Major

Profile Information

Recent Profile Visitors

1382 profile views
  1. Too much [ ] ! _this refers to a single unit (here) No need to wrap it in [ ] then ask for _this select 0 (first element of the array) [_this] is useless, because _this is always the whole parameter(s) (unique or array) . As you can see in workable example: _this is OK. this (without underscore) is a "magic" variable referring to the object/unit and wrote in its init field. _x is also a specific variable inside a forEach loop. You can: { _x spawn {some code with _myLocalThing = _this (as passed parameter) ... } } forEach (an array);
  2. Why didn't you try my code? It's working. Place an animated target (it needs terc animation) , named cible, at 100 m of a shooter, stand up, crouch, prone... Simple as that!
  3. Player Loaded into Game

    So time > 0 will not do the trick. Perhaps finishMissionInit or the "loading screen" family.
  4. Player Loaded into Game

    Do you have an example of that? In initPlayerLocal the variable player is consistent and point at the player. So, the @red62seems to me a waste of code.
  5. Help whit while loop

    waitUnitl {sleep 1; primaryWeapon player in ["arifle_Mk20_F","LMG_Mk200_F","arifle_Mk20C_F","arifle_Mk20_GL_F","hgun_PDW2000_F","srifle_EBR_F"] }; Check for true classes. It's case sensitive.
  6. sure, that can reduce the filtering.
  7. Can I Improve my JIP Check Script?

    don't place this trigger on the map (a global one which has to be run on each JIP), Create a local trigger instead. That means a little code with createTrigger [type, position, false] syntax. This way you can check if the local player present or not with the condition: player inArea thisTrigger The result (activated code) will concern this player only.
  8. Read the nearestTerrainObjects syntax. I let the [ ] empty because, in your case, all dp-transformer classes don't work. You need some workable class(es) and it's a BI lottery. You need to adjust your trigger(s) to catch what you really want to delete (hide) and nothing more. You can filter the dp_transformers as I wrote above (with select): ((nearestTerrainObjects [getpos thistrigger,[],triggerArea thistrigger select 0]) select {["dpp_01_trans",getModelInfo _x select 0] call bis_fnc_inString}) The alternate solution is to determine objects' ids. In 3den, run on console: do3DENAction "ToggleMapIDs"; then work with nearestObject: ([0,0,0] nearestObject 278985) hideObjectGlobal true
  9. My last price: 0 = [] spawn { fn_isHostile = compileFinal " private _ammo = 0; _turret = [-2]; {if (vehicle player turretUnit _x == player) exitWith {_turret = _x}} forEach (allTurrets [vehicle player,true] + [[-1]]); call { if (isNull objectParent player && _turret isEqualTo [-2]) exitWith {_ammo = count weapons player}; if (!isNull objectParent player && _turret isEqualTo [-2]) exitWith { _ammo = 0}; if (!(_turret isEqualTo [-2]) && vehicle player currentMagazineTurret _turret == '') exitWith {_ammo = count weapons player}; _ammoArray = (magazinesAllTurrets vehicle player) select { _x select 0 isEqualTo (vehicle player currentMagazineTurret _turret)} apply {_x select 2}; {_ammo = _ammo + _x} forEach _ammoArray; hint str (_ammo); }; _ammo "; while {true} do { waituntil { sleep 1; _ammo = call fn_isHostile; _ammo == 0 }; hintSilent "cooldown"; sleep 3; hintSilent "not hostile!"; player setCaptive true; waituntil { sleep 1; _ammo = call fn_isHostile; _ammo != 0 }; hintSilent "hostile!"; player setCaptive false; }; }; This script can manage all the turrets (cargo included). Some very specific cases like copilot "armed" with a searchlight led to choose its own weapon even if it can't fire. But more or less, every unit able to fire is hostile. NB: I don't know why it's so difficult to have BI reliable commands for turret's magazine and ammo. At least two of them are missing: the currentTurret unit (returning the turret path) and the currentTurretMagazineAmmo (same as the HUD display). Of course one command for infantry(no turret) or crew (turret)situation could be a must!
  10. Just to answer your question about "t": It means text and it works for parsed text like in: hint parseText "<t color='#faff00'>Yellow = greater than 50%</t>". It's often used in display resource. Diary record has its own rules...
  11. I tested some values to stay in a cone before AI fires (The AI seems to watch the target but the weapon's direction is always drifting). The problem is to fire on something without any interest for AI brain. Perhaps, there is an alternate way with doSuppressiveFire, as you can set a position. I didn't waste my time with that. Anyway, the loop is re-adjusting the weapon's direction with lookAt and doTarget. The fire occurs if the cosine angle between the weapon's direction (weaponDirection) and the target's direction ( difference between 2 vectors: target's position & Ai's position) is close to 1 (very sharp cone). But this value is "sensitive". Then, I try to stay above the value 0.975 + 0.00024 * distance target/AI (not exceeding 0.999) 0.975 is cosine (2,5°) , 0.975 is cosine ~ 13° (distance 0 m). At 100 m , the value are same. You can work around with that or another method, but it remains hard for AI to shoot with accuracy on a simple target. Thanks for commenting what you experienced in your trials.
  12. Can I Improve my JIP Check Script?

    Mind for initialization order. As you can see init.sqf and initplayerLocal.sqf have not the same sequence in SP or MP. So, your variables (global (local) or public) must be defined before use.
  13. Perhaps with mission EH "playerDisconnected" ?
  14. Now, just just have to hit the target In init field of a shooter: 0 = this spawn { while {alive _this} do { _this doTarget cible; waitUntil {cible animationPhase "Terc" == 0}; _time = diag_tickTime; sleep 2; if (_this ammo (currentWeapon _this) == 0) then {_this addMagazine currentMagazine _this}; if ((_this weaponDirection (currentWeapon _this) vectorCos ((position cible) vectorDiff (eyepos _this))) > 0.999 min (0.975 + (0.00024 *(_this distance cible)))) then { _this forceWeaponFire [currentWeapon _this,currentWeaponMode _this]; waitUntil {cible animationPhase "Terc" == 1 or diag_tickTime > _time + 10}; } else { _this lookAt cible }; sleep 3; } }; Then place a target (moveable like: Target_PopUp_Moving_90deg_Acc2_F) and name it: cible.