Jump to content


  • Content count

  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

984 Excellent

About pierremgi

  • Rank
    Warrant Officer

Profile Information

Recent Profile Visitors

2319 profile views
  1. Just test it with a toolKit. Let's say, if the player has one in his inventory, he can open the doors: Just modify the @gc8 script like this (as far as you don't need to re-lock the door): lockDoors = { params ["_posObj"]; if(typename _posObj == "OBJECT") then { _posObj = getpos _posObj; }; _bldg = nearestBuilding _posObj; _num = getNumber (configfile >> "CfgVehicles" >> typeOf _bldg >> "numberOfDoors"); diag_log format["Locking doors %1", _num]; for "_i" from 1 to _num do { _bldg setVariable [format["bis_disabled_Door_%1",_i], 1, false]; _sel = format["Door_%1", _i]; _aid = _bldg addAction ["<t color='#ffbf00'>Unlock door</t>", { params["_bldg","_caller","_actId","_doorIndex"]; hint "Opening door"; _bldg setVariable [format["bis_disabled_Door_%1",_doorIndex], 0, false]; }, _i,1.5,true,true,""," 'ToolKit' in items _this ",3,false,_sel]; }; }; mybuilding call lockdoors
  2. Insignia problem

    Disagree. If no EH available a loop can be mandatory. Then one (or two if reverse condition is needed) waitUntil with pause inside its code is better than a running loop with several if then. This kind of endless loop is already scheduled anyway.
  3. Insignia problem

    MP should work. Did you disable AI in lobby? What insignia did U test? Are U on dedicated or hosted server? What is the problem? What players can see , when?
  4. There is no key as object in Vanilla (non modded) Arma. So, what people said, is that you can: - lock a specific door if you need, for any player; - add an action on this specific door to open it under conditions: * presence of an item in you inventory, * specific guy (player's name, friendly unit, medic trait....) * any player with a specific variable. Because you don't need to own an object, just a variable pass (condition true) allowing the action on the door. The way you obtain "the pass" is your choice. We can't guess that. You didn't explain if you're in MP or SP and what mod / object you intend to use (if any).
  5. Insignia problem

    You need to add a respawn EH. The Bis_fnc_setUnitInsignia is rotten, false persistent on respawn but displaying nuts. So, one possibility, in init field of the player: [this,"MANW"] call BIS_fnc_setUnitInsignia; this addEventHandler ["respawn", { [_this select 0,""] call BIS_fnc_setUnitInsignia; comment "you need to discard the previous invisible one!"; [_this select 0,"MANW"] call BIS_fnc_setUnitInsignia }]; In MP, not tested on clients. Not sure the setObjectTextureGlobal is OK now. So, should work as is, or try to add a locality condition: if (local (this) then {<the code here>} Never remoteExec this function.
  6. As @HazJ said, restart the game each time you alter your paa.
  7. Auto heal script - help needed

    Believe me, it's not simple to manage all cases. Unconscious state can add many weird leader orders, animation endings, MP problems. Not mentioning the cases of your unit is inside a vehicle or your medic is hurt at his turn! You can choose parameters in this script.
  8. You can limit the damage and make the unit falls unconscious (like I did here in broader scale). The EH handleDamage can help you: Basically, say bob is your unit: bob addEventHandler ["handleDamage", { params ["_unit","","_dam"]; if !(_unit getVariable ["uncsious",false]) then { _unit setVariable ["uncsious",true,true]; [_unit,''] remoteExec ['playMoveNow']; _unit setUnconscious true; }; _dam min 0.86; }]; No clue if ACE compatible. I don't use it. You can have some extra lines to add for covering all situations (bob in car, plane...)
  9. setFlagTexture issues

    That's an old problem for any custom flag or insignia texture and BI didn't make a clear tuto on that. Pboed missions and addons (config.cpp) are OK. Non pboed scenario and description.ext > NOK.
  10. Both codes keep the limitation of the global rounds number. If you need unlimited ammos, it's easy to do but it's something different.
  11. REPACK and AUTO REPACK scripts Hi all, Here are two scripts (addon is scheduled) for those you want to repack their magazines. First one is a simple auto-repack. No action needed. Based on a simple EH, the code runs when the player fires, so the auto-repack needs has a "one round latency" to work. Not a real problem. Second one is more "realistic". Player must open the inventory and double click on each kind of mags to be repacked. Parameters: NONE AUTO-REPACK to be placed in initPlayerLocal.sqf or in init.sqf when player is defined. player addEventHandler ["fired",{ if (player == _this select 0 && vehicle player == player) then { _mags = magazinesAmmo player; _inv = _mags select {(_x select 0) in getArray (configFile >> "cfgWeapons" >> currentWeapon player >> "magazines")}; if (count _inv > 1) then { _sort = [_inv,[],{_x select 1},"ASCEND"] call BIS_fnc_sortBy; _lowest_mag = _sort select 0 select 0; _lowest_cnt = _sort select 0 select 1; _mags_space = _sort select [1, count _sort - 1]; _full_tot = 0; _remain_tot = 0; {_full_tot = _full_tot + getnumber (configFile >> "cfgmagazines" >> _x select 0 >> "count")} forEach _mags_space; {_remain_tot = _remain_tot + (_x select 1)} forEach _mags_space; _full_space = _full_tot - _remain_tot; if (_lowest_cnt <= _full_space) then { for "_i" from 0 to count _mags_space - 1 do { if (_lowest_cnt > 0) then { _current_mag = _mags_space select _i select 0; _current_ammo = _mags_space select _i select 1; _current_space = getnumber (configFile >> "cfgmagazines" >> _current_mag >> "count") - _current_ammo; if (_current_space > 0) then { _mags_space set [_i,[_current_mag,_current_ammo + _lowest_cnt]]; _lowest_cnt = _lowest_cnt - _current_space; }; }; }; {player removeMagazineGlobal (_x select 0)} forEach (magazinesAmmo player select {(_x select 0) in getArray (configFile >> "cfgWeapons" >> currentWeapon player >> "magazines")}); {player addMagazine _x} forEach _mags_space; }; }}; }]; MAGAZINE REPACK to be placed in initPlayerLocal.sqf or in init.sqf when player is defined. MGI_fnc_repack = { _idc = ctrlIDC (_this select 0); _selectedIndex = _this select 1; player setVariable ["MGImags", +((magazinesAmmoFull player) select {(lbdata [_idc,_selectedIndex]) in _x})]; player setVariable ["MGIselect", true]; false }; 0 = [] spawn { while {true} do { waitUntil {!(isnull (finddisplay 602)) && isnil {player getVariable "MGIselect"}}; ((findDisplay 602) displayCtrl 619) ctrlSetEventHandler ["LBDblClick", "_this call MGI_fnc_repack"]; ((findDisplay 602) displayCtrl 633) ctrlSetEventHandler ["LBDblClick", "_this call MGI_fnc_repack"]; ((findDisplay 602) displayCtrl 638) ctrlSetEventHandler ["LBDblClick", "_this call MGI_fnc_repack"]; waitUntil {!isnil {player getVariable "MGIselect"} or isNull (findDisplay 602)}; if (!isnil {player getVariable "MGIselect"}) then { private ["_mag","_wpnType","_wpn"]; if (player getVariable ["MGImags",[]] isEqualTo []) then { _mag = ""; _wpn = "" } else { _cnts = 0; _mag = (player getVariable "MGImags") select 0 select 0; _fullcnt = getnumber (configFile >> "cfgmagazines" >>_mag >> "count"); if (_fullcnt > 0) then { { _wpnType = _x select 3; switch (_wpnType) do { case 1: {_wpn = primaryWeapon player}; case 2: {_wpn = handGunWeapon player}; case 4: {_wpn = secondaryWeapon player}; default {_wpn =""}; }; _cnts = _cnts + (_x select 1); player setammo [_wpn,0]; } count (player getVariable ["MGImags",[]]); _remainingShots = _cnts mod _fullcnt; {player removeMagazineGlobal _mag} count (player getVariable ["MGImags",[]]); player addMagazines [_mag, floor (_cnts/_fullcnt)]; if (_remainingShots >0) then { player addMagazine [_mag,_remainingShots]; }; reload player; }; }; player setVariable ["MGIselect", nil]; }; }; }; Double click on any magazine in your inventory.
  12. ai Jet fires AA missile while on ground

    @GEORGE FLOROS GR At least, this code works... Tested in Vanilla.
  13. ai Jet fires AA missile while on ground

    Yep! it's ridiculous. Even in forced "safe" behaviour, the pilot fires! My workaround: in init field for your aircraft: if (isTouchingGround this && local this) then { this setBehaviour "AWARE"; comment " 'SAFE' makes the aircraft static (stopped) on runway"; this disableAi "autoCombat"; this disableAI "CHECKVISIBLE" }; this addEventHandler ["Gear", { params ["_plane", "_gearDown"]; if (_gearDown) then { _plane setBehaviour "AWARE"; driver _plane disableAi "autoCombat"; driver _plane disableAI "CHECKVISIBLE"; systemChat "LG down" }; if !(_gearDown) then { driver _plane enableAi "autoCombat"; driver _plane enableAI "CHECKVISIBLE"; systemChat "LG retracted" }; }];
  14. About displays (general): There is no reason to remoteExec display and control layers (frames,buttons,data fields...). Your screen displays that locally. You just need to: - create the display locally (for each player, in init.sqf or initPlayerLocal.sqf) - share the public variables which are the core of this display (score, messages, shared data...) Anyway for a hint or a cutText, this kind of display can be remoteExec. Where did you define your time_capture? This data should be public. If not > zero divisor or undefined variable.