noobax Posted June 23, 2010 Share Posted June 23, 2010 What is the script command to open a container? example if i want to open containerARef then what do i type into the script to open containerARef? Thanks to anyone who helps please help thanks Link to comment Share on other sites More sharing options...
kartman314 Posted June 23, 2010 Share Posted June 23, 2010 I'm not a pro and I have only moderatly used scripts, but i think the commands you are looking for would be along the lines of showinventory, additem and removeitem. Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted June 23, 2010 Share Posted June 23, 2010 Do you mean open, as in look at the inventory and swap back and forth, or open, as in unlock? For the first, it depends what the container is and what you want to do (NPCs can be containers, for instance). For the 2nd, it's just ContainerARef.unlock. Link to comment Share on other sites More sharing options...
rickerhk Posted June 23, 2010 Share Posted June 23, 2010 containerARef.activate player will open it for the player to see the contents. If it's locked, you might have to do a containerARef.unlock first. I'm using this in a mod I'm working on, but haven't tried it with a locked container. I think also there are some containers that this doesn't work because the way they animate. It works on Footlockers, which is good enough for me at the moment. For an NPC, NPCRef.OpenTeamMateContainer 1 will open their container regardless if they're a teammate or not. Link to comment Share on other sites More sharing options...
Cipscis Posted June 24, 2010 Share Posted June 24, 2010 One note on using Activate to open a container via script - if the container is in a remote cell, then it probably won't work correctly. If you're trying to access a remote container, I recommend moving it to the same cell as the player first. If I remember correctly, disabling the container first won't affect your ability to activate it via script. @kartman314:ShowInventory is a console only function. If you try to use it in a script, your script won't compile. Cipscis Link to comment Share on other sites More sharing options...
BadPenney Posted June 24, 2010 Share Posted June 24, 2010 One note on using Activate to open a container via script - if the container is in a remote cell, then it probably won't work correctly. If you're trying to access a remote container, I recommend moving it to the same cell as the player first.Are you saying that a script would perform more reliably if it moves a remote container to the same cell as the player (perhaps out of sight), unlocks it with Activate. and then moves the container back to its original location in order to give the appearance that the player's actions opens a container in a distant location? Link to comment Share on other sites More sharing options...
Cipscis Posted June 24, 2010 Share Posted June 24, 2010 If the container is disabled, then you can just move it to the player whenever you want to activate it without having to worry about returning it to some remote cell afterwards. Come to think of it, making the container a persistent reference might be a way to get around this issue, as it would always be loaded in memory. Cipscis Link to comment Share on other sites More sharing options...
kartman314 Posted June 24, 2010 Share Posted June 24, 2010 @CipscisHAHAHA That would probally be part of the reason why none of my attempts at scripting worked. :( Link to comment Share on other sites More sharing options...
rickerhk Posted June 24, 2010 Share Posted June 24, 2010 Come to think of it, making the container a persistent reference might be a way to get around this issue, as it would always be loaded in memory. Cipscis Yes - this is the way I'm doing it. I activate Player through quest script or dialog result script. Playtesting over several months and it hasn't failed once. I use the OpenTeammateContainer 1 on a dead NPC in another cell too, and it works just fine with the added benefit of enforcing the carryweight limit. I use this NPC as a backpack and forceAV the carryweight to whatever I want. Link to comment Share on other sites More sharing options...
Recommended Posts