AddWeaponToUnitMagazine using mag_guid troubles
Posted: Thu Jun 18, 2020 2:57 am
Trying to do something basic that I swear used to work (at least at one point) in CMANO.
I want to add a mag to a carrier and I want to specifically put munitions into this particular new mag.
So I create the unit, and apply the mag addition I want via delta...no problems it gets added as the 5th mag as expected in this case for example to a ship (#657). Now I go to add some AGM-84k's to my new mag.
mag_id = c.magazines[5].mag_guid; --I assure you this is grabbing the correct mag_guid, guid isn't the problem.
ScenEdit_AddWeaponToUnitMagazine( { guid=c.guid, MAG_GUID=mag_id,WPN_DBID=452,number=100, maxcap=200,new=true } )
That should add a 100/200 AGM-84k entry to my nice fresh mag right?
Doesn't happen, instead it adds 1/200 AGM-84k to the mag at index 1, which is the wrong mag, and the wrong amount.
I can see that the matching guid search happens, and the correct magazine matching the guid I submitted is found and set\selected initially but then something goes wrong it seems, both in the 'which mag' to use process and the number being added. Hard for me to tell what exactly is going on but it's as if it takes the wrong mode branch at some point, for lack of a better way of saying it.
If one runs it a second time ... it repeats the above but for the mag at index #2.
A third time will land it in the original carrier mag and put 1/200.
A fouth time will not add anything to the forth mag but add one more to the existing 1/200 in the 3rd??
A fifth time will not add anything to the forth mag but add one more to the existing 2/200 in the 3rd??
Removing\adding the 'new=true' param has no effect on this happening from what I can tell.
So either I don't understand logic or something is borked at the moment when trying to add to a specific mag.
Not using the mag_guid operates correctly in that it adds the 100/200 record, but throws all the weapons into the first mount, which is undesirable for obvious reasons for various unit types.
Additionally being able to add a magazine itself without having to resort to delta's and where guids have to match would be a welcome addition in the longer term. Anyone see the same thing or found away around this beyond just put everything into a delta (which has it's own drawbacks)?
I want to add a mag to a carrier and I want to specifically put munitions into this particular new mag.
So I create the unit, and apply the mag addition I want via delta...no problems it gets added as the 5th mag as expected in this case for example to a ship (#657). Now I go to add some AGM-84k's to my new mag.
mag_id = c.magazines[5].mag_guid; --I assure you this is grabbing the correct mag_guid, guid isn't the problem.
ScenEdit_AddWeaponToUnitMagazine( { guid=c.guid, MAG_GUID=mag_id,WPN_DBID=452,number=100, maxcap=200,new=true } )
That should add a 100/200 AGM-84k entry to my nice fresh mag right?
Doesn't happen, instead it adds 1/200 AGM-84k to the mag at index 1, which is the wrong mag, and the wrong amount.
I can see that the matching guid search happens, and the correct magazine matching the guid I submitted is found and set\selected initially but then something goes wrong it seems, both in the 'which mag' to use process and the number being added. Hard for me to tell what exactly is going on but it's as if it takes the wrong mode branch at some point, for lack of a better way of saying it.
If one runs it a second time ... it repeats the above but for the mag at index #2.
A third time will land it in the original carrier mag and put 1/200.
A fouth time will not add anything to the forth mag but add one more to the existing 1/200 in the 3rd??
A fifth time will not add anything to the forth mag but add one more to the existing 2/200 in the 3rd??
Removing\adding the 'new=true' param has no effect on this happening from what I can tell.
So either I don't understand logic or something is borked at the moment when trying to add to a specific mag.
Not using the mag_guid operates correctly in that it adds the 100/200 record, but throws all the weapons into the first mount, which is undesirable for obvious reasons for various unit types.
Additionally being able to add a magazine itself without having to resort to delta's and where guids have to match would be a welcome addition in the longer term. Anyone see the same thing or found away around this beyond just put everything into a delta (which has it's own drawbacks)?