Jump to content

How to set storage limit on container


amokrun1

Recommended Posts

@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 ?

No, the container itself (In my mod's case, the Mojave Express Dropboxes) is just a proxy activator. Items are transferred with the standard trade interface.

 

 

This is the script from my mod with commentary:

 

-------------------------------

 

 

- Object Script placed on the Mojave Express Dropbox. -

 

 

Begin OnActivate Player

 

--------------------------------------

 

If IsActionRef Player && Player.hasperk MESPerkDiscount ==0 && Player.Getitemcount F >= 100

; The Activator is the player, they have not earned the Service Discount, and they have enough caps to cover the Service Charge.

 

Playsound DRSNukaColaMachineOpen 1

; Aesthetic sound effect

 

MESJeffery.openteammatecontainer 1

; Access the free-trade inventory of the NPC we're using to store items.

 

Player.removeitem f 100

; Removes 100 Caps from the player.

 

 

IncrementScriptedChallenge MESDiscountChallenge

; Increase the Challenge that rewards the player with the Service Discount

 

--------------------------------------

elseIf IsActionRef Player && Player.hasperk MESPerkDiscount ==0 && Player.Getitemcount F < 100

; The Activator is the player, the player has not earned the Service Discount, and does not have enough caps to cover the Service Charge.

 

showmessage MESNotEnough

;"You don't have enough caps."

 

---------------------------------------

 

elseIf IsActionRef Player && Player.hasperk MESPerkDiscount ==1 && Player.Getitemcount F >= 50

; The Activator is the player, The player has earned the Service Discount, and has the caps to cover the Service Charge.

 

Playsound DRSNukaColaMachineOpen 1

; Aesthetic sound effect.

 

MESJeffery.openteammatecontainer 1

; Access the free-trade inventory of the NPC we're using to store items.

 

Player.removeitem f 50

; Remove 50 caps from the player. (50% discount.)

 

------------------------------------------

 

elseIf IsActionRef Player && Player.hasperk MESPerkDiscount ==1 && Player.Getitemcount F < 50

; The Activator is the player, the player has earned the Service Discount, and does not have the caps to cover the Service Charge.

 

showmessage MESNotEnough

; "You Don't have enough caps."

 

endif

 

end

Edited by Radioactivelad
Link to comment
Share on other sites

Thanks both for the input, I am learning a lot! I checked this post a little late so too tired to try now but I will with the above tomorrow for sure.

 

As for activate on the brahmin, it seems I cannot do this with an NPC. Hmm, this is all a lot more involved than I thought. I figured there would be simpler way of making a container behave like a companion inventory, guess not.

Link to comment
Share on other sites

So I used Stealth Dick's script and changed it with my own variables. I placed some brahmin in the cell but the script won't save with the brahmin in the script as it is. Here is the script:

 

scn CWStorage
float fInputWeight
float fOutputWeight
float fCurrentWeight;
float fDepositWeight
int iSelection
int iButton
begin function {}
set iButton to getbuttonpressed
set fCurrentWeight to CWBrahminMush.GetInventoryWeight
set fDepositWeight to CWBrahminDep.GetInventoryWeight
if (iButton == 0)
;deposit
CWBrahminDep.OpenTeammateContainer 1
endif
if (iButton == 1)
;withdraw
CWBrahminMush.OpenTeammateContainer 1
endif
if (iButton == 2)
;exit
endif
if CWBrahminDep.GetInventoryWeight != fDepositWeight
set fDepositWeight to CWBrahminDep.GetInventoryWeight
if (fDepositWeight + fCurrentWeight) > 200
CWBrahminDep.removeAllItems Player 1 1
showMessage CWTooMuch
else
CWBrahminDep.removeAllItems CWBrahminMush 1 1
showMessage CWAccepted
endif
endif
end
CWBrahminDep and Mush are Creature records, not sure if that's relevant.
Link to comment
Share on other sites

Ya the only reason you would place a brahmin ... is so you could name and call the Ref-ID

Otherwise something like PlaceAtMe would work.

I wish I understood Stealthdick's script ... but I don't

Link to comment
Share on other sites

 

@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 ?

No, the container itself (In my mod's case, the Mojave Express Dropboxes) is just a proxy activator. Items are transferred with the standard trade interface.

 

 

I went to look at your mod cuz I wasn't exactly clear what you were saying about the Player being the Activator.

And I guess this is not your mod ? https://www.nexusmods.com/newvegas/mods/72855?tab=description

Seeing how there is no .esp

What's the name of yours exactly ? Or is it not hosted on the Nexus ?

 

But anyways ... you are not saying the Player is the activator item , as in what this block type says https://geckwiki.com/index.php?title=OnNPCActivate

 

Which maybe the description on that is just wrong ? And it means activated by the NPC ?

So then to clarify what I am getting at ... is you have an actual "Activator" reference item in the same cell as the player when they activate it ?

 

Hence Amoks problem being the Terminal will not act like a scripted activator with only the Activate Entry Point result script ?

Link to comment
Share on other sites

Is the brahmin you're interacting with a Persistent Reference?

 

I don't think you can call teammatecontainer on a base object either; it needs to be an individual reference.

It is indeed a persistent reference. And by individual reference, do you mean I need to make a new one, like a new NPC with its own editor ID? If so, I believe that's what I did.

Edited by amokrun1
Link to comment
Share on other sites

 

Is the brahmin you're interacting with a Persistent Reference?

 

I don't think you can call teammatecontainer on a base object either; it needs to be an individual reference.

It is indeed a persistent reference. And by individual reference, do you mean I need to make a new one, like a new NPC with its own editor ID? If so, I believe that's what I did.

 

 

Yes you need to create a unique base-id of the actor , NOT using one from vanilla.

But the reference being persistent ... is specific to when you drop that base-id into the render window , then click it to bring up its "Reference" window.

And sounds like you are doing that since "Persistent" is only available there.

 

But ... did you fill in the Ref-ID on the ref object.

If this is the name of the base object "CWBrahminDep"

Then typically people name the Ref Object this "CWBrahminDepRef"

And that is what you need call in the script.

 

Otherwise you use the number/letter combo {form-ID} next to the ref-id field.

Link to comment
Share on other sites

One thing to note about saving scripts ... had you created something while the script is open , or even named a Ref. The new change/item will not be known to the script when you try to save it.

So what ever need be saved into a script / result script. Needs to exist before opening it.

 

And a good idea to save the file periodically , especially after creating items that you are then going to call in a script , which need to save prior to opening the script since no saving can be done when open , or any extracurricular windows for that matter.

The reason to save often , is because while using the geck making changes , there is a temp storage like a balloon . And eventually it will burst.

Just a mention incase you didn't know .

Link to comment
Share on other sites

So I gave a ref ID like you suggested with the REF tag, script saved well. Message pops up at terminal like expected, but the message options lead nowhere. Deposit Withdraw Exit are the choices, and all of them simply exit the activate menu. As per the script, deposit(0) should open the deposit brahmin inventory while withdraw(1) should open the other. Not sure what I'm doing wrong.

 

Here is the script once again:

 

scn CWStorage

 

float fInputWeight

float fOutputWeight

 

float fCurrentWeight;

float fDepositWeight

 

int iSelection

 

int iButton

 

 

begin function {}

 

 

set iButton to getbuttonpressed

set fCurrentWeight to CWBrahminMushREF.GetInventoryWeight

set fDepositWeight to CWBrahminDepREF.GetInventoryWeight

 

 

if (iButton == 0)

;deposit

CWBrahminDepREF.OpenTeammateContainer 1

endif

 

if (iButton == 1)

;withdraw

CWBrahminMushREF.OpenTeammateContainer 1

endif

 

if (iButton == 2)

;exit

endif

 

 

if CWBrahminDepREF.GetInventoryWeight != fDepositWeight

set fDepositWeight to CWBrahminDepREF.GetInventoryWeight

 

if (fDepositWeight + fCurrentWeight) > 200

CWBrahminDepREF.removeAllItems Player 1 1

showMessage CWTooMuch

else

CWBrahminDepREF.removeAllItems CWBrahminMushREF 1 1

showMessage CWAccepted

endif

 

endif

end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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