How to add weapon record of 10000 via Lua

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Hawaiiboy909
Posts: 1
Joined: Sun Aug 23, 2020 2:37 pm

How to add weapon record of 10000 via Lua

Post by Hawaiiboy909 »

Wondering if there a way to add weapons to existing mount with count of 10000. Instead of using the GUI. Not sure if ScenEdit_UpdateUnit() has a way to specify weapon amount/count. I understand certain weapon record have a max cap of 10000 already, but not all. example AIM-260 doesn't. Is it possible to use ScenEdit_AddReloadsToUnit to modify the cap of weapon count?
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: How to add weapon record of 10000 via Lua

Post by KnightHawk75 »

There is a way, but it's limiting. ;)

Last I recall for 10,000 entries that don't actually exist as weapon records you will need to make a delta for it and then can apply it via UpdateUnit() in delta mode. The down side is it restricts you to a pre-defined units\guids (unless you have pro and can use io to change that, but in that case might as well just add your own weapon record if that's the case). It's the only method I know dating back to cmano for this specific case and wish it wasn't the case (wish updateunit had some of the logic of delta parser for weaponrecid==0). After it's added with the 10k capacity via delta you can then change the current count via normal means (updateunit or addreloadstounit).
the entries you're looking for will look like

Code: Select all

 
 <WeaponRecAdd_0_3567 />  --this is the 10k cap add. 
 --The 0 for weaponrecid invokes a separate code path avoiding the database check on the weaponrec id and adding a 10k cap unit.
 <!--AIM-260 JATM-->
 <WeaponEdit_3567_10000 /> --this updates the current count to 10k (just a default)
 <!--AIM-260 JATM-->
 
jkgarner
Posts: 175
Joined: Thu Apr 30, 2020 12:42 pm

RE: How to add weapon record of 10000 via Lua

Post by jkgarner »

OK Knigthhawk, this is some XML stuff... which XML file are you modding?
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: How to add weapon record of 10000 via Lua

Post by KnightHawk75 »

a standard .ini delta\sbr file it doesn't have to contain the whole scene it can contain just a single unit and what you want done to that unit specifically at given moment, you then apply it via UpdateUnit(mode="delta", filename=""...).

Since you jk have Professional and access to .io namespace you could even generate them on the fly as needed, run them, and then remove them, non-pro have no such luxury so stuck with more restricted use to units that pre-exist or match a known guid at the moment of time of the delta running.
jkgarner
Posts: 175
Joined: Thu Apr 30, 2020 12:42 pm

RE: How to add weapon record of 10000 via Lua

Post by jkgarner »

Pointing at self --RTFM!
Chapter 7 of the manual discusses the scenario ini files.
I need to read over this section before I ask any more questions.
Post Reply

Return to “Lua Legion”