Varicide Posted April 21, 2016 Share Posted April 21, 2016 Hi. I'm trying to make a script that can change the stats/properties of one weapon. But instead, it changes all weapons of the class. Is there some way to only change one weapon at once? Thanks! scn testscriptshort buttonref rWeaponfloat fDmg begin OnEquip set rWeapon to GetHotkeyItem 1;set fDmg to GetCritDam rWeaponset fDmg to GetCritDam rWeapon showmessage f4modtestmsg fDmg end begin menumodeset button to getbuttonpressed if(button == 0);SetWeaponIsAutomatic 1 rWeapon ; makes all weapons of that type automaticrWeapon.SetWeaponIsAutomatic 1 ; does nothing!endif end Link to comment Share on other sites More sharing options...
Ladez Posted April 21, 2016 Share Posted April 21, 2016 GetHotkeyItem returns a base form, so you can't call SetWeaponIsAutomatic on it using reference syntax. You have to provide the base form as an argument. However, even if your refvar did contain a reference, calling SetWeaponIsAutomatic on it would still set the value of the base item of the reference, changing all weapons of the same type. Link to comment Share on other sites More sharing options...
Varicide Posted May 1, 2016 Author Share Posted May 1, 2016 Thanks for the help. I thought it didn't return the base form. So there's no way to change just one weapon then? Link to comment Share on other sites More sharing options...
Ladez Posted May 1, 2016 Share Posted May 1, 2016 Not really, no. There's a way to give player-specific bonuses by using hidden perks, but nothing that only applies to a single, physical weapon. There's a way it might be possible to accomplish what you want with NVSE, but it's a method I've never tried before, so I can't vouch for it's effectiveness. NVSE has a function called TempCloneForm that clones a given object into a new base form. It's temporary though, the cloned form will only last for the duration of a game session. I'm also guessing that it doesn't take into consideration weapons that need to be placed into certain form lists for stuff like perk bonuses to apply. These hurdles can be overcome with careful scripting, but you're going to need to keep track of a lot of stuff. And like I said, I've never tried doing it, so it may not even work at all. Link to comment Share on other sites More sharing options...
Recommended Posts