Pantom 3 Posted December 24, 2019 https://community.bistudio.com/wiki/Arma_3_Revive Our server uses a basic vanilla calibration system. I want to change to invincible when the player is incapacitation I would like to get the code help for this method. Share this post Link to post Share on other sites
ofp_f3d3 28 Posted December 24, 2019 Hey! you can check the state of the player by using: _lifeState = lifeState player; and then make him invincible based on that. while{alive player} do { if(_lifeState == "INCAPACITATED") then { player allowDamage false; } else { player allowDamage true; } } I haven´t tried it but this should work. Now, this is a simple SP method, if you want this to work on MP you'll have to put that code in "initPlayerLocal.sqf". At least from the top of my head, this should work, but as i said, it´s not tested. Happy Holidays! USE SOLUTION PROVIDED BY pierremgi BELOW Share this post Link to post Share on other sites
pierremgi 4890 Posted December 24, 2019 First, it's not valid because your _lifeState is never updated... So, fail. Second, never loop like this! (no waitUntil, no sleep). Even if in a scheduled scope, you can't imagine how many time you run these lines for the same result (then wasting resource for nuts). At least, I'd add that in initPlayerLocal.sqf (example): 0 = [] spawn { while {true} do { waitUntil {sleep 0.5; lifeState player == "incapacitated"}; player allowDamage FALSE; waitUntil {sleep 0.5; lifeState player != "incapacitated"}; player allowDamage TRUE; }; }; That's for your loop. Or, better: this addEventHandler ["AnimChanged", { params ["_unit", "_anim"]; if ("unconscious" in _anim) then {_unit allowDamage FALSE} else { if !(isDamageAllowed _unit) then {_unit allowDamage TRUE}} }]; in init field of player 3 1 Share this post Link to post Share on other sites