Jump to content

Ibragim A

Member
  • Content Count

    192
  • Joined

  • Last visited

  • Medals

Everything posted by Ibragim A

  1. User input is partially disabled during cutscenes. But at the same time, the userInputDisabled command still returns false. I'm wondering if it's possible to use the ctrlVisible command in order to determine the beginning of the scene by the disappearance of the group command bar?
  2. There is a command shownHUD that shows an active HUD, but it does not respond to HUD changes during cutscenes. Syntax: shownHUD Return Value: Array in format [hud, info, radar, compass, direction, menu, group, cursors, panels, kills, icon3d] For example, it will continue to return true for (shownHUD select 6) even after the group command bar is not visible during cutscenes. There are also commands like visibleCompass, visibleWatch, visibleGPS ... that react to whether a certain interface element is shown on the player's screen, which could immediately solve my problem if the same command could be for the group command bar.
  3. You can check it by yourself by calling conditions with systemchat or hint commands, for example: Your_condition_1 = { systemchat "cond 1"; false; }; Your_condition_2 = { systemchat "cond 2"; false; }; Your_condition_3 = { systemchat "cond 3"; false; }; if (call Your_condition_1 && call Your_condition_2 && call Your_condition_3) then {}; /*Then delete it and replace by:*/ _Your_false_units = units group player select {call Your_condition_1 && call Your_condition_2 && call Your_condition_3}; /*Then run the following and see the difference:*/ if (call Your_condition_1 && {call Your_condition_2 && {call Your_condition_3}}) then {}; _Your_false_units = units group player select {call Your_condition_1 && {call Your_condition_2 && {call Your_condition_3}}}; If you see 3 systemchats on your screen, it means that your code evaluates 3 conditions. If your see 1 systemchat, it means, that only first condition was evaluated.
  4. Ibragim A

    How to Play a random sound from a list

    Oh, sorry. Of course: [] execVM "Your_sound_script.sqf";
  5. Ibragim A

    How to Play a random sound from a list

    In trigger activation: [] spawn "Your_sound_script.sqf"; Then make Your_sound_script.sqf in your mission folder & put in it: _sound = selectRandom [ "sound_1", // As defined by you in Description.ext "sound_2", "sound_3" ]; playSound _sound;
  6. Well, my UI control is created in the most primitive way, without configurations. So, I have config.cpp in my mod: class Extended_PostInit_EventHandlers { Ibragim_PC_mod_init = "[] execVM '\Addon_PC\PC_init.sqf';"; }; Then from PC_init.sqf I run the mod scripts, including the PC_gui_bar.sqf script: [] execVM "PC_gui_bar.sqf"; Then PC_gui_bar.sqf just creates controls on display 46: _PC_GUI_SQUAD_1_BAR_NUMBBACK = (findDisplay 46) ctrlCreate ["RscPicture", 12751]; _PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetTextColor [(profilenamespace getvariable ['IGUI_BCG_RGB_R',0]), (profilenamespace getvariable ['IGUI_BCG_RGB_G',1]), (profilenamespace getvariable ['IGUI_BCG_RGB_B',1]), (profilenamespace getvariable ['IGUI_BCG_RGB_A',0.8])]; _PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetPosition [ (_PC_GUI_SQUAD_1_BAR_X + 0) * ( ((safezoneW / safezoneH) min 1.2) / 40), (_PC_GUI_SQUAD_1_BAR_Y + 1) * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25), 4 * ( ((safezoneW / safezoneH) min 1.2) / 40), 1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) ]; _PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlCommit 0; _PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetText "Addon_PC\images\CommandBar\unitNumberBackground4_ca.paa";
  7. Try this way: _text1 = str (getItemCargo this); _text2 = str (getWeaponCargo this); _text3 = str (getMagazineCargo this); _text4 = str (getAmmoCargo this); copyToClipboard ("Items: " + _text1 + "; Weapons: " + _text2 + "; Magazines: " + _text3 + "; Ammo: " + _text4);
  8. I want to understand how to properly code controls in such a way that after saving and loading scenario they do not disappear. For example, I created a control on display 46 in my mod scripts: PC_GUI_SQUAD_1_BAR_NUMBBACK = (findDisplay 46) ctrlCreate ["RscPicture", 12751]; Then my mod scripts can change its position, color, size, etc. : PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetTextColor [0, 0, 0, 0.2]; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetPosition [ (PC_GUI_SQUAD_1_BAR_X + 0) * ( ((safezoneW / safezoneH) min 1.2) / 40), (PC_GUI_SQUAD_1_BAR_Y + 1) * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25), 4 * ( ((safezoneW / safezoneH) min 1.2) / 40), 1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) ]; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlCommit 0; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetText "Addon_PC\images\CommandBar\unitNumberBackground4_ca.paa"; Everything works fine until I save and load a saved game. In this case, control is lost (PC_GUI_SQUAD_1_BAR_NUMBBACK returns no Control instead of Control #12751) and stops responding to any changes. That is, the picture remains on the screen, but it is no longer possible to change it in any way. My question is how to keep the control created on display 46 even after reloading the scenario, or is there any special method to restore this control?
  9. At the moment, I solved the problem by deleting and re-creating the same control in the mission event handler "Loaded", launching it in preinit function. addMissionEventHandler ["Loaded", { params ["_saveType"]; {if (ctrlIDC _x isEqualTo 12751) then {ctrlDelete _x;};} forEach (allControls findDisplay 46); PC_GUI_SQUAD_1_BAR_NUMBBACK = (findDisplay 46) ctrlCreate ["RscPicture", 12751]; }]; But I'm not sure this is the only way.
  10. To stop your AI vehicle from moving, write in its init: (driver this) disableAI "PATH"; this engineOn false;
  11. I'm not good at multiplayer scripts at all, but I see that you're using a loop in unscheduled environment . Also, the brackets in the code are mixed up in places. May be try: addMissionEventHandler ["PlayerConnected", { _playerUnit = (_this select 1) call BIS_fnc_getUnitByUID; _playerside = side _playerUnit; }];
  12. Maybe you should try a combination of (does vehicle have some magazines) AND (can vehicle fire)? Like: if (magazines [_vehicle, true] isNotEqualTo [] && !(canFire _vehicle)) then { deleteVehicle _vehicle; };
  13. Ibragim A

    random road position

    Yes, that's true, and because of those two things, I wouldn't try to check random roads all over the map at all. I would make it very simple: I would create a hundred or two markers in those places that exactly fit my conditions, and make a random selection from them. 100-200 random positions (rather than thousands) is enough for those who like to randomize everything possible.
  14. Ibragim A

    random road position

    Try something like this: _all_roads = _all_roads - _bad_roads; /// From here _random_road = objNull; while (true) do { _random_road = selectRandom _all_roads; _isFlat = !(position _random_road isFlatEmpty [100, -1, 0.05, 100, 0, false, player] isEqualTo []); if (_isFlat) exitWith {}; }; _width = (getRoadInfo _random_road) select 1; _start = (getRoadInfo _random_road) select 6; _end = (getRoadInfo _random_road) select 7; _dir = _start getDir _end; /// To here bcn = createVehicle ["Sign_Sphere10cm_F", _random_road, [], 0, "CAN_COLLIDE"]; // placeholder for offset sleep 0.1;
  15. Ibragim A

    random road position

    _chkpntpos = !(position bcn isFlatEmpty [100, -1, 0.05, 100, 0, false, player] isEqualTo []); _finalspwnpos = _random_road arrayIntersect _chkpntpos; The above part of the code is wrong. _chkpntpos will result in boolean (true or false) neither of the _chkpntpos and _random_road variables is an array. You need to create a loop for checking random positions, exiting the loop if the random position matches your conditions.
  16. Ibragim A

    UnitCapture and landing gear down?

    Well, you're exaggerating!
  17. Ibragim A

    [Release] Holster Weapon Script

    If so, you must use the addaction command in your addAction.sqf script Like: params ["_player"]; _player addAction ["Text you like", {(_this select 0) action ["SWITCHWEAPON", (_this select 0), (_this select 0), -1];}]; It seems to me that for your idea, the waitUntil loop is useless.
  18. Ibragim A

    UnitCapture and landing gear down?

    As the wiki says, in order to use landgear for AI, the action must be done on every frame. Have you tried this way?
  19. Ibragim A

    random road position

    If you follow this methodology, then I advise you to create objects on the side (in the sky, over the sea, at position [0,0,0] and so on), then rotate them in the right direction and only after that put them in the right place for you with setPos. So you can avoid the effect of rotating objects at the start of the mission.
  20. Ibragim A

    random road position

    There are several commands to help find roads. The problem is that none of these commands find absolutely all roads. Each of them can find those that the other could not find. So, you should first use different commands to find all the roads in a certain sector, for example, within a 500m radius around the player: _roads_1 = nearestTerrainObjects [position player, ["Road"], 500]; _roads_2 = (position player) nearRoads 500; _all_roads = _roads_1 + _roads_2; To get rid of duplicate road objects, remove them from the array: _all_roads = _all_roads arrayIntersect _all_roads; Now you can extract a random object from the array: _random_road = selectRandom _all_roads; To get that road position use: _position = position _random_road; Most likely you will need the width of the road and its direction: _width = (getRoadInfo _random_road) select 1; _start = (getRoadInfo _random_road) select 6; _end = (getRoadInfo _random_road) select 7; _direction = _start getDir _end;
  21. Ibragim A

    Custom module function not working.

    What exactly happens and what doesn't? Does your module appear in the list of modules? Try to config it with the parameter isTriggerActivated = 0;
  22. It seems to me that your unit probably sometimes dies before the creation of the action via the event handler. As a condition for the making him in unconsciousness state, you do not use the unit's real damage, but a new one that will be added to the real one. Therefore, most likely in a situation where the unit already has 0.4 damage, and your shot will add 0.7 damage to it, the handler will not allow the unit to fall into an unconscious state, but simply skip this moment. Try using ((damage _unit + _damage) >= 1 || _unit getHit "" >= 1) instead of (_damage >= 1 || _unit getHit "" >= 1)
  23. Ibragim A

    Simple ParaDrop Script

    Hello, thanks to the author for this script, I use it in my mod. I would like to point out one mistake that prevents parachutes from opening at small altitudes. This mistake is in this part of the code: { _x setVariable ["Saved_Loadout",getUnitLoadout _x];// Save Loadout removeBackpack _x; _x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected. _x allowdamage false;// Good Old Arma, they still can take damage on Vehcile exit. unassignvehicle _x; moveout _x; _x setDir (_dir + 90);// Exit the chopper at right angles. _x setvelocity [0,0,-5];// Add a bit of gravity to move unit away from _vehicle sleep 0.3;//space the Para's out a bit so they're not all bunched up. } forEach _paras; { [_x,_chuteheight] spawn ParaLandSafe; } forEach _paras; The block that triggers the distance check and the opening of the parachute (ParaLandSafe) is only spawned after all paratroopers have jumped out with an interval of 0.3 seconds. If the number of paratroopers is, lets say, 15 units, then this is a total of 4.5 seconds. During this time, the first paratrooper has already flown more than 150 meters. The corrected part of the code will look like this: { _x setVariable ["Saved_Loadout",getUnitLoadout _x];// Save Loadout removeBackpack _x; _x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected. _x allowdamage false;// Good Old Arma, they still can take damage on Vehcile exit. unassignvehicle _x; moveout _x; _x setDir (_dir + 90);// Exit the chopper at right angles. _x setvelocity [0,0,-5];// Add a bit of gravity to move unit away from _vehicle sleep 0.3;//space the Para's out a bit so they're not all bunched up. [_x,_chuteheight] spawn ParaLandSafe; /// <---- HERE } forEach _paras;
  24. Hello, I want to find some scripts that will help me understand exactly how I can create a command bar with groups, the same as in HC. I tried to open scripts in HC modules Scripts a3\modules_f\hc\data\scripts\hc.sqf a3\modules_f\hc\data\scripts\hc_gui.sqf a3\modules_f\hc\data\scripts\hc_gui_menu.sqf a3\modules_f\hc\data\scripts\hc_gui_stat.sqf a3\modules_f\hc\data\scripts\hc_local.sqf a3\modules_f\hc\data\scripts\hc_sound.sqf But I could not find the necessary information in them. Maybe someone has a ready-made script that can clearly show me exactly how to create a similar IGUI element? I am sure that if I understand the principle with an example, I can do the rest myself. Thank you. Group Commanding Bar in HC is like this in the lower left corner:
  25. Ibragim A

    HC Group Command Bar

    Well, I already figured out how to do it myself. If someone is interested in how this is done, you can look through the code that I will leave in this thread.
×