godonholiday 10 Posted August 31, 2013 I was wondering what would be the easiest way to set what the minimum health value a civilian/non-playable could have is? So I dont want them to be able to die, just be wounded enough that you would have to heal them to get them back up and following you again? Thanks Share this post Link to post Share on other sites
Zenophon 110 Posted August 31, 2013 You would first need an eventhandler to control how much damage the unit received to prevent them from dying. In the unit's init line in the editor, write something like this: this addEventHandler ["HandleDamage", { (if (((damage (_this select 0)) + (_this select 2)) > 0.99) then { (_this select 0) setDamage 0.98; (_this select 0) switchMove "AinjPpneMstpSnonWnonDnon"; 0 } else { (_this select 2) }); }]; You can then add an action to heal/revive the unit; this action only appear when the unit is in the wounded/incapacitated state. In the init field after the above code, use this: this addAction [format ["Revive %1", (name this)], {(_this select 0) setDamage 0.5; (_this select 0) switchMove "";}, 0, 0, false, true, "", "(damage _target) > 0.96"]; This may not work in multiplayer, and it is just a very quick system to show you what you would need to do this. It is also instant and magical, and it probably does not work well with IFAK's (they would prevent the action from appearing). I have tested it on a civilian and it works well in singleplayer in stable patch 0.76. If you want a much better medical system, you will have to search this forum or google. Share this post Link to post Share on other sites
godonholiday 10 Posted August 31, 2013 You would first need an eventhandler to control how much damage the unit received to prevent them from dying. In the unit's init line in the editor, write something like this: this addEventHandler ["HandleDamage", { (if (((damage (_this select 0)) + (_this select 2)) > 0.99) then { (_this select 0) setDamage 0.98; (_this select 0) switchMove "AinjPpneMstpSnonWnonDnon"; 0 } else { (_this select 2) }); }]; You can then add an action to heal/revive the unit; this action only appear when the unit is in the wounded/incapacitated state. In the init field after the above code, use this: this addAction [format ["Revive %1", (name this)], {(_this select 0) setDamage 0.5; (_this select 0) switchMove "";}, 0, 0, false, true, "", "(damage _target) > 0.96"]; This may not work in multiplayer, and it is just a very quick system to show you what you would need to do this. It is also instant and magical, and it probably does not work well with IFAK's (they would prevent the action from appearing). I have tested it on a civilian and it works well in singleplayer in stable patch 0.76. If you want a much better medical system, you will have to search this forum or google. Thanks, I will give that a try.. for now I am just testing it out.. but ultimately I would like it to me a multiplayer map (4 people + civilians) Ill let you know how I get on Share this post Link to post Share on other sites