609_Relentov Posted April 15, 2022 Posted April 15, 2022 I wrote some helo scripts to do some transporting of troops, light vehicles, etc., as part of my exercise to learn DCS SSE and lua. One thing I was not able to figure out was how to adjust the weight of the helicopter after "loading" these units. Thus, currently anything loaded has no impact on helo weight/performance. Are there some SSE API functions that would allow you to change the weight of a helicopter unit?
Grimes Posted April 15, 2022 Posted April 15, 2022 For reasons beyond my understanding it isn't part of the unit class. Instead it is in trigger. Fun part is it works with most aircraft. https://wiki.hoggitworld.com/view/DCS_func_setUnitInternalCargo The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
609_Relentov Posted April 15, 2022 Author Posted April 15, 2022 18 minutes ago, Grimes said: For reasons beyond my understanding it isn't part of the unit class. Instead it is in trigger. Fun part is it works with most aircraft. https://wiki.hoggitworld.com/view/DCS_func_setUnitInternalCargo Excellent, thanks Grimes!
609_Relentov Posted April 15, 2022 Author Posted April 15, 2022 (edited) One follow-up question: Say I use the function as follows to add the weight of 6 troops (e.g. 200lb/91kg each): trigger.action.setUnitInternalCargo('helo 1', 546) After I unload the troops, can I use negative values to reduce the weight by the same amount? e.g.: trigger.action.setUnitInternalCargo('helo 1', -546) Or would I just set the cargo weight to 0, such as?: trigger.action.setUnitInternalCargo('helo 1', 0) Seems to be the latter, as the description says "Overrides any previously set value". Edited April 15, 2022 by 609_Relentov
Grimes Posted April 15, 2022 Posted April 15, 2022 It is setting the value, its not adding or subtracting at all. You set the weight back to zero if you want there to be no cargo weight. It also sets in gradually over a second or so. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
609_Relentov Posted April 15, 2022 Author Posted April 15, 2022 6 hours ago, Grimes said: It is setting the value, its not adding or subtracting at all. You set the weight back to zero if you want there to be no cargo weight. It also sets in gradually over a second or so. Thanks - I was testing last night and came to that conclusion. Works great! One observation: I noticed that after I loaded troops (via scripting) and then added the cargo weight as described above, when I tried the rearm menu the weight/max weight at the bottom of the rearm pop up doesn’t show the adjusted weight after calling setUnitInternalCargo(). Not a huge deal, but it would be cool to see that adjusted weight, so you could adjust the load-out and fuel accordingly.
Recommended Posts