Jump to content

How to set storage limit on container


amokrun1

Recommended Posts

No need to apologize, your tangents still teach me something!

 

I am actually trying to make an adjustment to a perk overhaul mod, this one:

 

https://www.nexusmods.com/newvegas/mods/65759?tab=description

 

It overhauls the Computer Whiz perk, whereby upon attainment you can access a virtual container via any computer terminal. The perk does so through an Activate entry point with an Add Activate Choice function, which means upon interacting with any terminal you are presented with a messagebox that asks if you want to hack the terminal or access the "Mushroom Cloud" container. Choosing the latter will bring up an inventory screen identical to that which appears when interacting with any container. If we use Dead Money as an example, you could loot the entire vault contents, gold bars and all, by just dumping them into the bottomless capacity of the terminal there and then recovering it all later from any terminal back in the Mojave. This imho breaks the game, hence my desire to place an inventory limit on it.

 

I don't see any script attached to the perk overhaul in the mod itself so I think the mod just changes the perk to link it up to the mushroom cloud container it provides. It is on this container I would need to run the capacity-limiting script, I imagine.

Link to comment
Share on other sites

No need to apologize, your tangents still teach me something!

 

I am actually trying to make an adjustment to a perk overhaul mod, this one:

 

https://www.nexusmods.com/newvegas/mods/65759?tab=description

 

It overhauls the Computer Whiz perk, whereby upon attainment you can access a virtual container via any computer terminal. The perk does so through an Activate entry point with an Add Activate Choice function, which means upon interacting with any terminal you are presented with a messagebox that asks if you want to hack the terminal or access the "Mushroom Cloud" container. Choosing the latter will bring up an inventory screen identical to that which appears when interacting with any container. If we use Dead Money as an example, you could loot the entire vault contents, gold bars and all, by just dumping them into the bottomless capacity of the terminal there and then recovering it all later from any terminal back in the Mojave. This imho breaks the game, hence my desire to place an inventory limit on it.

 

I don't see any script attached to the perk overhaul in the mod itself so I think the mod just changes the perk to link it up to the mushroom cloud container it provides. It is on this container I would need to run the capacity-limiting script, I imagine.

 

So for clarity ... you never open a "Terminal" then click one of the menu items to open the container ?

It is the "Activate" EntryPoint giving you secondary options when hitting "E" hovering over a terminal ?

 

Which ya is different kinda scripting ... and actually my personal favorite ... am always telling people about that perk / entrypoint when applicable.

I just assumed you were in the terminal scripting/triggers ... you should try to clarify the parameters of your instance problem more when posting here.

That kinda stuff would really help in helping you to get what you want ; )

Link to comment
Share on other sites

I'm a little late to this topic, but from my understanding that you want to either create your own mod that would allow the player to access the "Mushroom Cloud" or make an entirely new mod that does this but to your own specified conditions with a max weight the "Mushroom Cloud" can handle?

If you aren't sure how to get the message box to open when activating a terminal:

Within the Computer Whiz Perk -> Perk Entries, create an Activate Entry Point. You can then add your code to the "Start Script" part of the window. You would also need to add a condition to the Entry Point so the message box only appears when activating a terminal. To do this, you would need to use GetObjectType (https://geckwiki.com/index.php?title=GetObjectType) as a condition for the Entry Point, and set the GetObjectType parameters to "Terminal" (== 1). This should give you that message box when activating a terminal from now on.

 

If you're trying to only set the weight limit to the "Mushroom Cloud":

 

You can have another message box open after selecting "Mushroom Cloud" in the first message that will give you 3 choices: Deposit, Withdraw, Exit.

 

You can then create an empty cell and throw 2 brahmins in it. Each brahmin will need be it's own separate EditorID. One should be called Deposit, one should be called Mushroom Cloud / Storage / Virtual Bank/ Whatever you want to call it (It's name would only reflect the "Container" name at the top of the Inventory Menu window).

 

Selecting Deposit will open the Deposit NPC's inventory using OpenTeammateContainer 1 (https://geckwiki.com/index.php/OpenTeammateContainer). This is the "container" you'd be putting the items into.

 

Selecting Withdraw will open the "Mushroom Cloud" and will allow the player to take items from it as it see's fit, and you can make it so if the player adds anymore items to it - the items will be added back into the players inventory.

 

You would also want to declare two float variables in the script: fCurrentWeight and fDepositWeight. You would also want to make another float that declares the max weight the container would have. I went into GECK last night to see if I could do this myself and ended up creating a new GLOBAL float variable to determine the max weight.

 

What I did was make a funnel system that led the Deposit NPC's inventory into the Storage NPC's inventory. The player could store a number of items into the Deposit NPCs inventory (up to 200lbs or the desired amount) and if they went over it would put the item that went over the limit back into the players inventory. When the Deposit's Inventory Menu was closed, it would then transfer the items into the Storage NPC's Inventory.

 

I feel like this should work for your case. But a few tid bits to consider:

 

  • Rather than store the entire script in the "Start Script" of the Entry Point, you could create a separate UDF Script and Call (https://geckwiki.com/index.php?title=Call) it in the Start Script. You probably don't need to do this, I only recommend it because working in the Result Script Windows in GECK tends to look messy and having the scripting stored in a UDF looks nice and IMO just feels better.
  • The Player would have to re-activate the Terminal and go through the message boxes if they wanted to Withdraw from the Storage or Deposit into it, after making their selection the first time.

I didn't realize you were trying to call the Storage from a Terminal, so I just thought you wanted to set up a Virtual Storage in general - so I did this with an activator instead of what you were planning to do. It worked for me and I'm sure you can get it to work for you with your desired set up.

 

Here's the script I had for my activator:

scn zz1ConsoleScript

float fInputWeight
float fOutputWeight

float fCurrentWeight; 
float fDepositWeight

int iSelection

int iButton

begin onactivate 

if iSelection == 0
	showmessage zz1VirtualMessageBox
	set iSelection to 1
endif

end

begin menumode 1001

if iSelection == 1

		set iButton to getbuttonpressed
		set fCurrentWeight to zz1OutputREF.GetInventoryWeight
		set fDepositWeight to zz1InputREF.GetInventoryWeight


		if (iButton == 0)
			;deposit
			zz1InputREF.OpenTeammateContainer 1
			set iSelection to 0
		endif
	
		if (iButton == 1)
			;withdraw
			zz1OutputREF.OpenTeammateContainer 1
			set iSelection to 0
		endif
	   
	   if (iButton == 2)
			;exit
			set iSelection to 0
		endif
endif

end

Begin Gamemode
		if zz1InputREF.GetInventoryWeight != fDepositWeight
			set fDepositWeight to zz1InputREF.GetInventoryWeight
		
			if (fDepositWeight + fCurrentWeight) > zz1MaxWeight
				zz1InputREF.removeAllItems Player 1 1
				showMessage zz1VirtualTooMuch
				set iSelection to 0
			else
				zz1InputREF.removeAllItems zz1OutputREF 1 1
				showMessage zz1VirtualAccepted
				set iSelection to 0
			endif
			
		endif
end

If you want the .esp I made to jury rig it to your likings let me know and I can email it to you.

 

- Stealth Dick

Edited by StealthDick
Link to comment
Share on other sites

Wow thats awesome ... but I would wager is information overload ? Was for me.

 

I caught the part about the Brahmin though .... hell ya that's wat is needed for the virtual container.

Link to comment
Share on other sites

Amok,

Look into Call (https://geckwiki.com....php?title=Call).

 

It allows you to create a script that doesn't need to be attached to any activator/quest/effect/npc/creature/etc. You just make the script and call it.

For example:

(And apologies if this a bit of an information overload, need to work on that.)

Start Script
; The box in the perk you would call from.

call myUDFScript

;"myUDFScript" would be the name of the script you make that's not attached to any reference.

When you use call the myUDFScript, it will run it.

scn myUDFScript
;it doesn't need to be called "myUDFScript", call it whatever you want - except late for dinner.

float fFloat
short bShort
int iInt
;whatever variables
;the nice thing about UDFs is that whatever variable that is unique to it will be reset after use.
;however, if you change the variable of another (non-UDF) script, it will make changes to that script.

begin Function {}
; UDFs only use Function block types. Don't bother using Gamemode, Menumode, OnActivate, etc. within them.

player.additem caps001 100
;just a little placeholder property.
;you'll have to work your script into the UDF.

end

Now, to use Call and to use UDF Scripts, you'll need to make sure your version of GECK is NVSE aware. If you're GECK already is, good. If not, I highly recommend you make it NVSE aware. Most mods nowadays require NVSE, and once you dip your toes into it - New Vegas becomes your oyster.

 

You mentioned using activate on the brahmin from the Start Script. You wouldn't be able to. If I'm not mistaken, I'm fairly certain that you'd have to be in the same cell or worldspace (grid even) to get a successful activation. That's why I recommend using call.

 

Apologies if I just rambled without asking your question, It a tad late and I don't feel like re-reading what I just wrote lol.

 

- Stealth Dick

Link to comment
Share on other sites

For your instance:

 

The Start Script:

Start Script

showMessage menuMessage; the message that reads as: 0 Deposit, 1 Withdraw, 2 Exit
call StorageUDF

Then the UDF Script:

scn StorageUDF

float fInputWeight
float fOutputWeight

float fCurrentWeight; 
float fDepositWeight

int iSelection

int iButton


begin function {}


		set iButton to getbuttonpressed
		set fCurrentWeight to zz1OutputREF.GetInventoryWeight
		set fDepositWeight to zz1InputREF.GetInventoryWeight


		if (iButton == 0)
			;deposit
			zz1InputREF.OpenTeammateContainer 1
		endif
	
		if (iButton == 1)
			;withdraw
			zz1OutputREF.OpenTeammateContainer 1
		endif
	   
	   if (iButton == 2)
			;exit
		endif
endif

		if zz1InputREF.GetInventoryWeight != fDepositWeight
			set fDepositWeight to zz1InputREF.GetInventoryWeight
		
			if (fDepositWeight + fCurrentWeight) > zz1MaxWeight
				zz1InputREF.removeAllItems Player 1 1
				showMessage zz1VirtualTooMuch
			else
				zz1InputREF.removeAllItems zz1OutputREF 1 1
				showMessage zz1VirtualAccepted
			endif
			
		endif
end

Now, I wouldn't actually copy and paste these "sample" scripts into your own.

I gutted the script I posted yesterday for the one I posted above, there's no way of knowing if it works as put above.

Nevertheless, experiment with it! You can't have a successful night of modding without opening and reopening New Vegas to test you .esp a dozen times!

 

Okay, I go to sleep now. Maybe.

 

- Stealth Dick

Link to comment
Share on other sites

Hmmm , so no way to access inventory or container menu unless the actor/item is loaded into what is rendered ?

I kinda thought that might be the case.

 

@Radioactivelad ... So guessing with your drop box mod ... you have a container at drop box location running a script to transfer items with a "OnAdd" block ?

That then ceases to move items once the actor inventory hits the carry weight , and then return items to player ?

 

~~~~~~~~~~~~~~~~~

 

So I'm just wondering for simplicity sake ... what if the brahmin container is moved to the player location (offset z location)

 

Shrink the brahmin to very small ... flag it as immobile so it will float , or could have an invisible collision plane platform it stands on transported with it.

But probably would need more than 1 frame to get both transported , IDK possibly just having brahmin 50-100 units above the platform would be fine for 1 frame.

 

Can't remember if it is possible to use "MoveTo" on a collision plane ? If not , some static object that does not have a mesh on it's bottom side would do fine.

Also I think a disable/enable call might be needed for anything moved in order for it's collision to work?

 

But then again it might float ... I know the zaxeye from Fo3 does when flagged immobile. Err now that I think about it ... turrets do.

 

Just trying to think of a more simple method and hopefully accomplish what Amok was looking for.

 

So inside the Activate script field on the perk.

~~~~~~~~~

MyContainerRef.MoveTo PlayerRef 0 0 2000

~~~~~~~~

 

Script on the actor container

~~~~~~~~

Begin OnLoad

 

OpenTeamMateContainer

 

End

~~~~~~~~~~~~

 

But I guess needs some scripting to deal with opening the container a second time in same cell , unless no problems arise.

And don't even need to send the container back to the editor location each time ???

 

Err wait ... with this the container will open anytime the cell it is in gets loaded. So a variable reset with the Activate result script should stop that.

 

Actor / container script ...

~~~~~~~~~~~

SCN MyActorContainerScript

 

Short DoOnce

 

Begin OnLoad

 

If DoOnce == 1

OpenTeamMateContainer

Set DoOnce to 0

endif

End

~~~~~~~~~~~

Activate script field of Perk

~~~~~~~~~~~

MyActorContainerRef.MoveTo PlayerRef 0 0 2000

MyActorContainerRef.SetVariable "DoOnce", 1

Link to comment
Share on other sites

  • Recently Browsing   0 members

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