johnnyboy 3781 Posted December 5, 2022 Upon dying, a unit is replaced with a weaponHolder object that looks like a dead body. You can find weapon holders with this command: nearestObjects [getPos player, ["WeaponHolderSimulated", "GroundWeaponHolder", "Default"], 4] But this returns any type of weapon holder. I want to find the ones that are dead bodies, and exclude a weapon lying on the ground or any other kind of holder. Share this post Link to post Share on other sites
Harzach 2516 Posted December 6, 2022 2 hours ago, johnnyboy said: Upon dying, a unit is replaced with a weaponHolder object that looks like a dead body. I'm not sure that's true. At least, dead bodies aren't returned when searching for weaponHolders. 1 Share this post Link to post Share on other sites
Ibragim A 161 Posted December 6, 2022 The Community WIKI states that a dead unit and a weapon holder are different things, but there is an association between them. See, for example, getCorpse. See also: vehicles. 1 1 Share this post Link to post Share on other sites
Harzach 2516 Posted December 6, 2022 17 minutes ago, Ibragim A said: getCorpse Interesting! So, you could filter weaponHolders for associated corpses. Of course, since this is the case, you could just find the corpses instead. 1 Share this post Link to post Share on other sites
johnnyboy 3781 Posted December 6, 2022 Thanks gents, a combo of that info should probably solve this for me. Share this post Link to post Share on other sites
pierremgi 4833 Posted December 6, 2022 getCorpse is for version 2.12 It seems to me a killed unit always lead to a "WeaponHolderSimulated", nothing more for dropped weapons, one or (two in case of launcher). Anyway, if you need to get a corpse near player, think about allDeadMen: _corpse = allDeadMen select {_x distance2D player < 5} select 0; 1 Share this post Link to post Share on other sites
Harzach 2516 Posted December 6, 2022 39 minutes ago, pierremgi said: a killed unit always lead to a "WeaponHolderSimulated" Only if they are carrying a rifle/launcher. 1 Share this post Link to post Share on other sites
johnnyboy 3781 Posted December 6, 2022 Thanks guys. My purpose for this question is I want to attach a recently killed unit to a moving object. But the problem is, once dead, they no longer attach to anything. If they are attached before being killed, they are immediately detached when killed. And never can be attached thereafter. So my workaround will be to use allDeadmen to find them, or an OnKilled EventHandler. Then create a dummy live unit that I disableSimulation on, put into a death animation, give him same loadout, uniform, headgear,etc., delete dead guy and attach new dummy unit. Ugh. 1 Share this post Link to post Share on other sites
Ibragim A 161 Posted December 6, 2022 Download and look how this script is made, it shows how dead units can be attached to moving objects and then detached. I used this script a long time ago, it is possible that now it may contain some errors. Drag Dead Body Script Share this post Link to post Share on other sites
johnnyboy 3781 Posted December 6, 2022 1 hour ago, Ibragim A said: Download and look how this script is made, it shows how dead units can be attached to moving objects and then detached. I used this script a long time ago, it is possible that now it may contain some errors. Drag Dead Body Script Good find. Looked at it and its overkill for my needs. Uses EachFrame to continually setPos the dead unit. A lot of code. I appreciate you looking it up for me though. Share this post Link to post Share on other sites
Harzach 2516 Posted December 6, 2022 2 hours ago, johnnyboy said: My purpose for this question What's our johnnyboy cooking up now...🤔 1 Share this post Link to post Share on other sites