Jump to content

A shack with it's own weapons that can be purchased... help?


LennyHayes7

Recommended Posts

So the title says it all, or most of it.

 

I'd like to make a standalone shack in the Wasteland and fill it's walls with 6-7 guns, I'd like those guns to function in a way like the broken 9mm SMG in doc mitchells house.

 

So to say, instead of being repaired with the right amount of skill, I want the caps to do the talking, an argument like this:

 

- - -

Clicking a gun which you can't afford

POP UP message: "You don't have enough caps to purchase this item"

Options available: Okay

 

Clicking on a gun you CAN afford

POP UP message: "Are you sre you would like to purchase the (Gun Name)?"

​Options available: "Yes" and "No"

Deduct that guns cost in caps from the player

- - -

 

Any help would be greatly appreciated, this mod will feature credits for such assistance.

 

Link to comment
Share on other sites

Since I don't know what part of this you need assistance with, or what your level of modding experience is, I'll just take a shot and assume that you know how to open the GECK and create/place items.

The 9mm SMG in Doc Mitchells house is an activator that uses the model for the 9mm SMG. So what you need to do is create a new activator and set it to use the model for the weapon you want. You might have to extract this from the 'Meshes' BSA archive in your Data folder in order to locate it from the GECK. After doing so you can place the activator in your shack.

You also need to attach a script to the activator that tells it what to do when activated. In this case you want it to show a message, and to give you a weapon when the appropriate button is pressed. The script below should work, you just need to create the two messages with the appropriate buttons. And make sure the 'Yes' button is the first button on the buying message. Also remember to change the price and the weapon to what you want.

scriptname WeaponActivateScript
int button
int buyingweapon

Begin OnActivate
	if IsActionRef Player
		if Player.GetItemCount Caps001 >= 100
			ShowMessage WeaponBuyMessage
			set buyingweapon to 1
		else
			ShowMessage NotEnoughCapsMessage
		endif
	endif
End

Begin GameMode
	set button to GetButtonPressed
	
	if button == 0 && buyingweapon == 1
		player.AddItem WeapNV9mmSubmachineGun 1
		set buyingweapon to 0
		Disable
	endif
End

Tell me if you need further assistance.

Edited by Ladez
Link to comment
Share on other sites

Would it be too much to ask if you could repost that but with comments to label? thanks

You mean with the script? Sure..

 

The following line checks how many caps you have in your inventory. I've set the price to a hundred caps, but you can change it to whatever you want.

if Player.GetItemCount Caps001 >= 100

The next section will show a message only if the previous condition is true. You will need to create a message in the GECK and put its editor ID in the place of "WeaponBuyMessage". When you add the "Yes" and "No" buttons in the message, make sure that "Yes" is the first one. I'll get to why later.

You can ignore the second line, that only makes sure that you only get the gun if the message above is shown.

ShowMessage WeaponBuyMessage
set buyingweapon to 1

This next message will only be shown if the condition was false, i.e. you did not have enough caps. Again, just replace "NotEnoughCapsMessage" with a message you created in the GECK.

ShowMessage NotEnoughCapsMessage

The following bit gets the index of the button you pressed on the message shown, and proceeds only if the index is 0. This is the first index of message buttons, and it's why your "Yes" button should be placed there. And because the "Okay" button on the 'not enough caps' message is also at index 0, we need to have another condition so that doesn't trigger the purchase as well, which is why I included the 'buyingweapon' variable.

set button to GetButtonPressed
if button == 0 && buyingweapon == 1

The last bit you need to change is the part where you are given the gun. Simply replace "WeapNV9mmSubmachineGun" with the editor ID of the gun you wish to make purchasable.

player.AddItem WeapNV9mmSubmachineGun 1

I forgot to add the line that removes the caps from your inventory. Simply add this below the previous line and remember to adjust the price:

player.RemoveItem Caps001 100

As final note, I'd like to recommend you to read a tutorial on scripting so you might be able to help yourself next time :wink:

 

Edited by Ladez
Link to comment
Share on other sites

  • Recently Browsing   0 members

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