avibird 1 36 Posted March 7, 2018 Very cool. Hope to have time tonight to check it out so far. I know team switch function was really meant for single player but works for multiplayer sometimes correct me if I'm wrong. I know some scripts won't let multiplayer players used team switch only the host server can I don't really fully understand why ? Share this post Link to post Share on other sites
pierremgi 4850 Posted March 7, 2018 2 hours ago, avibird 1 said: Very cool. Hope to have time tonight to check it out so far. I know team switch function was really meant for single player but works for multiplayer sometimes correct me if I'm wrong. I know some scripts won't let multiplayer players used team switch only the host server can I don't really fully understand why ? The team switch is, as evidence, not a main feature of the game! It works in SP, along with all related commands. It was scripted for SP then added in MP respawn possibilities. But in editor, if you choose: - respawn by "switch to group member" (or equivalent in description.ext), never mind if you respawn in unconscious unit. You'll be stick in the "semi-uncounscious" stance, prone, looking well but unable to do something. In this case the team switch menu is not displayed (no choice). - respawn by "switch to side member", you can choose to display or not the team switch menu. Then you have to cope with the weird possibility to respawn in an unconscious unit. So, @HazJ and I, gave you some solutions to manage that. I can add a little script, a workaround killing unconscious AIs not player in MP (So, nobody would like to choose them anyway). This workaround is a "mix" (SP is fine for updating the switchable list because removeSwitchableUnits works, but in MP you need something more radical like kill. I tested simulation or hide... no joy). 0 = [] spawn { while {true} do { waituntil {sleep 0.2; !isnull findDisplay 632}; _uncapUnits = []; for "_i" from 0 to (lbsize 101) -1 do { _unit = switchableUnits param [_i,objNull]; if (lifeState _unit == "incapacitated") then { _uncapUnits pushBackUnique _unit; }; }; if (isMultiplayer) then { {_x setDamage 1} forEach (_uncapUnits select {!isPlayer _x}) } else { {removeSwitchableUnit _x} forEach _uncapUnits; }; waitUntil {sleep 0.2; isNull findDisplay 632}; }; }; Note: switchableUnits is a SP command,... working in MP just in case of respawn switch. In all other cases (like respawn at base or on death position), switchableUnits will return [ ]. 1 Share this post Link to post Share on other sites
HazJ 1289 Posted March 7, 2018 Or... Create a new whole team switch UI and functionality using selectPlayer command and hope it all goes smooth without more issues. 1 Share this post Link to post Share on other sites
Larrow 2820 Posted March 7, 2018 (edited) From a few quick tests, this wont allow you to even select a incapacitated unit. If you do it will select your current player instead. findDisplay 46 displayAddEventHandler [ "KeyUp", { if ( inputAction "teamSwitch" > 0 ) then { _nul = [] spawn { _timeout = time + 2; waitUntil { !isNull ( uiNamespace getVariable [ "RscDisplayTeamSwitch", displayNull ] ) || time > _timeout }; if ( !isNull ( uiNamespace getVariable [ "RscDisplayTeamSwitch", displayNull ] ) ) then { disableSerialization; _display = uiNamespace getVariable "RscDisplayTeamSwitch"; _lb = _display displayCtrl 101; _lb ctrlRemoveAllEventHandlers "LBSelChanged"; _lb ctrlRemoveAllEventHandlers "LBDblClick"; _lb ctrlAddEventHandler [ "LBSelChanged", { params[ "_ctrl", "_index" ]; _unit = switchableUnits select _index; if ( !( _unit isEqualTo player ) && { lifeState _unit == "incapacitated" } ) then { _playerIndex = switchableUnits find player; _ctrl lbSetCurSel _playerIndex; TSW_OldSelectedUnit = player; TSW_camTargetUnit = player; }else{ _nul = [ _this, "CA_TS_UnitSelected"] execVM "\A3\ui_f\scripts\TeamSwitch.sqf"; }; }]; _lb ctrlAddEventHandler [ "LBDblClick", { params[ "_ctrl", "_index" ]; _unit = switchableUnits select _index; if ( lifeState _unit == "incapacitated" ) then { _playerIndex = switchableUnits find player; _ctrl lbSetCurSel _playerIndex; }else{ _nul = [_this, "CA_TS_ListDoubleClick"] execVM "\A3\ui_f\scripts\TeamSwitch.sqf"; }; }]; }; }; }; }]; Edited March 13, 2018 by Larrow Fixed suspension for null display 1 Share this post Link to post Share on other sites
avibird 1 36 Posted March 7, 2018 @Larrow ty very cool ? how do I call the code in a game logic or the mission init.sqf ect. @HazJ Sorry I missed you last night. You where already was offline the time I saw your message next time. @pierremgi I can't found Your revive script on armaholic do you have a test mission up on a site ? Share this post Link to post Share on other sites
pierremgi 4850 Posted March 7, 2018 4 hours ago, avibird 1 said: @pierremgi I can't found Your revive script on armaholic do you have a test mission up on a site ? Normal. I'm no more on Armaholic. Just on BI forum. Follow the tag: MGI scripts Share this post Link to post Share on other sites
Larrow 2820 Posted March 9, 2018 On 3/7/2018 at 12:13 PM, avibird 1 said: how do I call the code in a game logic or the mission init.sqf ect. Just place the code in the initPlayerLocal.sqf. May need to make sure mission display (46) is initialised before adding the displayEvent. //initPlayerLocal.sqf _nul = [] spawn { waitUntil { time > 0 && { !isNull findDisplay 46 } }; //Code from previous post }; 1 Share this post Link to post Share on other sites
avibird 1 36 Posted March 9, 2018 @Larrow thank you sir guys like you make this hobby so much more enjoyable for guys like me who truly lack the knowledge to implement the mission designs that are forged within our heads ?. Can't wait to test play it out to see if it works as designed. Share this post Link to post Share on other sites
pierremgi 4850 Posted March 9, 2018 You can block the double click switching, display in red incapacitated units and remove the switch button if one of them is selected. Spoiler fnc_teamSwitch = { disableSerialization; params ["_type","_ctrlDispl"]; private _idc = ctrlIDC (_ctrlDispl select 0); private _selectedIndex = _ctrlDispl param [1]; _displ = findDisplay 632; _ctrl101 = _displ displayCtrl 101; _cnt = (lbsize 101) -1; for "_i" from 0 to _cnt do { _selectedUnit = switchableUnits param [_i,objNull]; _unit = vehicle _selectedUnit; if (lifeState _unit == "incapacitated") then { lbSetTooltip [_idc, _i, "unconscious unit"]; lbSetColor [_idc, _i,[1,0.3,0.3,1]]; }; }; if (_type == 1) then {true}; if (lifeState (vehicle (switchableUnits param [_selectedIndex,objNull])) == "incapacitated") then {(_displ displayCtrl 1) ctrlShow false} else { (_displ displayCtrl 1) ctrlShow true } }; 0 = [] spawn { while {true} do { waituntil {sleep 0.2; !isnull findDisplay 632}; (findDisplay 632 displayCtrl 101) ctrlAddEventHandler ["LBSelChanged", "[0,_this] call fnc_teamSwitch"]; (findDisplay 632 displayCtrl 101) ctrlsetEventHandler ["LBDblClick", "[1,_this] call fnc_teamSwitch"]; waitUntil {sleep 0.2; isNull findDisplay 632}; }; }; 1 Share this post Link to post Share on other sites
avibird 1 36 Posted March 11, 2018 @Larrow I attempted it today your code above still allows me to team switch in a unconscious unit. @pierremgi same for your codes I attempted them in both a mission init.sqf and a initPlayerLocal.sqf Share this post Link to post Share on other sites
avibird 1 36 Posted March 11, 2018 @HazJ thanks for the help on the AIS wound system Which one of your codes above got the working version somewhat. I attempted both in my mission. init and a initPlayerLocal the video showed a working version to prevent the player to switch. Share this post Link to post Share on other sites
Larrow 2820 Posted March 11, 2018 Then your unit is not lifeState incapacitated. TEST_MISSION Start mission as unit 1-1:1, notice that you cannot swap to (or even select) unit 1-2:1 from team switch menu but you can to 1-1:3 3 Share this post Link to post Share on other sites
avibird 1 36 Posted March 12, 2018 Did not get the opportunity to test your test mission yesterday sir. I need to check if AIS wound system utilizes lifeState incapacitated. Share this post Link to post Share on other sites
avibird 1 36 Posted March 13, 2018 @Larrow good the bad and ugly lol The Good you are a genius for getting this to work. This really should have been in the vanilla game the whole team switch function never gets any real love from bohemia as well as the high command functions in my humble opinion now for the bad and ugly I have been working on a modified AIS wound system for my style of play. I just got it working the way I need it do be. AIS wound system is far superior to all the other revive scripts in my view because of all the functionally and the ability to be used on players and AI with that said when I incorporated your code block into the mission all the playable units become invincible the units would take some damage but never go incapacitated or killed. That is really bad lol I will try it on some of the other revive scripts that I use like BTC quick revive. Thank you for the help but if I can't get it to work on AIS its a loss for me due to the fact AIS is the best Revive around in general for functionality ie drag carry load used on AI/players and complexity of the healing not just click and patch there is a two part process for healing. Avibird Share this post Link to post Share on other sites
Larrow 2820 Posted March 13, 2018 3 hours ago, avibird 1 said: I incorporated your code block into the mission all the playable units become invincible the units would take some damage but never go incapacitated or killed. That is impossible, my code is a key event with a getter for life state, it will have no effect what so ever on a units damage or the ability to go incapacitated, heck none of the code even runs until the teamSwitch menu is opened. Share this post Link to post Share on other sites
avibird 1 36 Posted March 13, 2018 I will check again but when I removed the initPlayerLocal.sqf and your code block all was good with the AIS wound script. IDK will test again Avibird Share this post Link to post Share on other sites
avibird 1 36 Posted March 14, 2018 @Larrow hi I tested it with a few other revive scripts. Same issue the units become invincible still take some damage but I can team switch into them. In your demo mission you have no revive script setup maybe that is the reason/issue but you are a lot more knowledgeable then I in this. Avibird Share this post Link to post Share on other sites
pierremgi 4850 Posted March 14, 2018 @avibird 1 Do you have same problem with mine? I can't reproduce it. Share this post Link to post Share on other sites
avibird 1 36 Posted March 16, 2018 @pierremgi @Larrow Why does both of your code blocks in scripts not work with revive systems ? Ie BTC or AIS wound system. If you set a unit 2 incapacitated through the editor all good but if a unit gets injured during gameplay and you have a revive system the unit will not go incapacitated or be killed? Share this post Link to post Share on other sites
pierremgi 4850 Posted March 16, 2018 I don't want reply for Larrow but how could we script for some mods or addons not playing with the incapacitated state as announced in the thread? If your addons/ scripts divert some damage to play with animations, our scripts are not at fault. The work around I can see is to check for the animation instead of the state... if you confirm your system provides the same one as Vanilla. Share this post Link to post Share on other sites
avibird 1 36 Posted March 16, 2018 @pierremgi you are talking about the revive Scripts ? because Arma only has a revive script for multiplayer with respawn number 5 and 4 used. It does not work with it as well. I am a little slow and don't fully understand why the code block can't work when a unit is in the incapacitated state. Lol Share this post Link to post Share on other sites
pierremgi 4850 Posted March 16, 2018 8 hours ago, avibird 1 said: Why does both of your code blocks in scripts not work with revive systems ? Ie BTC or AIS wound system. If you set a unit 2 incapacitated through the editor all good but if a unit gets injured during gameplay and you have a revive system the unit will not go incapacitated or be killed? 3 hours ago, avibird 1 said: @pierremgi you are talking about the revive Scripts ? ??? because Arma only has a revive script for multiplayer with respawn number 5 and 4 used. It does not work with it as well. I am a little slow and don't fully understand why the code block can't work when a unit is in the incapacitated state. Lol In fact, I have no clue on what scripts/mods you are using. Just saying that Larrow's or mine are working even during the game SP/MP, as far as the switch option is used after some units are truly incapacitated. 1 Share this post Link to post Share on other sites
avibird 1 36 Posted March 16, 2018 Are you using the in-game revive system that behavior introduced ? The revive systems I attempted it on was BTC quick revive and AIS wound system. So what you're telling me is that these are modified Scripts not modifications scripts work differently than Behavior scripts for revive. This is what I don't understand. They both use the same command codes for the scripts to work with in the game engine. I'm still very confused lol but Arma scripting coding does that a lot to me? So if I use the in-game revive system your code blocks should work but the revive systems that behind you have are for multiplayer only AI can't use the revived function on a player and lack a lot of the functionality Drag carrying and loading injured units. Share this post Link to post Share on other sites
pierremgi 4850 Posted March 17, 2018 6 hours ago, avibird 1 said: Are you using the in-game revive system that behavior introduced ? That doesn't matter! BI revive is just allowing you to get out off incapacitated state. 6 hours ago, avibird 1 said: The revive systems I attempted it on was BTC quick revive and AIS wound system. So what you're telling me is that these are modified Scripts not modifications scripts work differently than Behavior scripts for revive. This is what I don't understand. They both use the same command codes for the scripts to work with in the game engine. I'm still very confused lol but Arma scripting coding does that a lot to me? I don't want to dig into exotic revive systems for checking how units are incapacitated. As I wrote, it's not a revive system question but the way the units are steady incapacitated. 6 hours ago, avibird 1 said: So if I use the in-game revive system your code blocks should work but the revive systems that behind you have are for multiplayer only AI can't use the revived function on a player and lack a lot of the functionality Drag carrying and loading injured units. My scope is the BI respawn (switch on side player) or SP switch. The revive or not, doesn't mind. All non-BI modded respawn/revive scripts preempting some incapacitated state or not, are like they are. As I said there is a possible solution if someone can say what are incapacitation behaviors in this case. If there is some specific animation, just check for the animation. But... don't confuse revive and incapacitation. 1 Share this post Link to post Share on other sites
HazJ 1289 Posted March 17, 2018 As pierremgi said. The only thing that may be an issue is lifeState and certain revive system, depending on how it is setup/created, INCAPACITATED may not trigger for the condition. Easy to change the condition though. Share this post Link to post Share on other sites