Page 1 of 1

Adding Weapons to Magazines

Posted: Fri Aug 16, 2019 5:57 am
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

RE: Adding Weapons to Magazines

Posted: Fri Aug 16, 2019 1:17 pm
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})

RE: Adding Weapons to Magazines

Posted: Sun Aug 18, 2019 9:34 am
by obrien979
Thank You for your response. I am such a novice at LUA but I will play around with this coding.

Thanks