Pickable container

Post » Wed Jun 29, 2016 10:49 pm

Hello,


I would like to ask if following this is possible to do without using MWSE. Basically I would like to make portable container. I created misc item that can be picked. And when placed into the world, I would like it to transform to container. I can simply create new instance of the container in the world and delete the instance of misc item, but problem is placing the container to the same spot where the misc item was.



Begin misc_item_scpt

short OnPCDrop
short myX
short myY
short myZ

if (GetDisabled )
setdelete 1
endif

if ( OnPCDrop )
set myX to GetPos, X
set myY to GetPos, Y
set myZ to GetPos, Z
set OnPCDrop to 0
PlaceAtPc "my_container" 1,0,0
Disable
endif

End

This is what I have.



So is it possible with only vanilla scripting? It is also necessarry to point out that there might be multiple instances of the misc item and multiple instances of the container.



Any help would be highly appreciated :)

User avatar
Robert Garcia
 
Posts: 3323
Joined: Thu Oct 11, 2007 5:26 pm

Post » Wed Jun 29, 2016 1:35 pm

not sure, but I think if you want the contents to remain the same, then you need unique ids, and you would disable when picking up, and moving it to the player when they drop the item. Otherwise you are just creating new instanced ids each time.
User avatar
Lewis Morel
 
Posts: 3431
Joined: Thu Aug 16, 2007 7:40 pm

Post » Wed Jun 29, 2016 7:46 pm

You want to use the PlaceAtMe function rather than PlaceAtPC is all. I've done this for all the portable containers in The Tea Mod, and yeah you have to remove the contents before moving them or you lose your stuff because they're for placing in a player home, not for carrying loot. The latter requires unique IDs and special scripting, so it limits the amount of containers you can make.

User avatar
Penny Courture
 
Posts: 3438
Joined: Sat Dec 23, 2006 11:59 pm

Post » Thu Jun 30, 2016 2:29 am

Thanks a lot! Totally forgot there is PlaceAtMe function... these I-shoud-get-more-sleep moments are becoming more and more common with me :D



Yeah, I'm aware of the contents issue, but that is okay for my purpose :)

User avatar
Ricky Rayner
 
Posts: 3339
Joined: Fri Jul 13, 2007 2:13 am


Return to III - Morrowind