Page 1 of 1

Reloading Weapons for Land Units

Posted: Thu Jul 30, 2020 9:39 am
by tmoilanen
Good morning - I'm attempting a LUA function to reload weapons to an Iskander SSM battalion.

I'm getting the error "No weapon defined" when running the command below.

Any assistance would be appreciated. I'm running 1147.7


local myunit = ScenEdit_GetUnit({name='test',side='Russia'})
print ( myunit )

ScenEdit_AddReloadsToUnit({unitname='test', w_dbid=1235, number=1, w_max=2})

RE: Reloading Weapons for Land Units

Posted: Thu Jul 30, 2020 12:22 pm
by KnightHawk75
shouldn't it be when not specifying which mount:
ScenEdit_AddReloadsToUnit({guid=myunit.guid, wpn_dbid=1235, number=1})

The sample in the docs may be out of date (w_dbid etc).



RE: Reloading Weapons for Land Units

Posted: Thu Jul 30, 2020 12:25 pm
by Durendal28
Good morning tmoilanen

The example on the CommandLua Docs site is incorrect; "w_dbid" should be "wpn_dbid".

Try this:

ScenEdit_AddReloadsToUnit({unitname='test', wpn_dbid=1235, number=1, w_max=2})


RE: Reloading Weapons for Land Units

Posted: Thu Jul 30, 2020 12:32 pm
by tmoilanen
That worked! Thank you, gentlemen!