LivewareCascade Posted June 5, 2012 Share Posted June 5, 2012 So I'm porting an unlimited ammunition mod to NV (for the player, anyway): http://fallout3.nexu...com/mods/17666/ I've got the script running, but the FOSE code was this, which works well enough in FO 3: scn UnlimitedPlayerAmmoSCRIPT ref rWeapon ref rAmmo ref rGrenade ref rMine short iAmmoCount short iAmmoUse short iWeaponType BEGIN GameMode if UnlimitedPlayerAmmoEnabled == 1 set rWeapon to GetEquippedObject 5 set rAmmo to GetWeaponAmmo rWeapon set iAmmoCount to GetWeaponClipRounds rWeapon set iAmmoUse to GetWeaponAmmoUse rWeapon set iWeaponType to GetWeaponAnimType if iAmmoCount > 0 && iAmmoUse > 0 && ((iWeaponType == 4 && UnlimitedPlayerPistol == 1) || (iWeaponType >= 5 && iWeaponType <= 6 && UnlimitedPlayerRifle == 1) || (iWeaponType == 7 && UnlimitedPlayerHandle == 1) || (iWeaponType == 8 && UnlimitedPlayerLauncher)) if UnlimitedMode == 1 || UnlimitedMode != 2 if GetItemCount rAmmo < (iAmmoCount + iAmmoUse) if GetWeaponFireRate rWeapon < 15 AddItem rAmmo 1 1 else AddItem rAmmo 2 1 endif endif elseif UnlimitedMode == 2 if GetItemCount rAmmo == 0 AddItem rAmmo iAmmoCount 1 endif endif elseif (iWeaponType == 9 && UnlimitedPlayerGrenade == 1) set rGrenade to GetEquippedObject 5 if GetItemCount rGrenade < 2 AddItem rGrenade 1 1 endif elseif (iWeaponType >= 10 && UnlimitedPlayerMine == 1) set rMine to GetEquippedObject 5 if GetItemCount rMine < 2 AddItem rMine 1 1 endif else set rWeapon to 0 set rGrenade to 0 set rMine to 0 set rAmmo to 0 set iAmmoCount to 0 set iAmmoUse to 0 return endif endif END However, NVSE is slightly different, as I'm sure you guys know. For example, GetWeaponAmmo, which returns the amount of ammo for the weapon in FO3, returns the formlist for weapon ammo in NVSE, so all available ammo types are dealt with. So the only way I can adapt this for NV currently is to delete all but one ammo type off the formlist, since the refill script adds ammo randomly - so the player has to keep switching between Ammo types. Is there a way to set this so that it focuses on one ammo type? I tried to use GetPlayerCurrentAmmo in place of GetWeaponAmmo, but it doesn't seem to work with that, although the script readily compiles. Link to comment Share on other sites More sharing options...
pluramon Posted June 6, 2012 Share Posted June 6, 2012 (edited) If the whole idea is unlimited ammo, why not use the SetWeaponAmmoUse function and set the currently equipped weapon to use 0 ammo? I have to admit I've never used this function before, so I don't know exactly how it would behave. Something like this: if UnlimitedPlayerAmmoEnabled == 1 'activated by a hot-key or whatever' if GetAnimAction == 0 'weapon is being equipped' set rWeapon to GetEquippedObject 5 set iAmmoUse to GetWeaponAmmoUse rWeapon 'stores weapons original ammo usage' SetWeaponAmmoUse 0 rWeapon elseif GetAnimAction == 1 ;weapon is being unequipped SetWeaponAmmoUse iAmmoUse rWeapon 'restores weapons original ammo usage' endif endif Naturally, when UnlimitedPlayerAmmoEnabled is reset to 0 (from a separate script), SetWeaponAmmoUse iAmmoUse rWeapon must be called on again. It all depends on whether or not setting a weapon to use 0 ammo doesn't stop it from shooting altogether. Edited June 6, 2012 by pluramon Link to comment Share on other sites More sharing options...
LivewareCascade Posted June 6, 2012 Author Share Posted June 6, 2012 True, but I wanted something that both forces the player to reload. If I forced the player to reload after the given magsize had been expended, it would be infinite ammo, but would not update the hud. If I didn't force the reload, then you wouldn't get that functionality. I know I'm being pedantic about it, but the idea is to develop as "precise" a function as possible. I don't want unlimited reload, or the ability to only carry one bullet as my store of ammunition. Link to comment Share on other sites More sharing options...
Recommended Posts