Adding Weapons to Magazines

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
obrien979
Posts: 33
Joined: Fri May 18, 2018 2:10 pm
Location: Germany

Adding Weapons to Magazines

Post by obrien979 »

I am trying to use a LUA script to represent delivering ammo resupply to ground units. I have tried the following code:

Code: Select all

ScenEdit_AddWeaponToUnitMagazine({unitname='3-82 FA', w_dbid=7443, new="true",number=1, w_max=10})

Despite my numerous attempts using what I thought was the correct w_dbid number, I have had no success.
For example I am trying to add 155mm/39 HE rounds to the unit. When you search in the DB Viewer you get an ID# 2243, that number didnt work in the script. Then I looked under in the ADD WEAPON RECORD menu in the MAGAZINES SELECTION for the unit and found the same munition type but with ID# 7343, that number didnt work as well.

My question is two part, Am I using the right script and correctly? and what is the correct w_dbid to use?

Thank You
V/R,
Brandon "OB" OBrien
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Adding Weapons to Magazines

Post by Whicker »

I just struggled with this as well. The dbid is the one from the Weapons db - not from the magazine >> add weapon screen.

I was adding it to a base or an ammo pad, here is what I did - I did not need the new part for some reason:
local u = SE_GetUnit({name='Ammo Pad', guid='01563bf0-12c5-4ce4-bdd7-e370c449c77f'})
print(u.magazines)
ScenEdit_AddWeaponToUnitMagazine({unitname=u.name, wpn_dbid=2983, number=12, w_max=48})
obrien979
Posts: 33
Joined: Fri May 18, 2018 2:10 pm
Location: Germany

RE: Adding Weapons to Magazines

Post by obrien979 »

Thank You for your response. I am such a novice at LUA but I will play around with this coding.

Thanks
V/R,
Brandon "OB" OBrien
Post Reply

Return to “Lua Legion”