Jump to content

Leopard20

Member
  • Content Count

    762
  • Joined

  • Last visited

  • Medals

Everything posted by Leopard20

  1. Hi guys. I want to create a healing script using Hold Actions. I was wondering which method is best performance-wise. 1. Adding the hold actions to all individual units, with a straightforward conditionShow (see the Hold actions description): "alive _target && _target distance _this < 5 && getDammage _target > 0" in the above code, _target is the unit the action is attached to and _this is the caller (i.e player). Also, the action is removed every time it's added, so it might be applied to each unit multiple times during a game session. This code is simple if added to just one unit. However, there will be too many of these if there are lots of units (I'm aiming for +60!). 2. Adding only one action and to the player, but modifying the conditionShow as follows: "call {_units = applicableUnits select {alive _x && _x distance _target < 5 && ([visiblePosition _target, getDir _target, 60, visiblePosition _x] call BIS_fnc_inAngleSector) && (getDammage _x > 0)}; if (count _units > 0) then {_unit = _units select 0; _target setVariable ['target', _unit]; true} else {false}}" in the above code, _target is the same as the caller (i.e player), and applicableUnits is an array of applicable units! The reason for adding the "target" variable is here: This code is obviously more demanding, especially if it's run on each frame (which I'm assuming it is).
  2. @Dedmen Right! "Lazy-checking" the condition using { } (at least that's what Larrow called it!)! I totally forgot! Thanks! The reason for checking that the target (player) is facing the wounded unit is to make sure that the action correctly corresponds to the unit you're looking at, not any random unit in your vicinity.
  3. Here's the code: Init box: this setVariable ["VehDamage", (getDammage this)]; this addEventHandler ["HandleDamage", { params ["_obj", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; _damage = ((_obj getVariable ["VehDamage", 0]) + _damage)/2 min 1; //**** _obj setDamage _damage; _obj setVariable ["VehDamage", _damage]; _damage }]; If you want to reduce the damage even further, like 1/3, change the asterisked line as follows: _damage = ((_obj getVariable ["VehDamage", 0])*2 + _damage)/3 min 1; //**** Note that it won't necessarily reduce the damage by half; it will simply keep it "close" to the previous damage to prevent "excessive" damage (sometimes damages over 1 can be dealt to objects!) For the mod version, you can add a loop like this: waitUntil { sleep 10; { if (vehicle _x != _x) then { _veh = vehicle _x; if (_veh getVariable ["damageEH", -1] == -1) then { _veh setVariable ["VehDamage", (getDammage _veh)]; _EH = _veh addEventHandler ["HandleDamage", { params ["_obj", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; _damage = ((_obj getVariable ["VehDamage", 0]) + _damage)/2 min 1; //**** _obj setDamage _damage; _obj setVariable ["VehDamage", _damage]; _damage }]; _veh setVariable ["damageEH", _EH]; } } } forEach allUnits; false } This will add the EH to all manned vehicles. Of course you can still make this more elaborate but I'm not in the mood to explain!
  4. @john1 For creating convoys, fast roping and heli pickups you might wanna check C2 by mad_cheese. He's doing a great job at them. He also has a vehicle spawner mod you might wanna check out. They're all at his Discord channel. You can also spawn vehicles via Zeus if you enable it in my mod's settings. Changing spacing and formation for vehicles (especially air vehicles) is not possible in ARMA 3 (at least not without complicated coding). Even getting a convoy to successfully move from one point to another is a hit-or-miss. As for the half-damage-feature request, lucky for you I've been developing something similar (although more complex) for my upcoming mission. I'll post it for you when I get a chance. But I won't incorporate it into the mod, because it's nothing but a cheat. You can, however, add it to the vehicle's init field or create a mod for it yourself. You can dismantle a mod that does something similar (Liability Insurance is a great example), namely adding an EH, replace the code and recompile it for your personal use.
  5. Leopard20

    Arma 3 Notepad++ Syntax Highlighting

    @Janez Hi. It turns out the issue I had with alphabetical sorting was because of a bug in Notepad++. I was using Function Completion only, but after switching to "Word and Function Completion" my issue is gone! I hope it'll be useful to others running into the same problem!
  6. Nope! At least not yet! I just typed all that on my phone. I'll have to check it later on my computer! ;)
  7. Hello everyone. Does anyone know a way to add hold actions to hidden units? Unfortunately, when a unit is hidden using hideObject the action doesn't appear anymore. However, if there was a way to hide the unit without using hideObject it would work. My first idea was to use setObjectTexture, but it doesn't hide the unit completely (the unit's face and arms are still visible)
  8. Think of it as a healing script. I want to heal the unit. https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd What I meant by my previous code is that the action appears when you look at the unit and he's close to you. I use the "patient" variable to later retrieve the unit in the conditionshow, thus eliminating the need to look at the unit all the time and also using it in code progress part.
  9. What about this one: //adding this to the "action appear" condition _unit = cursorObject player; if !(_unit in WoundedUnits && _unit distance player < 7) then {_unit = objNull}; player setVariable ["patient", _unit]} and then using this variable in "condition progress" for further processing.
  10. I don't want the player to look at the unit directly. The unit being in player's filed of view should suffice!
  11. Not a bad idea. There's just one tiny problem. I'm creating a script that performs an action on the hidden unit and thus adding the action to the unit is more convenient (you can easily retrieve the unit, i.e. target, using the action parameters). If I add it to the player, I probably should resort to using something like this: _units = allUnits select {_x distance player < 7 && ([visiblePosition player, getDir player, 60, visiblePosition _x] call BIS_fnc_inAngleSector)}; _units = [_units, [], {_x distance2D player}, "ASCEND"] call BIS_fnc_SortBy; _unit = _units select 0; just to get the unit the player is looking at! Doesn't it make the game slow?
  12. Hey guys. Does anyone know how I can force a specific difficulty for a SP mission?
  13. Leopard20

    Arma 3 Notepad++ Syntax Highlighting

    @Janez Turns out the above command's sibling is also missing! BIS_fnc_holdActionRemove
  14. Leopard20

    Arma 3 Notepad++ Syntax Highlighting

    @Janez Another missing command that I came across: BIS_fnc_holdActionAdd
  15. Hi! Thanks for the bug report. I'll look into it. If you use the "Fortify Position" infantry command under "Defense" sub-menu, you can get them to spread around in a circular fashion and take cover within a set radius. They will also use nearby buildings. I haven't checked this function in a while so it might not work perfectly but give it a go!
  16. Anyone else know the answer?
  17. @pierremgi @reyhard Does modifying the class 'custom' also affect the user profile difficulty settings? If yes, can I add another custom difficulty class (say 'MyDifficulty') to the existing ones too?
  18. Hello everyone. Does anyone know what is the difference between createDisplay and createDialog commands? (minus the syntaxes, obviously!) Are there any cases where one is favored over the other?
  19. Leopard20

    Arma 3 Notepad++ Syntax Highlighting

    @Janez This command is missing: enableWeaponDisassembly
  20. Leopard20

    ASR AI 3

    Really? Huh. I thought it was ASR AI. I never play with vanilla AI!
  21. @Asaayu Thanks for this mod! It's really cool. If you don't mind, I would like to give you some advice regarding use of "while". It is recommended not to use multiple "sleep"'s inside a "while" because it causes a (random) bug where the code might not terminate completely when the while loop ends. It simply pauses temporarily, and as soon as you run the same code again the old while loop starts running too (i.e. you'll have 2 while loops at the same time, and these keep piling up the more you run the same code). I've had it happening before in my codes and I've noticed that it impacts performance very badly if the code is persistent. I'm not sure if it still happens but you should be able to verify that by defining a global variable and adding values to it using a while loop with two sleep's or more, and terminating it and running it again. Hope it helps!
  22. That's really strange. The error shouldn't cause any problem that I know of. I get it too. I still haven't been able to fix it. But you can uncheck "Create High Command Module" from CBA Settings to avoid it (some HC functions might not work without it though). Can you test something for me please? Go to Editor (preferably not in VR), place a few units, run the mission and then paste this code in Debug Console: [(units group player), 30, 0] execVM "AIO_AIMENU\moveToCover.sqf" If it works, it means that the command "groupSelectedUnits" doesn't work, which is weird. Speaking of which, how do you select your units exactly? Note that you should select your units first, then open the menu.
  23. Leopard20

    [SP/MP]Advanced Fierce Combat System

    https://forums.bohemia.net/forums/topic/177967-c2-command-and-control/
×