Removing Mod Kits from Weapon?

Post » Fri May 27, 2011 6:15 pm

Hi,
i'm currently looking to create a mod where you can remove attached weapon modifications from the weapon. At the moment i'm looking how they are attached, is it done by a script in the game or anything else? Is it possible to get the information if a weapon has mods and which mods are installed?

regards,
Mr. J
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Fri May 27, 2011 7:55 pm

You could use GetName from NVSE to see if it has a + next to their name.
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Fri May 27, 2011 9:41 pm

I'm not sure that would work - I don't think the mods actually append a '+' to the item's name when you mod it, the '+' just lets you know that there are mods on the item (else modded items wouldn't have lost their +s while someone was porting a UI mod over from FO3). Also, I don't think FVSE currently has the functions to see if there is a '+' in a name or not.

As to the original poster's questions: Mods are added via hardcoded funbits. Modders generally don't have access to that information, so we can't alter the way it works. We also currently can't detect weapon mods on an item or change the mods on an item. FVSE might eventually include the required functionality.
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Sat May 28, 2011 9:27 am

Yes it can work, but you have to swap the model of the modified gun out for the original though, so you preserve the original stats, etc.

JES told us that we can't "un-mod" a weapon in-game, but as long as your willing to swap the model out for the original, I don't see why it would be a problem to do with a GECK script.

Miax
User avatar
Cheville Thompson
 
Posts: 3404
Joined: Sun Mar 25, 2007 2:33 pm

Post » Fri May 27, 2011 11:26 pm

Yes this is possible and it's not particularly hard. (I have pretty much done this before, in FO3Phalanx' dealing with Butch and his personalized Super Sledges.)

In this case it would require the player to make a point to have only ONE of that particular weapon in inventory - like, if he wants to unmod a laser rifle he's got to not have a buncha extra laser rifles in the inventory.

When above is the case: you have the player equip the weapon, and have that equippage be in the context that the player expressly wants the weapon unmodded. Then, you use GetWeaponHealthPerc http://geck.gamesas.com/index.php/GetWeaponHealthPerc to pull the weap's condition, then you make the player unequip the weapon, then you remove the weapon, then you give him a fresh one with that same health value. Additemhealthpercent would make the replacement item show up unmodded, I would expect. http://geck.gamesas.com/index.php/AddItemHealthPercent

If you wanted example code, well, you could go look in Butch's object script in FO3Phalanx, I think that is where my code for that is.
User avatar
Amy Melissa
 
Posts: 3390
Joined: Fri Jun 23, 2006 2:35 pm

Post » Fri May 27, 2011 6:11 pm

The problem is figuring out what mods the weapon actually has. You can swap it out, sure, but it's a little pointless if you don't get back the mods.
User avatar
Emily Martell
 
Posts: 3469
Joined: Sun Dec 03, 2006 7:41 am

Post » Fri May 27, 2011 7:18 pm

Good point. If the current mod system swaps out one FromID for another, it should be possible to track-back to what FromID the player has now (and that would reveal the mods it has), much like how AntiStar's WMK worked for Fallout3. From there you could load the vanilla gun and the mods into the player inventory.

Miax
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Fri May 27, 2011 8:00 pm

The current mod system does not in any way swap out formIDs. It's all the same FormID, and the mod information is integrated into the weapon form.

The new beta of NVSE might have a function that lets you determine the mods on a weapon (not positive if it works this way, though): GetWeaponItemMod - format: optionalRef.GetWeaponItemMod int:whichMod (1-3) optionalForm

From what behippo said, if you use it on a varmint rifle with just a night scope (assuming the scope is mod 1) and do VarmintRifleRef.GetWeaponItemMod 1, you'd get the night scope's mod item, which you can then give to the player. You could also do VarmintRifleRef.GetWeaponItemMod 2, but it'd return null since you don't have a silencer/extended mag. Alternatively, it might just return what the mod item would be even if that particular VarmintRifleRef did not have any mods installed. Not sure on that yet.
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Fri May 27, 2011 9:49 pm

format: optionalRef.GetWeaponItemMod int:whichMod (1-3) optionalForm
It takes base forms, so it'll be returning the mod as defined on the base form.
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Sat May 28, 2011 10:41 am

Well, that's unfortunate. I was thinking it might return the base form mods if you gave it a base form and the actual ones installed if you gave it a ref.
User avatar
Sophie Miller
 
Posts: 3300
Joined: Sun Jun 18, 2006 12:35 am

Post » Sat May 28, 2011 2:49 am

Naw, if you pass xSE functions that work on a base form a reference then they use that ref's base form.
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Sat May 28, 2011 12:46 am

Oh, he meant retain the parts from the upgrade? get them back? that part I have no idea, wasn't considering the possibility of affording the player that luxury =p

When you mod a weapon it retains the same object ID if you look with the 'inv' command btw (already checked out of curiosity).
User avatar
Jade Muggeridge
 
Posts: 3439
Joined: Mon Nov 20, 2006 6:51 pm

Post » Sat May 28, 2011 6:07 am

Hi,
thanks for the information. As far as i can see the mod system in its current implementation is pretty much useless for me, since i liked the "Weapon Mod Kits" system in Fallout 3. So it would make much more sense for me to wait for a port of WMK or create something completely new.

regard,
Mr. J
User avatar
SWagg KId
 
Posts: 3488
Joined: Sat Nov 17, 2007 8:26 am


Return to Fallout: New Vegas