janh 0 Posted September 24, 2011 I got a quick question on the setvariable / getvariable commands when executed on local objects. (I am using ARMA2_OA_Build_84689) If I store some info with setvariable on an object of class "Man" (e.g. _unit setvariabe ["Name",name _unit, true], I can retrieve this info as long as the _unit is alive. Yet if the soldier dies, the stored information is lost. Further, I cannot store any info on a dead "Man" type object, it seems. Isnil{_unit getvariable "whatever"} will always return True. This a real drawback for scripting dynamic things, like attaching and removing specific EH's or actions, or a lot of other stuff specific to that dead unit. Is that a bug that ought to be reported? I do not recall running into scripting issues with that in any of the previous beta patches. Otherwise, does anyone know of a suitable workaround? Share this post Link to post Share on other sites
sxp2high 16 Posted September 24, 2011 Maybe attaching a HeliHEmpty to the unit and use this for the setVariable? getVariable can be done via nearestObject then. Just an idea. Share this post Link to post Share on other sites
Muzzleflash 108 Posted September 24, 2011 It's has nothing to do with the beta. It has been like this for a long time. Think it is to save resources. It still has any setVar'ed data for at least 5 seconds after death. Actions remain after death. Don't think I ever had to something EH-related for a dead unit - almost no events really apply after death. You could make a bug ticket although the behaviour might be intentional. Share this post Link to post Share on other sites
janh 0 Posted September 24, 2011 It is primarily a problem for attaching and removing actions dynamically to dead bodies (like storing the index of an attached "Carry" action for later removal when unit is picked up, and then replacing it by a "Drop" action and vice versa). Was thinking about storing that in the group namespace instead, but then I can't disjoin them anymore. Using HeliHEmpty or a Gamelogic for each dead might work, but it would add a huge overhead and cause wasteful CPU usage if you have big missions with a couple of dozen or hundred bodies on the ground after a while. Sounds like keeping the variables on dead objects would be less resource-intense. Share this post Link to post Share on other sites
buliwyf 2 Posted September 24, 2011 http://forums.bistudio.com/showpost.php?p=2005697&postcount=7 :rolleyes: Share this post Link to post Share on other sites
janh 0 Posted September 24, 2011 THX! Interesting thread -- that confirms it. So they probably didn't do it because of the locality change? Anyway, it would be very very useful it the units would keep their variablepace. Need to figure a workaround now without spawning an sqf for any unit, or creating tons of extra objects, which both would be really detrimental to the script execution performance. Share this post Link to post Share on other sites