Jump to content

Ibragim A

Member
  • Content Count

    192
  • Joined

  • Last visited

  • Medals

Everything posted by Ibragim A

  1. In my opinion, the most primitive and suitable way for you will be the following: 1) the trigger must be activated by the presence of someone from your side in it. 2) give variable names (like: unit_1, unit_2 ...) to each unit that should disembark from the boat when this trigger is activated. 3) in the trigger activation write: {_x leaveVehicle lcvp2} forEach [unit_1, unit_2]; But remember that if the driver of the boat is from the same group, he will also get out of it. Make him a unit of another group. If the driver of the boat is from another group, then you can make it easier: 1) Give the variable name to the group itself (for example, group_1). 2) In the trigger activation write: group_1 leaveVehicle lcvp2;
  2. Ibragim A

    Formatting a Multiline Hint

    Try by this way: getUnitPositionId = { private ["_vvn", "_str"]; _vvn = vehicleVarName _this; _this setVehicleVarName ""; _str = str _this; _this setVehicleVarName _vvn; parseNumber (_str select [(_str find ":") + 1]) }; _id = _unit call getUnitPositionId;
  3. To delete all ammo your have in the ammo box use clearMagazineCargo. To add new magazines use addItemCargo.
  4. Ibragim A

    Simple Rearm Script

    weaponState.
  5. Ibragim A

    Formatting a Multiline Hint

    You also need to fix the block that counts the magazines suitable for the primary weapon. Your block counts the same magazine several times. Do it like this: // Count Primary Weapon Magazines { if (_x in _compMagArr) then {_cntMag = _cntMag + 1}; } foreach _unitMagArr;
  6. Ibragim A

    Formatting a Multiline Hint

    System chat is a bad idea for you. Use the usual hint + parseText as already stated instead: private _unitArr = units player; _unitArr deleteAt 0; private _hintStr = ""; if (isnil "kiaCnt") then { kiaCnt = 0; }; { private _unit = _x; private _health = round ((1 - damage _unit) * 100); // health in % from 0 to 100 private _kiaCnt = kiaCnt; //If Dead - Remove From Group - Increment Kill Counter if (_health == 0) then { kiaCnt = _kiaCnt + 1; private _grpDOA = createGroup [west, true]; [_unit] join _grpDOA; }; //Unit Info private _priWeap = primaryWeapon _unit; private _unitMagArr = magazines _unit; private _compMagArr = compatibleMagazines _priWeap; private _cntMag = 0; // Count Primary Weapon Magazines { private _compMag = _x; { private _unitMag = _x; if (_compMag == _unitMag) then {_cntMag = _cntMag + 1}; } foreach _unitMagArr; } foreach _compMagArr; private _logger = format ["<t align='center'>%1 || H: %2<br/>W: %3 || Mags: %4</t><br/><br/>", _unit, _health, _priWeap, _cntMag]; _hintStr = _hintStr + _logger; } foreach _unitArr; _logger = format ["<t align='center'>KIA: %1</t><br/>", kiaCnt]; _hintStr = _hintStr + _logger; hint parseText _hintStr;
  7. Ibragim A

    All AI suddenly not finding targets

    I faced a similar problem when I overloaded the map with triggers with a huge area and a large number of groups.
  8. The issue, as stated in the title, is that the MEH "Loaded" only works if the player saves the game with the SAVE option and then loads it from the same mission dialog, but if he chooses SAVE & EXIT and opens the mission again, this MEH does not work. I read that this event handler should be run in preinit and did everything as it says here. MEH "Loaded" is running from mod config.cpp as preinit function: config.cpp: class CfgFunctions { class PC { class preInitFunctions { file = "Addon_PC"; class doPreinit { preInit = 1; }; }; }; }; fn_doPreinit.sqf: addMissionEventHandler ["Loaded", { params ["_saveType"]; systemchat str _saveType; // Anything... }]; Maybe I did something wrong. Maybe there is another way how to handle the loading of the mission?
  9. The issue has been solved. There should be a small delay in the mission load handler: addMissionEventHandler ["Loaded", { params ["_saveType"]; _this spawn { waitUntil { sleep 0.1; !isnull (finddisplay 46) }; systemchat _this; }; }];
  10. Study this function, it uses the algorithm you need: /* Author: Jiri Wainar Description: Play set of ambient animations on given unit AND allows the unit to leave the ambient state and engage enemy or move away. Remarks: * Function controls BIS_fnc_ambientAnim; check that function [Remarks] section for more info of how to use it. * Unit automatically leaves the animation loop if there is an enemy in 300m he knows about. Parameter(s): 0: OBJECT - unit the anim & gear changes are going to be applied to 1: STRING (optional, default "STAND") - animation set id, describing what the unit's action looks like. > "STAND" - standing still, slightly turning to the sides. Needs a rifle! > "STAND_IA" - default a3 animations for standing, rifle lowered > "SIT_LOW" - sitting on the ground, with weapon. > "KNEEL" - kneeling, with weapon. > "LEAN" - standing while leaning (on wall) > "WATCH"/"WATCH1"/"WATCH2" - standing and turning around 2: STRING (optional, default "RANDOM") - equipment level id, describing how heavily is the unit equipped. > "NONE" - no goggles, headgear, vest, weapon > "LIGHT" - no goggles, headgear, vest > "MEDIUM" - no goggles, headgear > "FULL" - no goggles > "ASIS" (default) - no touches to the gear > "RANDOM" - gear is randomized according to the animation set 3: CODE or STRING (optional, default {false}) - condition that if true frees the unit from the animation loop 4: STRING (optional, default "COMBAT") - behaviour the unit should go to, when freed. Returns: - Example: [this,"STAND","FULL",{(player distance _this) < 5}] call BIS_fnc_ambientAnimCombat; */ //do the immediate operations ---------------------------------------------------------------------- private["_unit","_animset","_gear","_cond","_behaviour"]; private["_acceptableStates","_acceptableGear","_transAnim"]; _unit = _this param [0, objNull, [objNull]]; _animset = _this param [1, "STAND", [""]]; _gear = _this param [2, "ASIS", [""]]; _cond = _this param [3, {false}, ["",{}]]; _behaviour = _this param [4, "COMBAT", [""]]; _acceptableStates = [ "STAND", "STAND_IA", "SIT_LOW", "KNEEL", "LEAN", "WATCH", "WATCH1", "WATCH2" ]; _acceptableGear = [ "NONE", "LIGHT", "MEDIUM", "FULL", "ASIS", "RANDOM" ]; if !(_animset in _acceptableStates) exitWith { format["Definition of animset '%1' dosn't exist. Possible animsets are %2.",_animset,_acceptableStates] call BIS_fnc_error; }; if !(_gear in _acceptableGear) exitWith { format["Definition of gearset '%1' dosn't exist. Possible gearsets are %2.",_gear,_acceptableGear] call BIS_fnc_error; }; if (typeName _cond == typeName "") then { _cond = compile _cond; }; //execute the ambient anim [_unit,_animset,_gear,nil,nil,false] call BIS_fnc_ambientAnim; //transition animation _transAnim = "AmovPercMstpSrasWrflDnon"; [_unit,_cond,_transAnim,_behaviour] spawn { private["_unit","_cond","_transAnim","_animHandle","_behaviour","_unitPos"]; _unit = _this select 0; _cond = _this select 1; _transAnim = _this select 2; _behaviour = _this select 3; //wait for system to initialize on the unit waitUntil { sleep 0.1; _animHandle = _unit getVariable ["BIS_EhAnimDone", -1]; (_animHandle > -1) }; //wait for unlock condition evals to true waitUntil { sleep 0.1; (behaviour _unit == "COMBAT") || {(damage _unit > 0) || {(_unit call _cond) || {(_unit call BIS_fnc_enemyDetected)}}} }; _unitPos = unitPos _unit; //remove the Ai handcuffs {_unit enableAI _x} forEach ["ANIM", "AUTOTARGET", "FSM", "MOVE", "TARGET"]; _unit setBehaviour _behaviour; _unit setUnitPos "UP"; detach _unit; //unlock the unit from it's ambient animation _unit removeEventHandler ["AnimDone",_animHandle]; _unit playMoveNow _transAnim; sleep ((random 3) + 3); //return to the default or previously set unit pos _unit setUnitPos _unitPos; };
  11. My question is, is there any universal way to know which choice the user made in each of the vanilla command menus? For example, we have an RscGroupRootMenu menu in which the user can select Move There, Regroup, Hold Fire, etc. I want to understand, is it possible to get data about this choice right after the choice? At the moment there is a way to track this with the command inputAction "CommandingMenuSelect1" > 0. But it only works if the user makes a choice with the key [1] and only if the options in the menu are listed by numbers, and after all, the user often makes a choice in the command menu with the Space or the central mouse button, besides there are menus in which the options are not numbered (for example, RscGroupRootMenu). Therefore, this method is not universal. There is also another way - to track the message using the MissionEH "HandleChatMessage". But this method requires tracking messages in all languages and in all variants. Also, the message appears with a slight delay. In addition, there are options in different menus that do not provide messages to the user's chat. So, I'm looking for a way that, ideally, will give me access to the title or sequence number of the option that the user has selected in the command menu. For example, if the user has selected Move There in the RscGroupRootMenu menu, then the script provides me at this moment either its ordinal number in the menu, or the name in the form of a string: "Move There", or any other variable from which I can push off and find out the user's choice myself.
  12. There is an event handler in the in-game interface, but it handles only the action menu. inGameUISetEventHandler ["Action", "_index = _this select 2; _title = _this select 4;"]; I need to find a way to get something like this, but for command menus.
  13. Thanks for the advice, I've already tried it. This can help, but in very limited cases. My scripts contain other commands that change the status of the currentCommand, such as doMove, for example. Therefore, in my case, I cannot use this method. There are also options in various menus that do not change the status of currentCommand.
  14. I haven't tried it, but maybe you should try this mod.
  15. You're describing the formation of the squad. I think you should look for a script that allows you to make your own formations.
  16. In the command, identify the waypoint by its number. Also try the setCurrentWaypoint command: [group driver heli1, 3] setWaypointPosition [position postest1, 0]; // As far as it is clear from the explanation, the heli1 waypoint SAD has the ordinal number 3. (group driver heli1) setCurrentWaypoint [group driver heli1, 3];
  17. If you need a script for AI groups, I can recommend this script, which you can add to the activation of the waypoint from which the escape will begin. This is code from the GoGoGo mod, but for AI groups. IBR_ACC_AI_ANIM_SPEED_COEF = 0.2; Ibr_AI_fn_gogogo_combat_mode = { params ["_units"]; if (count _units == 0) exitWith {}; _targets = (leader (group (_units select 0))) targets [true, 1000, [], 0]; { (group (_units select 0)) forgetTarget _x; } forEach _targets; { [_x] spawn Ibr_AI_fn_dasableAI_in_gogogo_mode; } forEach _units; }; Ibr_AI_fn_dasableAI_in_gogogo_mode = { params ["_unit"]; { _unit disableAI _x; } forEach ["AUTOTARGET","AUTOCOMBAT","SUPPRESSION","WEAPONAIM"]; _speedCoef = getAnimSpeedCoef _unit; _unit setSpeedMode "FULL"; _mode = "BLUE"; _behaviour = "AWARE"; _unit setUnitCombatMode _mode; _unit setCombatBehaviour _behaviour; _unit setAnimSpeedCoef _speedCoef + IBR_ACC_AI_ANIM_SPEED_COEF; group _unit setCombatMode _mode; group _unit setBehaviourStrong _behaviour; sleep 0.1; waitUntil { _unit doTarget objNull; !(combatMode _unit in [_mode]) || !(behaviour _unit in [_behaviour]); }; _behaviour = behaviour (leader group _unit); { _unit enableAI _x; } forEach ["AUTOTARGET","AUTOCOMBAT","SUPPRESSION","WEAPONAIM"]; group _unit setCombatMode "YELLOW"; group _unit setBehaviourStrong _behaviour; { _x setUnitCombatMode "YELLOW"; _x setCombatBehaviour _behaviour; } forEach units group _unit; _unit setAnimSpeedCoef _speedCoef; }; [units group this] spawn Ibr_AI_fn_gogogo_combat_mode; Go Go Go! combat mode is terminated by changing the combat mode or behaviour.
  18. You write the position as an array with a position inside, but you need either just a position, or an object, or the name of the marker. See target here: https://community.bistudio.com/wiki/BIS_fnc_fireSupportVirtual Try to do it this way: ["POSIT", "F_40mm_White", 20, 10, 10] spawn BIS_fnc_fireSupportVirtual; Or: _mkr1 = getMarkerPos "POSIT"; [_mkr1, "F_40mm_White", 20, 10, 10] spawn BIS_fnc_fireSupportVirtual;
  19. Ibragim A

    how to fire bm-21 grad

    Your code doesn't specify charges. Try it this way: grad1 doArtilleryFire [getmarkerpos "potato1", currentMagazine grad1, 40]; Also keep in mind that the minimum(!) range of Grad is ~5 kilometers.
  20. https://community.bistudio.com/wiki/BIS_fnc_buildingPositions https://community.bistudio.com/wiki/setWaypointHousePosition https://community.bistudio.com/wiki/waypointAttachVehicle https://community.bistudio.com/wiki/buildingPos You can use waypoints attached to the building and desired position in it, or you can simply use the coordinates of a position in the building and the doMove command + make a loop by loop waypoint or any of waitUntil, while - do or any other scripting command for loops.
  21. Regarding the cinemaBorder there are issues again. The BIS_fnc_cinemaBorder function does everything the same as the showCinemaBorder command (creates borders, disables unit input, hides command bar ...), but the trouble is that when using the command, the variables used by the function do not react. That is, both the function and the command do the same thing, but they are encoded differently, so you cannot use function variables if the user used the command in the cutscene. Maybe the solution needs to be found in some kind of layers.
  22. Hi, I have a problem with the created graphic dialog, which in theory should be hidden during cutscenes, as all other BIS made IGUI dialogs. But the dialog I created remains on the screen surface when all vanilla dialogs disappear. I've tried changing the display ID from 46 to many others, but it doesn't work. I realized that, in principle, I can solve the problem by moving my dialog away from the screen or fading it by setting it's color alpha to zero. But I don't quite understand how I can get the beginning and the end of the cutscenes. Commands such as cutText or showCinemaBorder do not return variables. If someone has an idea, please share it with me. Thanks.
  23. I completely agree, so I understand that primitive methods will always not be universal, which means that only a set of primitive methods will work for all possible cases. The problem with an additional variable or flag is that users do not want them to have to subtract, enter anything at all, etc. Basically, they use mods on the principle of "what I understand, I do, what I don't understand, I don't need." This means that they simply won't bother with the extra requirements of the addon. There is another problem in this - missions that are already created by users. This variable is not involved in them. Yes, I tried to do it, as I said in the first post, but with no results.
  24. Thanks for the tip. Doesn't work, boolean doesn't change. It should be noted that even cinemaborder is not used in all cutscenes. And even the group commanding bar will not be on the screen if the player is alone in his group. Also, not all cutscenes create their own camera, although I tried to determine this, but in vain. Cutscenes do not change the returned variable with commands such as cameraView and cameraOn. Therefore, so far I see the only factor that is present in all cutscenes is partially disabled player control. But userInputDisabled is true only if it is set true by disableUserInput. And since it is no longer necessary to use this command for cutscenes, it may not be used.
  25. Yes, it wouldn't be a problem if I created these cutscenes. But my mod also works with missions created by other users, so I need a universal way to determine the beginning and end of the cutscene, which works in all cases, even if the cutscene was not created by me and does not contain a variable specially created by the mission maker indicating the beginning and end of the cutscene. At the moment, I could solve everything very simply if I had the opportunity to get a variable at the moment when the cutscene hides the user's command bar. I would put a condition with this variable in a script that periodically updates my command bar controls.
×