Jump to content

Removing the notifications from RemoveAllItems used on player


DiodeLadder

Recommended Posts

Hey mate, sorry to hear you're still looking for a solution :/

 

My idea this week (lol)

- Do you have to use Removeallitems?

Can you instead setup an invisible/hidden trade menu and trade away all the player items?

I don't know what the script would look like but the dump all junk workshop function might be usable here if you gave every item in the player inventory an isJunk keyword :)

Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

I would try something like this. I believe DropFirstObject doesn't display any message.

 

Function RemoveAllItemsSilent()
	Objectreference droppedobj = none
	while (PlayerRef.GetItemCount(none) > 0)
		droppedobj = PlayerRef.DropFirstObject()
		if (droppedobj != none)
			YourContainerRef.AddItem(droppedobj)
		endif
	endWhile
endFunction
Link to comment
Share on other sites

Hey mate, sorry to hear you're still looking for a solution :/

 

My idea this week (lol)

- Do you have to use Removeallitems?

Can you instead setup an invisible/hidden trade menu and trade away all the player items?

I don't know what the script would look like but the dump all junk workshop function might be usable here if you gave every item in the player inventory an isJunk keyword :smile:

 

Thank you SandMouse, for sticking around and stepping in once again! That is a little above my skill level to implement, however... I suppose I need to create a hidden dummy NPC to bring up a barter menu, and use him/her as a container?

 

I would try something like this. I believe DropFirstObject doesn't display any message.

 

Function RemoveAllItemsSilent()
	Objectreference droppedobj = none
	while (PlayerRef.GetItemCount(none) > 0)
		droppedobj = PlayerRef.DropFirstObject()
		if (droppedobj != none)
			YourContainerRef.AddItem(droppedobj)
		endif
	endWhile
endFunction

 

Thank you very much Reneer, for taking time to even write a code example for me. As a beginner at scripting, I really appreciate this!

 

After trying this, though, I discovered that this will still pop up notifications, and it takes some time for player's items to get removed... I could actually see the items getting removed in real time by opening Pip-Boy, and it took about 10 seconds before player armor/clothing was removed. The time it takes is a problem in my situation because, when the player spawns inside the jail cell, he/she has to be without any clothes on right at that moment (which I actually can do with RemoveAllItems). Another thing is that, I do not know how to avoid quest items in this while loop, and the script seemed to get stuck eventually because it never reaches zero item condition (UI slowed way down at that point).

 

:wallbash:

 

BTW, SendPlayerToJail function definitely is missing the item removal part in FO4 - I couldn't get it to work no matter what I tried.

 

Anyway, after putting in navmesh, placing enemies, and play testing, I found that in this quest, if the player fails all skill checks and has to explore the even deeper part of dungeon to escape, the item removal notifications would actually finish before recovering all the items (thank god). Maybe I'll just create more eye candies or fights to distract the player, and cross my fingers that the notifications won't bother anyone, lol.

 

Thanks again guys, for all your help. :D I think I'm going to move on now.

Link to comment
Share on other sites

Maybe this:

Function RemoveAllItemsSilent(ObjectReference akActorRef, ObjectReference DestContainerRef)
	Bool RunLoop = True
	While(RunLoop)
		ObjectReference DroppedRef = akActorRef.DropFirstObject()
		if(DroppedRef)
			DestContainerRef.AddItem(DroppedRef)
			Form DroppedBaseObject = DroppedRef.GetBaseObject()
			Int BaseObjectCount = akActorRef.GetItemCount(DroppedBaseObject)
			If(BaseObjectCount > 0)
				akActorRef.RemoveItem(akItemToRemove = DroppedBaseObject, aiCount = BaseObjectCount, abSilent = True, akOtherContainer = DestContainerRef)
			EndIf
		Else
			RunLoop = False
		EndIf
	EndWhile
EndFunction
Link to comment
Share on other sites

I forgot to put a sanity check in the code, so if it never reaches zero items it, as written, would loop endlessly. Sorry we couldn't find a working solution for you. :sad:

 

Not knowing how to avoid quest items was entirely my fault, though, and I hope my wording didn't come across like I was blaming you or anything. I really appreciate your help, Reneer. :D

 

Another dream dies at the roadside of scripting tool limitations.

 

But it's fun trying ....

 

LOL, I know you push limits with your mods, but my problem really should be a pretty basic stuff. The weird thing is - the quest idea I'm trying to put together is directly influenced by the quest events from Skyrim, a Bethesda game. In my quest, the player goes to sleep in the new strangely clean player home acquired for free, and finds out why it was free when he/she wakes up in a jail cell, kidnapped and all belongings stolen - this is not something that would be out of place in a Bethesda game, is it? I thought this thread would end in a couple of posts of very obvious solutions suggested and me smacking my forehead, to be honest, lol.

 

 

Maybe this:

Function RemoveAllItemsSilent(ObjectReference akActorRef, ObjectReference DestContainerRef)
	Bool RunLoop = True
	While(RunLoop)
		ObjectReference DroppedRef = akActorRef.DropFirstObject()
		if(DroppedRef)
			DestContainerRef.AddItem(DroppedRef)
			Form DroppedBaseObject = DroppedRef.GetBaseObject()
			Int BaseObjectCount = akActorRef.GetItemCount(DroppedBaseObject)
			If(BaseObjectCount > 0)
				akActorRef.RemoveItem(akItemToRemove = DroppedBaseObject, aiCount = BaseObjectCount, abSilent = True, akOtherContainer = DestContainerRef)
			EndIf
		Else
			RunLoop = False
		EndIf
	EndWhile
EndFunction

 

DieFeM, thank you very much for taking time to do this for me! I'm going to try this over the weekend, and will let you know how it goes.

 

How this script works is over my head, though... I think I have to do some homework and come back with questions. :tongue:

 

 

Thank you very much again guys for all your help! :D

Edited by DiodeLadder
Link to comment
Share on other sites

The way the function works is like this:

 

Step 1. One object is dropped - the first object.

Step 2. The dropped object is added to a container.

Step 3. The base object of said dropped object is assigned to a variable.

Step 4. GetItemCount looks for how many objects match the base object of the object just dropped, this total is assigned to a variable.

Step 5. If the total of the objects found, which match the base object is greater than 0, they are removed silently from the player, and sent to the container from step 2.

 

The loop will continue until no more of that object is found in the inventory.

 

Nice. I'll bookmark this for future reference.

Link to comment
Share on other sites

Rasikko, DieFeM, thank you VERY MUCH for going over this script for me - now I can understand it!! It's brilliant. This was a great lesson in scripting for sure, and I really appreciate you sharing your knowledge. :thumbsup:

 

However (sorry...), the limitations of DropFirstObject itself still play in this one - 1) it is very slow, 2) and it still shows notifications. Another thing is, it removes literally everything including quest items, and that also means it removes Pip-Boy. Unfortunately, I can't use this one. :sad:

 

In search of another solution, I've messed around with toggling different HUD modes to see if that would clear the remaining notifications, but that didn't work, either.

 

RemoveAllItems still seems to be the best solution. I think I'll just tell the users the long stream of notifications is a FO4 limitation, and move on.

 

It maybe a strange thing to say, but this problem not having a solution made me appreciate the resourcefulness of you guys even more, because I got to see you approaching the problem from different angles. You guys are awesome! Thank you all very much for your help. :smile: :smile:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...