Reloading Weapons for Land Units

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
tmoilanen
Posts: 111
Joined: Wed Oct 19, 2011 4:28 pm

Reloading Weapons for Land Units

Post 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})
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Reloading Weapons for Land Units

Post 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).


Durendal28
Posts: 9
Joined: Wed Apr 22, 2020 7:56 pm

RE: Reloading Weapons for Land Units

Post 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})

tmoilanen
Posts: 111
Joined: Wed Oct 19, 2011 4:28 pm

RE: Reloading Weapons for Land Units

Post by tmoilanen »

That worked! Thank you, gentlemen!
Post Reply

Return to “Lua Legion”