Access container through NPC dialogue?

Post » Mon Jun 28, 2010 9:00 am

I'm poking around with some custom NPC's. I would like to add a dialogue option that lets me access the inventory of a container (or a non-visible NPC with unlimited carrying capacity - like a container).

I tried StorageTrunkREF.Activate Player, but the container window doesn't pop up until after I have exited dialogue with the NPC. Like:

Hey there.
A0-->Yes?
B0---->What's the word?
B1------>Nada.
C0---->I want to access your storage container.
C1------>Okay.
D0---->I have to go now.
D1------>See ya.

When I click C0 I want to access your storage container, the NPC says C1 Okay - but nothing happens. Then I say D0 I have to go now, the NPC says D1 See ya. As soon as the dialogue stops, the container window from C1 result script pops up :blink:. It's like the command is sent, but it can't be accessed while the NPC is in dialogue? As soon as the dialogue finished, bam - it appears.

The only workaroundish thing I can come up with is to tick the "goodbye" flag for C0/C1. That way it kicks me out of dialog to open the container immediately. Is there any way to not have to stop the dialogue to access a container?

I also tried setting StorageTrunkREF as the NPC's merchant container and then access with ShowBarterMenu 100 (free). But when I put something in that menu, it disappeared when I hit accept. I opened the container manually and those items where in it :wacko: . A downside to this way is that they use dialogue from merchants when I talk to them. Like when I close the barter menu, they say" A pleasure doing business with you".

I was thinking I could make another NPC that is never visible which had an unlimited carry weight capacity and then use NPCContainerREF.OpenTeammateContainer 1 from within the original NPC's dialogue, but I can't figure out how to set the carry capacity to unlimited (like a container 0/0) for a NPC. I don't want to use OpenTeammateContainer on the original NPC because I don't want them equipping anything I put in there.

Looking for some suggestions.
User avatar
Averielle Garcia
 
Posts: 3491
Joined: Fri Aug 24, 2007 3:41 pm

Post » Mon Jun 28, 2010 8:22 am

I do something like this in Phalanx.

On followers, you have "Let's trade equipment that you are using" and "Let's trade equipment that you are carrying, but not using." The followers do not use the items in the second trade option, they just seem to be dragging them around.

I have a cell set up which the player never, ever enters. He must not enter it, the containers will in fact reset if he does and delete the items.

There's NPCs sitting in there, like MalcolmStorageREF and DeishaStorageREF, and so on.

In the dialogue option for accessing the carried stuff, the result script does something like this:

setplayerteammate MalcolmStorageREF
MalcolmStorageREF.openteammatecontainer
(I don't recall if this is the exact syntax)

In the event of a follower permanent death, you have to arrange for the items in the storage container to be dumped onto the main corpse.

One of the reasons I used an NPC as the storage is because they do NOT have unlimited carrying capacity, though.
User avatar
Erika Ellsworth
 
Posts: 3333
Joined: Sat Jan 06, 2007 5:52 am

Post » Mon Jun 28, 2010 5:38 am

I'm poking around with some custom NPC's. I would like to add a dialogue option that lets me access the inventory of a container (or a non-visible NPC with unlimited carrying capacity - like a container).

I tried StorageTrunkREF.Activate Player, but the container window doesn't pop up until after I have exited dialogue with the NPC. Like:

Hey there.
A0-->Yes?
B0---->What's the word?
B1------>Nada.
C0---->I want to access your storage container.
C1------>Okay.
D0---->I have to go now.
D1------>See ya.

When I click C0 I want to access your storage container, the NPC says C1 Okay - but nothing happens. Then I say D0 I have to go now, the NPC says D1 See ya. As soon as the dialogue stops, the container window from C1 result script pops up :blink:. It's like the command is sent, but it can't be accessed while the NPC is in dialogue? As soon as the dialogue finished, bam - it appears.

The only workaroundish thing I can come up with is to tick the "goodbye" flag for C0/C1. That way it kicks me out of dialog to open the container immediately. Is there any way to not have to stop the dialogue to access a container?


I have a similar setup for one of my NPCs. In the 'C1' response, I have the MyNPCLockerREF.Activate Player in the Result script (begin). The locker opens at the same time it voices 'okay'. I have no other flags set - goodbye, etc. The locker is placed in a dummy cell with a persistent reference and no ownership. I think i've always had problems when putting the script in the Result Script (End). Is this your case?

If the container is an NPC, you can use MyNPCBackPackREF.OpenTeamMateContainer 1 to bypass it having to be a teammate. If you use this command, it will also have a weight limit dependent on it's stats. If you add items through script, there is no weight limit. One annoying thing is that it will equip weapons and armor that you store in it, and appear to have the 'multiple weapon equipped' glitch. You can bypass this by giving it zero health and clicking the 'quest item' flag (so the dead body doesn't get removed). It will still equip armor that you store in it, but it won't be glitched. You could probably use a creature like a Robot and bypass the equipping thing. You could use the SetAV Carryweight 1000 or some other large value on the NPC - not sure if there is a limit to this or if it even works - haven't tried it yet.
User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Post » Mon Jun 28, 2010 8:36 am

If the container is an NPC, you can use MyNPCBackPackREF.OpenTeamMateContainer 1 to bypass it having to be a teammate
That's pretty handy, I wasn't aware of it.
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Mon Jun 28, 2010 12:02 am

You could probably use a creature like a Robot and bypass the equipping thing.


Mine are all Mister Gutsys.

I set their strength to 3 to try to enforce a sorta lowish limit on carried items. Setting the strength to 10 would allow more. If someone wants no limit at all, I do not really know how to do it and haven't looked into it.
User avatar
suniti
 
Posts: 3176
Joined: Mon Sep 25, 2006 4:22 pm

Post » Mon Jun 28, 2010 4:28 am

If it's true that adding items to an actor with a script ignores the actors carry weight you could use a normal container and call ContRef.Removeallitems NPCref, before calling NPCref.openteammatecontainer. Then move the items back to the ContRef at the end of the conversation.
User avatar
Samantha Wood
 
Posts: 3286
Joined: Sun Oct 15, 2006 5:03 am

Post » Mon Jun 28, 2010 4:41 am

@RickerHK:
I had tried both the Begin and End result scripts, it did the same thing. You mentioned that you use a locker and a light bulb popped up - perhaps it's the containers nif? So I started trying other models and sure enough, it was. Originally I was using Clutter\Chest\SteamerTrunk01.NIF which didn't work. When I changed it to Clutter\GarbageCan\GarbageCanUrban01.NIF, it worked just fine. I think it has something to do with the container having open/close animations. Like the animations won't play until the dialogue has stopped and the container can't be accessed until the animations play. It's the only reason I can think of.

@Tarrant:
I didn't really want to use an NPC for the container unless I had to. A last resort since I don't have a good understanding of the stats and what not. But you did shine a light on something I overlooked: dumping the contents of the container onto the dead NPC. I never thought about their death. That would have svcked big time to have everything I gave them be inaccessible. :thumbsup:

@b3w4r3:
Thanks for the tip, but - that made my brain smoke.

Ah, the trips to the brink of madness... it's such a relief when the trip is over. :)

Thanks a ton fellas.
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Mon Jun 28, 2010 8:32 am

One more thing :)

I was thinking of putting some Find packages on the NPC so that once a week or so she'll go out scavenging with a huge radius. Is there any way to force what she finds/picks up to be placed in the container instead of her inventory? Kind of like what Dogmeat does when you tell him to. But dogmeat doesn't have armor/guns/ammo/etc., so he just gives the player everything in his inventory. If the NPC does that, they'll be armorless/weaponless/etc.

IE: Dogmeat does this when he returns with a found item:
dogmeatref.removeallitems player

All I'd need to do there is change it to (if I end up having them dump it all on the player):
StorageTrunkREF.removeallitems playerset Find to 0; [package condition]

But how to get the NPC to add found items to StorageTrunkREF? I'm assuming that it's done with a script on the NPC, like:
short numItemsFoundshort FindBEGIN OnAdd	if (Find == 1); i'm searching for items [package condition]				if (GetActionRef != Player); the player gave me this item, it doesn't count			; add this item to the container instead of my inventory			MISSING CODE HERE <--------						set numItemsFound to (numItemsFound + 1)			if (numItemsFound == 10); i've found enough items				set Find to 2; i'm done searching, return to player or initial position (haven't decided yet;P) [package condition]			endif					endif			endifEND

Might have to make a second container they use while scavenging and then once their done, have them put it all into StorageTrunkREF?
ScavengeTrunkREF.RemoveAllItems StorageTrunkREFset Find to 0; [package condition]

Thanks.
User avatar
Mélida Brunet
 
Posts: 3440
Joined: Thu Mar 29, 2007 2:45 am

Post » Sun Jun 27, 2010 10:48 pm

Wondering if just before having the NPC scavenge you have all their items they're currently equipping or in their inventory copied to a say NCPEquippedContainerREF. Then after the NPC gets back from their gathering and gives all the items to the player, it checks the NPCEquippedContainerRef, moves them all to the NPC and equips what was previously equipped. (only thing is the items the NPC will equip will be at full health. For the player I could understand if that was an issue, but for NPC's I don't believe their equipment get's damaged anyhow, so it wouldn't really matter.

Good Luck :)

-Mush-
User avatar
Terry
 
Posts: 3368
Joined: Mon Jul 09, 2007 1:21 am

Post » Sun Jun 27, 2010 11:59 pm

Something like that would probably work, but I'm unsure of the exact code needed. :confused:

I'm going to keep poking around and see what I can come up with.
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm


Return to Fallout 3