Jump to content

Need Scripting Assistance


Jambo11

Recommended Posts

First off, try to be gentle. I'm still trying to get my feet wet in scripting, and I'm not the fastest learner.

 

My aim is to create a script that replace 20-gauge ammo and hulls with those of 10-gauge. Of course, I've considered simply changing the names of the various 20-gauge rounds to "Ammo10ga" but some of them have no real world 10-gauge counterpart...e.g. there is no such thing as a 10-gauge magnum, since they're all 3 1/2", anyway. Plus, I'm riddled with OCD.

 

Anyway, though I are bad at scripting, I'm aware enough of what I don't know about scripting to know that my script since needs quite a bit of work:

 

scn Swap20gaFor10gaAmmoScript

 

BEGIN OnAdd Player

Player.AddItem Ammo10ga 1

Player.RemoveItem Ammo20ga 1

endif Player.Ammo20ga == 0

 

Player.AddItem Ammo10gaSlug 1

Player.RemoveItem Ammo20gaSlug 1

endif Player.Ammo20gaSlug == 0

 

Player.AddItem Ammo10ga 1

Player.RemoveItem Ammo20gaMagnum 1

endif Player.Ammo20gaMagnum == 0

 

Player.AddItem Ammo10ga 1

Player.RemoveItem Ammo20gaJunkRounds 1

endif Player.Ammo20gaJunkRounds == 0

 

Player.AddItem Hull10ga 1

Player.RemoveItem Hull20ga 1

endif Player.Hull20ga == 0

END

 

FYI, I've already created the new 10-gauge ammo, hulls, boxes, etc.

Edited by Jambo11
Link to comment
Share on other sites

Well first off, you are ending If statements that you never started. That alone will keep it from ever working. Secondly, you're not accounting for any of the different items. You could do this two different ways. One requires several scripts, one for each object you want to replace. The second way requires NVSE, but lets you do it all in one script.

 

The first way would look something like:

scn Swap20gaFor10gaAmmoScript

BEGIN OnAdd Player
Player.AddItem Ammo10ga 1
RemoveMe
END

 

That method would require you to write a a different script for each ammo type you want to add to the player. So if for slug rounds you'd replace the AddItem line for the slug ammo. The rest of it takes care of itself.

 

The second version, requiring NVSE, but being easier to code (imo) because you can keep it all in one place, goes something like this:

scn Swap20gaFor10gaAmmoScript

ref rSelf

BEGIN OnAdd Player
set rSelf to GetSelf		;get the object and set it to a variable

if rSelf.GetBaseObject == Ammo20ga
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Ammo20gaSlug
	Player.AddItem Ammo10gaSlug 1
elseif rSelf.GetBaseObject == Ammo20gaMagnum
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Ammo20gaJunkRounds
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Hull20ga
	Player.AddItem Hull10ga 1
endif
RemoveMe

END

 

This version is, to me, much easier to manage, because there's only one script to use and manage or look at, and you can just add to it instead of making more new scripts later. But if you don't want to have an NVSE dependency, or don't use NVSE, then it obviously won't work.

Link to comment
Share on other sites

Well first off, you are ending If statements that you never started. That alone will keep it from ever working. Secondly, you're not accounting for any of the different items. You could do this two different ways. One requires several scripts, one for each object you want to replace. The second way requires NVSE, but lets you do it all in one script.

 

The first way would look something like:

scn Swap20gaFor10gaAmmoScript

BEGIN OnAdd Player
Player.AddItem Ammo10ga 1
RemoveMe
END

 

That method would require you to write a a different script for each ammo type you want to add to the player. So if for slug rounds you'd replace the AddItem line for the slug ammo. The rest of it takes care of itself.

 

The second version, requiring NVSE, but being easier to code (imo) because you can keep it all in one place, goes something like this:

scn Swap20gaFor10gaAmmoScript

ref rSelf

BEGIN OnAdd Player
set rSelf to GetSelf		;get the object and set it to a variable

if rSelf.GetBaseObject == Ammo20ga
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Ammo20gaSlug
	Player.AddItem Ammo10gaSlug 1
elseif rSelf.GetBaseObject == Ammo20gaMagnum
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Ammo20gaJunkRounds
	Player.AddItem Ammo10ga 1
elseif rSelf.GetBaseObject == Hull20ga
	Player.AddItem Hull10ga 1
endif
RemoveMe

END

 

This version is, to me, much easier to manage, because there's only one script to use and manage or look at, and you can just add to it instead of making more new scripts later. But if you don't want to have an NVSE dependency, or don't use NVSE, then it obviously won't work.

 

So, the way you have it would give me the 10-gauge rounds and hulls, and remove the respective 20-gauge rounds and hulls?

 

And the script would run only as long as those 20-gauge items are in my inventory?

 

Edited to add: how do run the Script Extender for the GECK? On the Bethsoft site, it says that I'm supposed to run it from the command prompt, but "nvse_loader.exe - editor" doesn't do squat, even though I have the script extender extracted to the "fallout new vegas" folder.

Edited by Jambo11
Link to comment
Share on other sites

That's correct. To start NVSE, you should just right click on the nvse_laoder.exe, click 'Create Shortcut' and then in the new shortcut, right click it and choose 'Properties'. In the 'Target' line, you want it to say this:
"\Steam\steamapps\common\fallout new vegas\nvse_loader.exe" -editor

exactly like that.

Link to comment
Share on other sites

That's correct. To start NVSE, you should just right click on the nvse_laoder.exe, click 'Create Shortcut' and then in the new shortcut, right click it and choose 'Properties'. In the 'Target' line, you want it to say this:

"\Steam\steamapps\common\fallout new vegas\nvse_loader.exe" -editor

exactly like that.

 

Yeah, I got the shortcut set up,, and the script made, but it's not doing anything in the game. I ran the game with the script extender (and I checked the box at the start menu), but the 20-gauge shells aren't being replaced with 10-gauge. I tried dropping them and picking them back up, but nothing happens. I even tried doing it one at a time, but no luck.

 

This is why I hate being a slow learner. :^(

Edited by Jambo11
Link to comment
Share on other sites

  • Recently Browsing   0 members

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