Jump to content

ShadowRanger24

Member
  • Content Count

    126
  • Joined

  • Last visited

  • Medals

Everything posted by ShadowRanger24

  1. Hi everyone, So I am currently trying to get a CPR animation loop working for a revive script on players. However I am experiencing some issues. I am trying to replicate the smooth looping of an Arma 3 CPR animation which works perfectly fine in the animation viewer, but once I use it on a player it just does not work. I will point out that I have tried several different methods of looping the animation including the use of the AnimDone event handler to no effect. Here is the script I am using for testing: private _animDuration = 9.09091; private _animLastTick = time; player playMoveNow "AinvPknlMstpSnonWnonDr_medic0"; while {true} do { if ((time - _animLastTick) > _animDuration) then { _animLastTick = time; player playMoveNow "AinvPknlMstpSnonWnonDr_medic0"; }; }; Any help would be much appreciated. Thanks in advance.
  2. The majority of the information in this thread has been extracted from @celery's original post which can be viewed here: This thread is an updated version of the above post, addressing all outdated information. If anyone notices any incorrect information in this new one or has anything that should be added, please respond to this thread with what you would like to say. HandleDamage Event Handler Explained The passed array _this select 0 (unit): Object the event handler is assigned to _this select 1 (hitSelection): Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections. _this select 2 (damage): Damage to the above selection (sum of dealt and prior damage) _this select 3 (source): The source unit that caused the damage _this select 4 (projectile): Class name of the projectile that inflicted the damage ("" for unknown, such as falling damage) _this select 5 (hitPartIndex): Hit part index of the hit point, -1 otherwise _this select 6 (instigator): Person who pulled the trigger _this select 7 (hitPoint): Hit point Cfg name Infantry selections "": The overall damage that determines the damage value of the unit. Unit dies at damage equal to or above 1 "face_hub": Unit dies at damage equal to or above 1 "neck": Unit dies at damage equal to or above 1 "head": Unit dies at damage equal to or above 1 "pelvis": Unit dies at damage equal to or above 1 "spine1": Unit dies at damage equal to or above 1 "spine2": Unit dies at damage equal to or above 1 "spine3": Unit dies at damage equal to or above 1 "body": Unit dies at damage equal to or above 1 "arms": Unit doesn't die with damage to this part "hands": Unit doesn't die with damage to this part "legs": Unit doesn't die with damage to this part The "" part is the reason why consecutive leg hits are fatal. Whenever the unit is hit, "" gets damage based on the power of the hit with no other modifiers. Wherever you hit the unit, it will die when this overall damage quota is up. How the event handler fires The event handler fires multiple times at the same time when the unit is damaged, once for each selection. The sequence is always the same, the sequence for infantry being the same as in the selection list above. Only the current selection and its damage are remembered during each activation unless you assign variables to them. The EH can trigger "twice" per damage event. Once for direct damage, and once for indirect damage (explosive damage). This can happen even in the same frame, but is unlikely. It is also worth noting that the event will continue to fire for a unit even if it's already dead. Manipulating damage The last value given in the EH's code is the damage that it gives for the current selection. Remember that if the code is too complex to be written into the EH itself, only callable scripts should be used for the purpose of determining damage because the damage has to be given in the EH's code. How to prevent the unit from taking damage completely: _unit addEventHandler ["HandleDamage", {0}]; How to prevent the unit from taking damage, but keeping the unit's original damage and not removing any prior damage. _unit addEventHandler ["HandleDamage", { private _unit = _this select 0; private _hitSelection = _this select 1; if (_hitSelection isEqualTo "") then {damage _unit} else {_unit getHit _hitSelection}; }]; How to pass damage to certain parts only: _unit addEventHandler ["HandleDamage", { private _unit = _this select 0; private _hitSelection = _this select 1; // If the part is in ["head", "face_hub"], allow damage to it, otherwise return the part's original damage with none in addition if (!(_hitSelection in ["head", "face_hub"])) then { _damage = if (_hitSelection isEqualTo "") then {damage _unit} else {_unit getHit _hitSelection}; }; _damage }]; Additional Information You can now return the current damage for individual hit selections in Arma 3 through the getHit command: https://community.bistudio.com/wiki/getHit
  3. So I noticed that I haven't seen many missions use any sort of auto-run feature, so I decided to write my own script for it which I thought some people might want to use. I've put it into a KeyDown event handler to demonstrate how it could be implemented, but feel free to use it however you like. (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_control", "_dikCode", "_shift", "_ctrl", "_alt"]; private _handled = false; switch (_dikCode) do { // Key 0 case 11: { if (isNil "AR_active") then {AR_active = false;}; if (AR_active) exitWith {AR_active = false; _handled = true;}; if (!isNull objectParent player) exitWith {}; if (surfaceIsWater (getPos player)) exitWith {}; AR_active = true; AR_weapon = currentWeapon player; AR_animation = switch (true) do { case (AR_weapon isEqualTo ""): {"AmovPercMevaSnonWnonDf"}; case (AR_weapon isEqualTo (primaryWeapon player)): {"AmovPercMevaSlowWrflDf"}; case (AR_weapon isEqualTo (secondaryWeapon player)): {"AmovPercMevaSlowWrflDf"}; case (AR_weapon isEqualTo (handgunWeapon player)): {"AmovPercMevaSlowWpstDf"}; }; player playMoveNow AR_animation; player addEventHandler ["AnimChanged", { if ((!AR_active) || {!((currentWeapon player) isEqualTo AR_weapon)} || {!isNull objectParent player} || {surfaceIsWater (getPos player)}) exitWith { player removeEventHandler ["AnimChanged", _thisEventHandler]; AR_weapon = currentWeapon player; AR_animation = switch (true) do { case (AR_weapon isEqualTo ""): {"AmovPercMstpSnonWnonDnon"}; case (AR_weapon isEqualTo (primaryWeapon player)): {"AmovPercMstpSlowWrflDnon"}; case (AR_weapon isEqualTo (secondaryWeapon player)): {"AmovPercMevaSlowWlnrDf"}; case (AR_weapon isEqualTo (handgunWeapon player)): {"AmovPercMstpSlowWpstDnon"}; }; player playMoveNow AR_animation; AR_active = false; AR_weapon = nil; AR_animation = nil; }; player playMoveNow AR_animation; }]; _handled = true; }; }; _handled }]; There is only one caveat to this script that I've noticed, which is that when running up hills it doesn't slow you down like it would if you were to run up one normally. Updated (21/06/2017): - Auto run now automatically disables when the player runs into water or gets into a vehicle - Auto run can no longer be started if in water or a vehicle - Changed an occurrence of playMove to playMoveNow
  4. So I've been stuck with this issue for a while. I've tried asking different people but I haven't been able to find anyone who knows how to do this. Basically what I'm trying to replicate is Eden menus (e.g attribute menus) blocking input to background dialogs when their opened. For example, when you open an overlay display in the Eden editor, you will only be able to interact with that display, and any input to background ones are disabled. I have looked into the Eden editor dialog classes, and I can see that they all use "ctrlStaticBackgroundDisable" for this by the looks of it. I have tried to replicate it, but it just doesn't work. Dialog file: https://pastebin.com/3niigADA Creation of the dialog: private _mainDisplay = [] call BIS_fnc_displayMission; private _display = _mainDisplay createDisplay "SR_RscDisplayTest"; Any help would be much appreciated. Thanks in advance.
  5. ShadowRanger24

    Arma Languages support for Atom

    Arma language support for Atom has been updated to version 2.13.0! Changelog: - BI Commands from Arma 3 v1.78 - BI Functions from Arma 3 v1.78 - CBA Functions from CBA 3.6.1
  6. ShadowRanger24

    Updated All in One Config Dumps

    Vanilla 1.80 https://www.dropbox.com/s/cvjxol572cca1pd/AiO.1.80.143869.cpp?dl=0
  7. ShadowRanger24

    HandleDamage Event Handler Explained

    This would work, however if you would want to prevent any previous damage from being removed you'd need to tweak it a little more like this: _unit addEventHandler ["HandleDamage", { private _unit = _this select 0; private _hitSelection = _this select 1; private _damage = _this select 2; if (true) then { if (_hitSelection isEqualTo "") then { damage _unit } else { _unit getHit _hitSelection }; } else { _damage }; }];
  8. Are there any plans on adding support for pixel grid GUI positioning?
  9. ShadowRanger24

    Updated All in One Config Dumps

    Could someone please provide an updated config for the latest Arma 3 version?
  10. So was just wondering, what does everyone use for extracting and packing PBO files? I've been using PBO Manager, but it hasn't been updated in years so wanted to know if there were any popular updated ones. Preferably one with support for adding extraction buttons to the right click menu in the Windows file explorer. Thanks in advance.
  11. Hey guys so I'm working on a custom menu but have run into a small issue which I'm not sure how to resolve. Here's the menu code: class testMenu { idd = 2002; name = "testMenu"; movingEnable = false; class controls { class IGUIBack_2200: IGUIBack { idc = 2200; x = 0.381406 * safezoneW + safezoneX; y = 0.434 * safezoneH + safezoneY; w = 0.226875 * safezoneW; h = 0.132 * safezoneH; }; class RscFrame_1800: RscFrame { idc = 1800; x = 0.381406 * safezoneW + safezoneX; y = 0.434 * safezoneH + safezoneY; w = 0.226875 * safezoneW; h = 0.132 * safezoneH; colorText[] = {0,0,0,1}; }; class RscButtonMenu_2400: RscButtonMenu { idc = 2400; text = "Button 1"; //--- ToDo: Localize; x = 0.386562 * safezoneW + safezoneX; y = 0.445 * safezoneH + safezoneY; w = 0.216563 * safezoneW; h = 0.022 * safezoneH; }; class RscButtonMenu_2401: RscButtonMenu { idc = 2401; text = "Button 2"; //--- ToDo: Localize; x = 0.386562 * safezoneW + safezoneX; y = 0.478 * safezoneH + safezoneY; w = 0.216563 * safezoneW; h = 0.022 * safezoneH; }; class RscButtonMenu_2402: RscButtonMenu { idc = 2402; text = "Button 3"; //--- ToDo: Localize; x = 0.386562 * safezoneW + safezoneX; y = 0.533 * safezoneH + safezoneY; w = 0.216563 * safezoneW; h = 0.022 * safezoneH; }; }; }; For some reason whenever I open the menu I get this error: No entry "profileLocation\mpmissions\TestMission.Tanoa\description.ext\testMenu\controls\RscButtonMenu_2400.textureNoShortcut'. Any help would be much appreciated. Thanks in advance.
  12. So I'm trying to create markers but for some reason using the createMarker commands aren't working. Here's the test code I'm working with trying to get it working: createMarkerLocal ["Test", [0,0,0]]; "Test" setMarkerShapeLocal "RECTANGLE"; "Test" setMarkerColorLocal "ColorBlue"; "Test" setMarkerTextLocal "Test"; Using this code has no effect what so ever. The marker does not show up for some reason. Any ideas why?
  13. ShadowRanger24

    Updated All in One Config Dumps

    Has anyone run this for the latest Arma version? I can't seem to run this script, even with the extension installed. It hangs and then crashes my game everytime, and I don't even have that bad of a computer. I tried getting my friend to do it too who has a high end PC and it did the same for him too.
  14. ShadowRanger24

    General Discussion (dev branch)

    Was the font for the code entry box in the debug console changed? The font is a bit odd looking and not as easily readable for me. Not sure if anyone else has noticed this?
  15. ShadowRanger24

    General Discussion (dev branch)

    @killzone_kid Do you reckon it would be possible to have the idea of the ability to execute code in the debug console on a certain player? Would be a cool feature to have with these other recent improvements to the debug console.
  16. ShadowRanger24

    General Discussion (dev branch)

    With these nice updates on the debug console, would it be possible to have the ability to remote execute code on a specified target player added? Through like a combo box or something? Would be a great addition.
  17. So someone on Discord showed me how to generate points around a circle based on a given amount and center position. However it has an issue, for some reason the first and last position in every returned array is the same. I can't seem to figure out why. Here's the script: params [ ["_amount", 0, [0]], ["_origin", [], [[]]], ["_radius", 0, [0]] ]; private _positions = []; for "_a" from 0 to 360 step (360 / (_amount - 1)) do { _positions pushBack (_origin getPos [_radius, _a]); }; _positions Thanks in advance.
  18. ShadowRanger24

    Points Around Circle Issue

    Yeah got it sorted, wasn't thinking properly. Cheers tho. For anyone curious to what needed to be changed for it to work: params [ ["_amount", 0, [0]], ["_origin", [], [[]]], ["_radius", 0, [0]] ]; private _positions = []; for "_a" from 0 to 359 step (360 / _amount) do { _positions pushBack (_origin getPos [_radius, _a]); }; _positions
  19. ShadowRanger24

    Points Around Circle Issue

    -snip-
  20. ShadowRanger24

    [Release] Auto Run Script

    I updated the code to prevent auto run in water or in a vehicle and to automatically disable it if the player does so. Just gotta work on the running up hills part now.
  21. ShadowRanger24

    [Release] Auto Run Script

    Yeah I definitely will for future. This is my first script release so haven't done it many times before. Cheers for the advice though.
  22. ShadowRanger24

    [Release] Auto Run Script

    Oh wow I'm a goose completely didn't notice. I had this code implemented differently in my mission so I extracted it out and wasn't thinking when I put it in this thread. I've corrected it. Thanks for pointing that out.
  23. ShadowRanger24

    [Release] Auto Run Script

    You shouldn't be seeing it like that? For me it's like this: player addEventHandler ["KeyDown", {
  24. ShadowRanger24

    HandleDamage Event Handler Explained

    @archibald tutter gok_fnc_renderhstext = { _victim = _this select 0; _sel = _this select 1; _damage = _this select 2; _shooter = _this select 3; if ((_sel in ["head","face_hub"]) && (_damage >= 1) && (!alive _victim)) then { if ((isPlayer _shooter) && !(_shooter isEqualTo _victim)) then { [parseText "<t align = 'center' shadow = '1' size = '1' font='PuristaBold'><br/><br/><br/><br/>HEADSHOT<br/>", [ safeZoneX + safeZoneW - 1.40 - 0.025, safeZoneY + safeZoneH - 0.45 - 0.05, 0.45, 0.35 ], [10, 5], 2, 1.1, 0.2] remoteExec ["BIS_fnc_textTiles",_shooter]; playSound "headshot01"; }; }; }; That should work for sending the text to the shooter with remoteExec.
  25. ShadowRanger24

    HandleDamage Event Handler Explained

    @archibald tutter So did you manage to resolve your issue? If not, try the code below. I've also added in a check for an extra damage selection of "face_hub" which will make the detection more accurate for head shots as it will include damage to the face as well as the head. gok_fnc_renderhstext= { _victim = _this select 0; _sel = _this select 1; _damage = _this select 2; _shooter = _this select 3; if (_sel in ["head","face_hub"] && _damage >= 1 && !alive _victim) then { 0 = [ parseText format [ ("<t align = 'center' shadow = '1' size = '1' font='PuristaBold'><br/><br/><br/><br/>HEADSHOT<br/>")], [ safeZoneX + safeZoneW - 1.40 - 0.025, safeZoneY + safeZoneH - 0.45 - 0.05, 0.45, 0.35 ], [10, 5], 2, 1.1, 0.2 ] spawn BIS_fnc_textTiles; playsound "headshot01"; }; }; If have any questions or have issues with the above code, let me know. :)
×