Activate, player

Post » Wed Aug 26, 2009 2:05 am

Hey,
I'm making a series of containers, and I want them to all act as one single container.
To do this, I'm making one of them a normal container (ae_bookshelf_vivec_1), and attaching this script to the others:

Begin ae_bookshelf_vivec_scriptif ( OnActivate == 1 )	"ae_bookshelf_vivec_1"->Activate, playerendifEnd


From Morrowind Scripting for Dummies:
Info from the UESP: There is an undocumented feature in the Activate function by specifying the player after the function, for example:
begin RemoteContainer   short OnPCEquip   if ( OnPCEquip == 1 )      set OnPCEquip to 0      "dh_remote_chest_01"->Activate, player   endifend


If the container is persistent (references persist) this script should open the container wherever the player is. This is a great way to create 'carryable' containers by attaching a script similar to the above to a ring or similar item.


The container (ae_bookshelf_vivec_1) is persistent, and yet whenever I activate one of the containers with the script attached, nothing happens.

Can anyone help me out here?

Thanks,

- Danjb
User avatar
sam smith
 
Posts: 3386
Joined: Sun Aug 05, 2007 3:55 am

Post » Wed Aug 26, 2009 11:58 am

The player will have to activate the real container directly each load session before it can remote-activate. Otherwise nothing will happen (known issue with activate and containers).
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Wed Aug 26, 2009 1:14 am

Gah, I wish I knew about all these "known issues" before I encountered them :(

However, I still have a problem - even if I activate the container (ae_bookshelf_vivec_1) directly, the script still doesn't work when I then activate the scripted container (ae_bookshelf_vivec_2).

Also, on a side note, could this limitation be avoided by having a script activate the container for you and then menutest when you enter the room?

---

EDIT: Found it!

From the UESP:
Note: This only works if the container is flagged as persistant AND the container is currently loaded in memory (i.e., you've activated it or somehow forced it to load within the last 72 game hours).

(Both of these conditions are true but it still doesn't work :()
User avatar
Charlotte Henderson
 
Posts: 3337
Joined: Wed Oct 11, 2006 12:37 pm

Post » Tue Aug 25, 2009 10:33 pm

I could have sworn that was in SfD. Oh well, I'll make a note...

You can't activate it by script (that's the point: it has to be manually activated by the player before it can be activated by script this load session).

Hm, not sure what the problem is...

Is the container a unique reference? If there's more than one in the gameworld it won't work properly.

Otherwise, AFAIK it should work. Maybe there's a problem with using OnActivate with it? :unsure:
User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm

Post » Wed Aug 26, 2009 7:33 am

You can't activate it by script (that's the point: it has to be manually activated by the player before it can be activated by script this load session).

Ah, that's lame...

---

The container I'm trying to activate (ae_bookshelf_vivec_1) is unique and persistent, with only one present in the gameworld.

As for the container I'm activating (ae_bookshelf_vivec_2) that's scripted to activate the OTHER container... I tried using an activator instead of a container, but it still didn't work...

I hate it when things just don't work :(

Any help on this would be MUCH appreciated (and thanks for your help so far).
User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Wed Aug 26, 2009 6:52 am

I'm making a series of containers, and I want them to all act as one single container.


There is an easier way. All copies of the same container that has reference persists have the same storage. If you make a container that has reference persists check and place two copies of that container in the same cell then anything placed into either of those containers will be accessible from either of those containers. A script checking the content of these containers will actually check the shared content of both references.

I discovered this while making Orrutus Cavern. In the alchemy lab for this mod I built two copies of the same room in the cell and moved/placed the door to each copy based on the state of the quest. In test I found that when I put an ingredient in a jar in the ruin lab I'd later be able to pull it out of the corresponding jar in the fixed lab. I tried placing multiple copies of reference persists containers in different cells but this only works when all the copies are in the same cell.
User avatar
Eliza Potter
 
Posts: 3481
Joined: Mon Mar 05, 2007 3:20 am

Post » Wed Aug 26, 2009 12:11 am

EDIT: I wrote a post of immense gratitude but then tested what you said, and I couldn't get it to work :(
This is exactly what I'm looking for, though, so if you can help me get this working that would be amazing.

Basically I'm making containers that look like books, for the purpose of storing books. I have a whole row of these on a bookshelf, but I want them all to act like the same container so you don't have to find the one book in which you placed something ;)

I've made it now so they are all the same object, which is persistent. When it came to testing it, though, I'd place something in one and it would only be there in that one copy of the container :(
User avatar
Amber Ably
 
Posts: 3372
Joined: Wed Aug 29, 2007 4:39 pm

Post » Tue Aug 25, 2009 11:27 pm

EDIT: I wrote a post of immense gratitude but then tested what you said, and I couldn't get it to work :(
This is exactly what I'm looking for, though, so if you can help me get this working that would be amazing.

Basically I'm making containers that look like books, for the purpose of storing books. I have a whole row of these on a bookshelf, but I want them all to act like the same container so you don't have to find the one book in which you placed something ;)

I've made it now so they are all the same object, which is persistent. When it came to testing it, though, I'd place something in one and it would only be there in that one copy of the container :(


That's strange I just tried it again and it's no longer working. Maybe it was a glitch in that one save game I had or my old age is catching up to me. Sorry, I guess that doesn't work & I got you all excited for nothing.
User avatar
Kaylee Campbell
 
Posts: 3463
Joined: Mon Mar 05, 2007 11:17 am

Post » Wed Aug 26, 2009 8:19 am

Well, at least it's not just me.

Don't worry about it, but if anyone comes up with a solution to this, please let me know!

As far as I can tell it should be working... has anyone ever tested using "OnActivate, Player" before?
User avatar
Victoria Bartel
 
Posts: 3325
Joined: Tue Apr 10, 2007 10:20 am

Post » Wed Aug 26, 2009 5:26 am

EDIT: I wrote a post of immense gratitude but then tested what you said, and I couldn't get it to work :(
This is exactly what I'm looking for, though, so if you can help me get this working that would be amazing.

Basically I'm making containers that look like books, for the purpose of storing books. I have a whole row of these on a bookshelf, but I want them all to act like the same container so you don't have to find the one book in which you placed something ;)

I've made it now so they are all the same object, which is persistent. When it came to testing it, though, I'd place something in one and it would only be there in that one copy of the container :(


Idea for an easier version, simply find/make a mesh of bookshelf with plenty of books on it as a single model and place that as a container?
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Wed Aug 26, 2009 11:07 am

Idea for an easier version, simply find/make a mesh of bookshelf with plenty of books on it as a single model and place that as a container?

Yeah, just I prefer using vanilla meshes on the whole, keeps things nice and simple. Plus this way I could lay out the shelves just how I wanted them, and there was storage for every single book, without leaving the player the tricky job of placing books on empty shelves, and without giving the player a library-full of free books. It was ingenious! Or so I thought...

Also, did I mention I already made 2 container objects, plus a script for every single book in the game? :(

So forgive me for asking again, but does anyone know how to make this command work? Has it ever worked?
Help would be very much appreciated - thanks! :)
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am

Post » Wed Aug 26, 2009 4:00 am

Yeah, just I prefer using vanilla meshes on the whole, keeps things nice and simple. Plus this way I could lay out the shelves just how I wanted them, and there was storage for every single book, without leaving the player the tricky job of placing books on empty shelves, and without giving the player a library-full of free books. It was ingenious! Or so I thought...

Also, did I mention I already made 2 container objects, plus a script for every single book in the game? :(

So forgive me for asking again, but does anyone know how to make this command work? Has it ever worked?
Help would be very much appreciated - thanks! :)


I'm not sure who the original mod artist was, but there is a library mod that should prevent the "free books" thing. I'm looking at using a modified version of the script to keep players from hauling off with the books in a castle I'm working on.
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Wed Aug 26, 2009 4:24 am

Yeah, I'm sure there are some workarounds, but I really want this to work since it's nice and original (I think), and I've already put a ton of work into it.

EDIT: IT WOOOOOOOOORKS!!!!

Thanks for all your help, guys. In the end I tried a whole bunch of things - having the container set off a new script when you activated it, which then used the Activate, player command, having the container try to activate an NPC, having it activate the player as soon as the player entered the room...

Nothing worked, but in the end I tried making the container activate ITSELF, using Activate, player, and that did the trick. I'm now using one container object rather than 2, with copies of it all filling up a bookshelf. As long as you activate the one in the top-left of the shelf first, the others all work how I want them to, acting as the same container.

Hope that makes sense for anyone else who decides to use this command in the future ;)
User avatar
Heather Kush
 
Posts: 3456
Joined: Tue Jun 05, 2007 10:05 pm


Return to III - Morrowind