Amineri Posted May 28, 2013 Author Share Posted May 28, 2013 As I was fiddling around with this, I thought of a completely different approach. Use the iSuppression field in the Weapons= array in the DGC.ini to define each individual weapon's ammo usage. This would allow setting ballistic/laser/plasma weapons of every type individually. Ammo usage with and without Ammo Conservation would be packed into the same integer. For ammo 25 without ammo conservation (A.C) (4 shots) and ammo 13 with A.C. (8 shots), would set: iSuppression = 1325, For ammo 34 w/o A.C. (3 shots) and ammo 20 with A.C. (5 shots), would set:iSuppression = 2034, Code for this would be drastically simplified: iAdjustment = 0; if(m_kWeapon.HasProperty(eWP_UnlimitedAmmo)) ((10)) { return 0; } if(m_kWeapon.IsMelee()) { return 0; } if(!bCantLose) // doesn't have bHasAmmoConservation { iAdjustment = m_kWeapon.m_kTWeapon.iSuppression % 100; } else // has ammo conservation { iAdjustment = m_kWeapon.m_kTWeapon.iSuppression / 100; } if (GetType() == eAbility_ShotSuppress) ((17)) { iAdjustment = 2 * iAdjustment; } if (GetType() == eAbility_ShotFlush) ((12)) { iAdjustment = 1 * iAdjustment; } return iAdjustment; Thoughts? Link to comment Share on other sites More sharing options...
osito2dancer Posted May 29, 2013 Share Posted May 29, 2013 As I was fiddling around with this, I thought of a completely different approach. Use the iSuppression field in the Weapons= array in the DGC.ini to define each individual weapon's ammo usage. This would allow setting ballistic/laser/plasma weapons of every type individually. Ammo usage with and without Ammo Conservation would be packed into the same integer. For ammo 25 without ammo conservation (A.C) (4 shots) and ammo 13 with A.C. (8 shots), would set: iSuppression = 1325, For ammo 34 w/o A.C. (3 shots) and ammo 20 with A.C. (5 shots), would set:iSuppression = 2034, Code for this would be drastically simplified: iAdjustment = 0; if(m_kWeapon.HasProperty(eWP_UnlimitedAmmo)) ((10)) { return 0; } if(m_kWeapon.IsMelee()) { return 0; } if(!bCantLose) // doesn't have bHasAmmoConservation { iAdjustment = m_kWeapon.m_kTWeapon.iSuppression % 100; } else // has ammo conservation { iAdjustment = m_kWeapon.m_kTWeapon.iSuppression / 100; } if (GetType() == eAbility_ShotSuppress) ((17)) { iAdjustment = 2 * iAdjustment; } if (GetType() == eAbility_ShotFlush) ((12)) { iAdjustment = 1 * iAdjustment; } return iAdjustment; Thoughts? Sounds awesome, does it save a lot of space to do other things? Modulus and division give proper values? Although you could change that 34 to 33 (since 100/34 ~ 2.9, so you get 2 shots instead of 3). You are one of many godsend people to XCom, im just waiting for your patches to be released on Toolboks format, so i can apply them to Warspace and begin playing again :). GL HF! Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 29, 2013 Share Posted May 29, 2013 @Amineri That would work, but some of us, use that suppression value to actually modify the suppression nerf value. At the moment I set Rifles at -15 Aim and Heavys at -30 Aim with Heavy Laser atm doing -40 due to having Unlimited Ammo, twice. If this ammo system goes through all I'll need then is -15 for Rifles and -30 for Heavys. @osito2dancer There are mods out there that also use Amineri's awesome code like the Long War mod. Link to comment Share on other sites More sharing options...
johnnylump Posted May 29, 2013 Share Posted May 29, 2013 (edited) I'm pretty sure that Merciless mod does too! Is it confirmed that suppression setting the ini actually does something? I thought suppression just applied a constant reduction in aim, regardless of weapon. Edited May 29, 2013 by johnnylump Link to comment Share on other sites More sharing options...
johnnylump Posted May 29, 2013 Share Posted May 29, 2013 I'll raise a realism thing here, just food for thought ... Ingame, shotguns and sniper rifles fire one shot when used. If they're going to even have minimum capacities in real weapons, both combat shotguns and sniper rifles would probably have at least 5 rounds, and more likely 7 to 10. There's a little more room for claiming 'realism' with the rifles and LMGs, in that the x-com soldier fires multiple rounds with each shot. Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 29, 2013 Share Posted May 29, 2013 (edited) That works for ballistic weapons, but Plasma Weapons, that could be a good skill barrier for late game, being able to manage the amount of thermal clips you have to swap out to prevent the plasma generators from over-heating. These could keep the really low values of 3/4 shots per reload. And actually make sense to research the Ammo Conservation project. This can also be prevented from screwing the alien's AI over (as iValues spread over to alien weapons) by selecting Unlimited Ammo for the alien in properties for SectoidPlasmaPistol in the DGC. My Ideas Balistic:Shotgun = 8Rifle = 8Heavy = 10Sniper = 6Pistol = 4 Laser = InfinitePlasma = HalfAliens = Infinite (They have solved the ammo problem) Edited May 29, 2013 by Yzaxtol Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 29, 2013 Share Posted May 29, 2013 (edited) Testing iSupression out with a -200 buff right next to an alien with super close range buff.. -30 should be nearly 100% accurate -200 should be 0% accurate He wiped them out without any pause, yeh supression value does nothing :( Damn you firaxis and your bazillion useless variables. Edited May 29, 2013 by Yzaxtol Link to comment Share on other sites More sharing options...
Amineri Posted May 29, 2013 Author Share Posted May 29, 2013 @Amineri That would work, but some of us, use that suppression value to actually modify the suppression nerf value. At the moment I set Rifles at -15 Aim and Heavys at -30 Aim with Heavy Laser atm doing -40 due to having Unlimited Ammo, twice. If this ammo system goes through all I'll need then is -15 for Rifles and -30 for Heavys. @osito2dancer There are mods out there that also use Amineri's awesome code like the Long War mod. I'm pretty sure that Merciless mod does too! Is it confirmed that suppression setting the ini actually does something? I thought suppression just applied a constant reduction in aim, regardless of weapon. Does the iSuppression value actually have an in-game effect? I did a quick search through the files for "iSuppression" and the only cases that came up were the replication setting and storing the value into the m_arrWeapons array of TWeapon structs. If you do want some specific to-hit adjustments in specific cases, they could be tagged on to the Squadsight aim penalty adjustment code. This resides in XGAbility_Targeted.AdjustToHit, which applies a to-hit bonus/penalty adjustment to every shot based on "whatever" circumstances. The vanilla game uses this to "cheat" for the player in Easy/Normal difficulties. Any changes here aren't reflected in the to-hit number displayed in the UI. Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 29, 2013 Share Posted May 29, 2013 Test utterly failed 100% of the time, the iSuppresion value does nothing. Link to comment Share on other sites More sharing options...
Amineri Posted May 29, 2013 Author Share Posted May 29, 2013 Test utterly failed 100% of the time, the iSuppresion value does nothing. Thank you for the update on the test :) It sounds like this is the popular choice, and allows you guys to have the maximum amount of flexibility in how to configure the ammo situation (plus the bonus of being easiest for me to code). As to the 33 versus 34 ammo thing.... This is why I wanted to change the max ammo count to 120, so 3 shots would be an even divisor. I'm not quite sure when the game checks to see if there is enough ammo for a shot versus when the game simply verifies that there is non-zero ammo remaining. ApplyAmmoCost has a specific check that if ammo == 1 then it sets ammo to 0 instead, presumably to handle the ammo_used = 33 case. There are a lot of tests against GetRemainingAmmo() == 0 in the code. Once I get the code running it should be relatively simple to test whether 33 / 34 ammo results in 4 / 3 / 2 shots before have to reload. I'd like to recode it to work against 120 base, but the TacticalHUD_WeaponPanel display that shows remaining ammo is geared around receiving an integer scaled to 100 max. I'll poke around at maybe rescaling the value ... something like iAmmoDisplay = int(float(iAmmo)/1.20); if I can squeeze it into the TacticalHUD code. ----------------------------------- Any other thoughts about interesting ammo-usage scenarios? Using the iSuppression value will leave a lot of extra space in the function to implement new things. Link to comment Share on other sites More sharing options...
Recommended Posts