Jump to content

[LE] player.removeItem into specified container doesn't work


Recommended Posts

hi everybody

 

context : to carry other items (scrolls potions food etcc) the player need a bag (a misc item ) in his inventory

 

the script i want to do is when player drop the bag, all filtered items in player inventory goes into a hidden chest in qasmoke

when player pick the bag, all items from the hidden chest in qasmoke come back to player inventory

 

problem : ObjectReference to the hidden chest (hiddenbag) is not working, the game don't find the reference at run time(no compile errors)

its cause items are not transfered into specified container, and losted ....

 

script code :

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

	Form playerbag = portablebag as Form
	if( akBaseItem == playerbag )	
		Debug.MessageBox("reference to the hidden bag : " + hiddenplayerbag ) ;   <----- print none !
		Int iFormIndex = ply.GetNumItems()
		While ( iFormIndex > 0 ) 
			iFormIndex -= 1
			Form kForm = ply.GetNthForm(iFormIndex)
			int typ = kForm.GetType()

			If ( typ == 30 || typ == 32 || typ == 23 || typ == 27 || typ == 46)
				ply.RemoveItem(kForm,ply.GetItemCount(kForm), true, hiddenplayerbag)
			EndIf
			
		EndWhile
	EndIf
endEvent

a picture of the creation Kit filling reference :

 

19627415h1.jpg

 

thanks for your future responses :smile:

Link to comment
Share on other sites

I suspect your problem is that the bag isn't loaded. Try going into QASmoke, opening it manually, then running your script.

 

Another option would be to add it to your quest as an alias. (However, to be honest, I was under the impression that adding to a script as an object reference had the same effect as making it an alias.)

Link to comment
Share on other sites

okay, its was on the CK who don't save filled references ....

thanks for all of your response, my mod is almost done,

 

I made something similar to what you are wanting to do a long, long time ago.

http://www.nexusmods.com/skyrim/mods/27326/?

 

i don't use your script source, but this give me nice ideas,

 

Also , someone can can tell me if i can ask for beta testers ?

if you want to test it tell me

Edited by Lexluckyluke
Link to comment
Share on other sites

  • Recently Browsing   0 members

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