Jump to content

ShadowRanger24

Member
  • Content Count

    126
  • Joined

  • Last visited

  • Medals

Everything posted by ShadowRanger24

  1. ShadowRanger24

    HandleDamage Event Handler Explained

    @archibald tutter addMPEventHandler isn't compatible with HandleDamage, you will need to use addEventHandler. Within your HandleDamage function, you have a check which includes '_shooter == player', why do you have this? This would be causing issues, especially if you're trying to make this work with AI as well as it's checking if the shooter is equal to player, which would be the player the event handler is local to if it's been added on a player. I don't really see a point in this part of your check, unless you're trying to achieve something that I've misunderstood?
  2. ShadowRanger24

    HandleDamage Event Handler Explained

    Can you provide some code so I can help you out please?
  3. ShadowRanger24

    HandleDamage Event Handler Explained

    Oops silly me, my bad. I completely forgot to add in a return value. Fixed.
  4. In the latest Arma update, some security improvements were made to the debug console. Both the debug console in the escape menu, and any debug console created through 'createDialog 'RscDisplayDebugConsole'' are now affected by this and will not allow you to use it unless you are in singleplayer, a logged in admin, or if the mission has the debug console enabled for everyone. This causes issues with MP missions who allow admins/certain players access to the debug console. I can no longer have multiple players access the debug console at one time and the createDialog method is now useless. Because there can only be 1 admin logged in at a time through the use of #login or being voted in, this prevents more than 1 person from using it at one time. I have spoken to some developers on the Arma 3 Discord about this, and the only viable option I have found out to be is making a custom display using the base debug console classes and removing the admin checks. But this can be a somewhat complex task as it involves editing quite a few scripts. Surely there's a way around this? Edit: Made a ticket regarding this issue on the Arma 3 Feedback Tracker: https://feedback.bistudio.com/T124835
  5. So I'm trying to make it possible to close the EG Spectator Mode with having it initialized via a script (not the debug console in the escape menu). Currently the main way of closing it is just to click the 'Spectator' button in the debug console. But if your mission has the debug console disabled and you're initializing the spectator menu via a script, how are you meant to close it? I know that you can use '["Terminate"] call BIS_fnc_EGSpectator' but how can you call this through a key press if KeyPressed does not run while a player is in the spectator menu? Thanks in advance.
  6. ShadowRanger24

    Closing EG Spectator Menu

    DS_egKeyDown = (findDisplay 60492) displayAddEventHandler ["KeyDown", { _handled = false; switch (_this select 1) do { case 68: { (findDisplay 60492) displayRemoveEventHandler ["KeyDown", DS_egKeyDown]; ["Terminate"] call BIS_fnc_EGSpectator; _handled = true; }; _handled }];
  7. So I'm having an issue on a server which uses variable names (set through the editor) to access players. So for example a civilian can have the name of civ_1 and can be accessed as a variable reference to the object. The issue I'm having is that somehow these references are becoming null. I'm not sure what is causing it, but accessing some players becomes impossible as they just turn to null. It is a high population server, so I'm not sure if this has anything to do with it, but it's definitely a major issue. Does anyone know what might be causing this? Thanks in advance.
  8. ShadowRanger24

    Objects Via Variable Names Becoming Null

    One of the ways their accessed is through an admin menu. It uses playableUnits to populate a list, and when a player is selected in this list it displays information about them, but a check is performed before this to see if they are null. And for these bugged players, it will not be able to display this information because of this null check. Some commands work on the null unit though, such as 'name', which does return the correct name of the unit, not Error: No Unit or anything like that.
  9. ShadowRanger24

    Objects Via Variable Names Becoming Null

    Do you happen to know how unique object variables work? I can't seem to find out much information about it. Was trying to see if I could find a way to 'update' the variable so it isn't null. I'll also point out that these units sometimes do 'fix' and un-nullify themselves somehow. This is an extremely annoying issue, and not the easiest to resolve or even find the cause.
  10. ShadowRanger24

    Objects Via Variable Names Becoming Null

    Thanks for the response. I'm not sure if I explained my issue properly. So I've got multiple menus containing lists, which work off playableUnits. An example of one of these menus is an admin menu. On the server, which can get over 100 players, some of these players on the lists are null, and can not be accessed properly. The players are valid, and they are alive, but for some reason some of them, when accessed through their variable name, are null.
  11. ShadowRanger24

    Objects Via Variable Names Becoming Null

    I'm aware that playableUnits doesn't return dead players, but I'm having this issue even with alive players. Multiple alive players from playableUnits just become null for some reason.
  12. For some reason HandleDamage doesn't seem to be working like it should be. I've got a basic HandleDamage event handler that is meant to prevent damage from other team members but instead of just preventing damage, it's setting their health back to full and healing them. Here's the code: player addEventHandler ["HandleDamage",{_this call SR_fnc_handleDamage;}]; params ["_player","_part","_damage","_shooter","_ammo"]; if((!isNull _shooter)&&(!(_player isEqualTo _shooter)))then { if((group _player) isEqualTo (group _shooter))then { _damage = false; //0 has same effect }; }; _damage Any ideas? Thanks in advance.
  13. ShadowRanger24

    HandleDamage Strange Behavior

    Managed t Managed to get it working. Thanks for the help. Here's my working code: params ["_player","_part","_damage","_shooter","_ammo"]; if((!isNull _shooter)&&(!(_player isEqualTo _shooter)))then { if((group _player) isEqualTo (group _shooter))then { _curDamage = if (_part isEqualTo "") then {damage _player} else {_player getHit _part}; _damage = _damage - (_damage - _curDamage); }; }; _damage
  14. ShadowRanger24

    HandleDamage Strange Behavior

    I think I might have figured out what I'm doing wrong. Haven't gotten a chance to test it yet though. params ["_player","_part","_damage","_shooter","_ammo"]; if((!isNull _shooter)&&(!(_player isEqualTo _shooter)))then { if((group _player) isEqualTo (group _shooter))then { _damage = (damage _player); }; }; _damage I think I might have misunderstood how the return value of HandleDamage works. I think the reason why the players kept getting 'healed' is because I was returning 0 from the event, which is then applied to the player as their damage value, so basically restoring their health. I think the logical fix would just be returning their current damage instead?
  15. ShadowRanger24

    Objects Via Variable Names Becoming Null

    Do you know of any workaround for this or any potential fixes? It's really strange, because some of the players that are null are on the server, so they aren't players that have logged out, but yeah other players would have been in the slot.
  16. ShadowRanger24

    Objects Via Variable Names Becoming Null

    Yeah wherever it's used the spelling is used correctly. Even on a menu which loops through playableUnits and adds them all to the list, some of these players are null.
  17. ShadowRanger24

    Make Player Face Position

    This is exactly what I needed, surprised I didn't notice it. Thank you! And thanks to everyone else who was helping me.
  18. So I'm trying to figure out a way to make a player face a given position. I thought setDir in combination with getRelDir would work but I can't get it to work. Any ideas? Thanks in advance.
  19. ShadowRanger24

    Make Player Face Position

    This will only set the player's direction to whatever the direction the object is. What I want is, to set the player to look at an objective. Basically I spawn them outside of an objective zone, and I want to make them face the center of the objective.
  20. ShadowRanger24

    Make Player Face Position

    Just tried but doesn't work properly. It sets the player's direction to a different direction every time, and never to the actual position of the object.
  21. ShadowRanger24

    Make Player Face Position

    I'm a bit confused to how getRelDir works. I thought this would work, but it doesn't: player setDir ((player getRelDir _position) - 180);
  22. So I'm trying to figure out a way to sort a multidimensional array, but can't figure out how. I'm trying to sort a scores array, which contains the team name, and their score, and then be able to sort it from the lowest score, to the highest. For example, this is how the array will be: _scoresArray = [["Team 1", 0],["Team 2", 0],["Team 3", 0],["Team 4", 0]]; I'm aware of the array sort command, but that doesn't work for multi-dimensional arrays. So how should I do it? Is there a better way to handle the array? Thanks in advance.
  23. ShadowRanger24

    Sorting Multi-dimensional Array

    This works perfectly. Thank you very much! :)
  24. So I'm currently using addItemCargoGlobal to add magazines to a player's uniform, vest and backpack from a saved loadout array. I've noticed a couple issues where it would sometimes not add the magazines properly though, so I'm wanting to know if there is a better option than this. I noticed that addItemToUniform/addItemToVest/addItemToBackpack works with magazines as well, but is there any difference between these 2 commands (addItemCargoGlobal vs addItemTo_)?
  25. ShadowRanger24

    Sorting Multi-dimensional Array

    Thanks for the reply. I need to be able to retain a link between the scores and the teams though, so I can use it for the leader board display for example. Here's what I mean: _scoresArray = [["Team 1", 0],["Team 2", 0],["Team 3", 0],["Team 4", 0]]; _temp = +_scoresArray; //_temp sort false; // Doesn't work _string = ""; { _teamScore = _x select 1; _index = _scoresArray find _teamScore; if(!(_index isEqualTo -1))then { _teamName = _scoresArray select _index; _string = _string + format ["%1 - %2\n, _teamName, _teamScore]; }; } forEach _temp; hint _string; So I want to be able to display the scores in order (highest to lowest), and display the team name associated with the score. This is where I'm having trouble and can't figure out a way to do it. Any ideas?
×