Jump to content

Nanotech rifle NVSE weapon scripting issue...


ultrasonic99

Recommended Posts

Hi all,

I've been working on a script for a custom weapon and need some assistance with the "SetWeaponAmmoUse" and "SetWeaponNumProjectiles" functions from NVSE. The concept behind it is that the weapon uses a block of nanobots for ammo (200 ammo per clip) and it can create whatever type of ammunition you want (bullet, shot, missile, grenade) from that block. The kicker is that depending on the ammo type you choose, a different amount of the clip is consumed, out of 200. For example, 1 bullet will use 1 ammo, but 1 missile will use 20 ammo, and so on.

 

I'm using "SetWeaponAmmoUse 20" and "SetWeaponNumProjectiles 1" for the weapon to shoot 1 missile but use 20 ammo from the clip. The problem is that the weapon fires 20 missiles instead of 1, which I thought "SetWeaponNumProjectiles 1" would fix, so I need help to figure out why this is happening and if it can be fixed. If anyone has any suggestions, help or tips, they would be greatly appreciated!

Edited by ultrasonic99
Link to comment
Share on other sites

Update:

I figured out the problem, needed to change the "number of projectiles" values of the base gun and ammo to 0.

 

But now I need some help with changing the abbreviation of the ammo type in the HUD for the different fire modes. I've searched quite a bit for HUD variables, but can't find anything, short of modifying the .XML file for the HUD. If anyone knows a script function that can change this, I would be greatful, maybe I can actually make a mod out of this!

Link to comment
Share on other sites

As luthienanarion said, there's no existing command to do that. However, you could create a number of custom ammo types with the short-hand names (using your default ammo's long name) you want and then cycle through them. The only draw-back to this is that you'd need to actually have that ammo to fire the weapon. Something like this might work:

	if bMissile ;I don't know how you're changing the type of ammo, but I assume you use a variable to do it, swap "bMissile" for that.
		set iAmmo to player.GetItemCount NanoAmmo ;Obviously this would be the ID of your ammo.
		player.AddItem NanoMissleAmmo iAmmo 1
		player.RemoveItem NanoAmmo iAmmo 1
		player.EquipItem NanoMissileAmmo 0 1
	elseif player.GetItemCount NanoMissileAmmo > 0; Remove the missile ammo if the player changes ammo type.
		set iAmmo to player.GetItemCount NanoMissileAmmo
		player.RemoveItem NanoMissileAmmo iAmmo 1
		player.AddItem NanoAmmo iAmmo 1
		set bMissile to 0; If the variable you're using has values other than one or zero and is set elsewhere when changing ammo, remove this line.
	endif

Obviously you'll need to change those lines depending on ammo type. Good luck, sounds like an interesting idea! :smile:

Edited by Jojash
Link to comment
Share on other sites

Or you could try opening FNVEdit and expanding the Fallout NV master file. You can change how stats and skills abbreviate in the Pip-Boy, so you may be able to find a list of ammo types and how they are abbreviated in the HUD, possibly under "Ammo" or "Projectiles".

Link to comment
Share on other sites

Thanks for all the suggestions! I suspected that there was nothing currently in NVSE to change the HUD, but now I know. I'm gonna try both Jojash and AxlDave's recommendations first, but if I can't get it that way, I may just take you up on your offer, luthienanarion! Apparently, I don't like to pick the easy ideas on my first time scripting...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...