Jump to content

NEED A PRO MODDER'S HELP!!!


noobax

Recommended Posts

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

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

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

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

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

 

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

  • Recently Browsing   0 members

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