Jump to content

Proper use of RemoveAllItems - for quest mod


csbx

Recommended Posts

For the mod I'm building I will be removing all items from the player akin to how the jail system in vanilla operates. I have a few questions I hope at least one of you can help with.

 

1) Is RemoveAllItems the best way of going about this ?

2) If you use abRemoveQuestItems = True, I'm presuming this uses dummy quest objects for the chest and simply makes your quest items in inventory invisible. Is that correct ? If so, how do you get those quest items back ? Simply by moving them back from the chest to the player (or having them grab them in game) ?

3) Does abRemoveQuestItems = True adequately prevent the breaking of quests associated with those aliases ?

4) What is at risk of breaking if I use RemoveAllItems ? I noticed that the mod '5 o'clock shadow' - a shaving mod - uses a misc. object in the inventory (a razor) which when clicked, runs its scripts. Could forcing the removal of such an item result in it no longer functioning even if the player later retrieves it ?

 

I hate to bombard with q's - but I'm just not finding a lot of documentation.

Edited by csbx
Link to comment
Share on other sites

RemoveAllItems never removes quest items, no matter how you set that flag they are still available to the player. If you really want to remove all items, it's not doing to do what you want. But RemoveAllItems will remove any tokens used by other mods. If they haven't somehow made provisions for that then it may break the other mod, but that's a fault on their part.

 

If you really want to remove all items then you'll either need to use SKSE to transfer the quest items or you'll need to create a custom crime faction and configure it to do what you want. If your location where the player needs to be kept from accessing quest items is in multiple cells you'll need special crime factions for each cell and you'll have to use the SendPlayerToJail functions to enter each location. If you use crime factions you'll also need to make sure there aren't any beds for the player to activate to avoid the serving time message or you've have to do some crazy scripting to allow sleeping. With the SKSE option you just need to make sure you return the player's gear at some appropriate point.

 

Your other option is to deny access to the player's inventory or force the player to equip specific items preventing the use of any quest related items.

 

If anyone knows of a way to trigger the hiding of quest items outside of the jail function I would love to hear it.

Link to comment
Share on other sites

Thanks for your time--I appreciate it.

 

I obviously am way out of my depth here, so it may take me a while to get it. Are you saying that the method skyrim uses to remove items for the jail function (which as you point out hides quest items) can't be accessed via papyrus without the other aspects of the jail function ? I thought the jail function used the removeallitems. Well that just made things more challenging..

 

If I commit a crime, get sent to jail, I lose all my inventory including quest items. If I now COC to another cell, I presumably still don't have my inventory and now I can sleep in beds in the world outside of the prison function (?). Why does this approach not work ? I'd obviously use moveto instead of coc.

 

Another approach. Store the names of each quest item, then make all quest items names [empty]. Items without names don't show in inventory, do they ? Then when returning inventory, simply rename those items. [EDIT: it looks like renaming via papyrus isn't possible..]

 

I wanted to avoid SKSE (for max compatibility and also because I'm not a programmer) but this may be my motivating factor..

Edited by csbx
Link to comment
Share on other sites

The reason is largely because Bethesda wants us all to be wearing a bib. I think we should be allowed to throw quest items into the Sea of Ghosts if we want to.

 

But also, as discussed above, the jail function allows you to at least appear like you don't have anything in your inventory--including quest items. So Bethesda has a reason to do this. So do I. I just might have to be more crafty about getting it done.

 

To be clear, the scenario I'm using it in is a closed system: at some point in my quest you'll be trapped in a series of cells that I have made. For much of the duration I need the player to have no weapons, potions etc.--so I'll be removing them. At the end of this, before re-entering the world (presuming the player manages to escape..) the player will have their inventory returned.

 

But I take your point--I won't be doing anything that will destroy quests.

 

  On 4/12/2016 at 9:56 AM, NexusComa said:

Pretty sure you can't drop Quest items for a reason ...

Link to comment
Share on other sites

I had to do something like that in a recent mod and i just went ahead with removeallitems because i wasn't fully sure how to setup the jail faction and removeallitems is pretty quick.

In my opinion the chance of the player having a quest weapon are low so in almost all situations you are going to leave the player without weapons, armor potions etc.

Link to comment
Share on other sites

You're right--the chance is fairly low that they'll have a quest weapon. So that takes care of most of the problem. The main reason I'd still pursue a better solution is because the player having anything in their inventory doesn't make sense in the context of the story I'm telling via the quest. Having them open their inventory to see 'Wylandriah's spoon' still tucked safely in their pockies loses me serious immersion points !

 

Still. I'll use removeallitems until I find something better.

 

Thanks FrankFamily.

 

 

  On 4/12/2016 at 7:23 PM, FrankFamily said:

I had to do something like that in a recent mod and i just went ahead with removeallitems because i wasn't fully sure how to setup the jail faction and removeallitems is pretty quick.

In my opinion the chance of the player having a quest weapon are low so in almost all situations you are going to leave the player without weapons, armor potions etc.

Edited by csbx
Link to comment
Share on other sites

I would just create the mod using RemoveAllItems and then add a little SKSE code that will also transfer any quest items. I haven't compiled or tested this but I think this is the code to do the job. People using SKSE will have the full, immersive experience. People not using SKSE will have quest items in their inventory.

Actor Property PlayerRef Auto
ObjectReference Property TheHoldingContainer Auto

Function TakePlayerItems()
	TransferAllItems(PlayerRef, TheHoldingContainer)
EndFunction

Function ReturnPlayerItems()
	TransferAllItems(TheHoldingContainer, PlayerRef)
EndFunction

Function TransferAllItems(ObjectReference srcContainer, ObjectReference dstContainer)
	if srcContainer && dstContainer ; both must be filled!
		srcContainer.RemoveAllItems(dstContainer)
		int i = srcContainer.GetNumItems()  ; this SKSE function returns 0 if SKSE isn't installed
		while i > 0
			i -= 1
			Form item = srcContainer.GetNthForm(i)
			srcContainer.RemoveItem(item, srcContainer.GetItemCount(item), true, dstContainer)
		endwhile
	endif
EndFunction

If you don't want to rely on SKSE, I think it's still not that hard to do.

 

I haven't tried it myself, but I think you can just create a custom crime faction with no members, and use its SendPlayerToJail to both empty the player's inventory (including hiding the quest items), give the player a new custom outfit (including the possibility of being naked), and do the initial teleport to the quest's starting location. When the player changes cells (or maybe it's locations) quest items get "returned" automatically and if the player tries to use any bed you get the pop-up about serving time.

 

If you don't need to let the player sleep, you can simply create a similar crime faction for each of your doors between cells and then call the appropriate SendPlayerToJail when the player tries to activate those doors. For these extra crime factions you would use the option to send the player to jail without removing inventory items. If you need the player to be able to sleep you can probably add a script to an activator that looks like a bed and have it clear the crime, remotely activate a bed to trigger the sleep menu, then reset the crime status and move the player back into position.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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