Help Porting FOSE Mod to NVSE

Post » Wed Jun 13, 2012 8:39 pm

So I'm porting an unlimited ammunition mod to NV (for the player, anyway):

http://fallout3.nexusmods.com/mods/17666/

I've got the script running, but the FOSE code was this, which works well enough in FO 3:

scn UnlimitedPlayerAmmoSCRIPTref rWeaponref rAmmoref rGrenaderef rMineshort iAmmoCountshort iAmmoUseshort iWeaponTypeBEGIN 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	endifEND

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. I found a post somewhere on the net that says GetPlayerCurrentAmmo is bugged and I need to insert an endif somewhere? Is this still true, and if so, where the hell do I put it?
User avatar
GRAEME
 
Posts: 3363
Joined: Sat May 19, 2007 2:48 am

Post » Wed Jun 13, 2012 9:01 pm

GetPlayerCurrentAmmo is what you want, since that returns what the player is currently using in the weapon. From what I have read, you just put an 'endif' on the next line after it to 'un-bug' it. I have not yet used GetPlayerCurrentAmmo myself, though.
...set rAmmo to GetPlayerCurrentAmmoendif...
User avatar
Max Van Morrison
 
Posts: 3503
Joined: Sat Jul 07, 2007 4:48 pm

Post » Thu Jun 14, 2012 5:46 am

Hmmm. Gave that a shot, but didn't seem to work. Most peculiar. Thanks for the assist thought.
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm


Return to Fallout: New Vegas