check if item is a quest item?

Post » Sun Nov 18, 2012 12:27 pm

RemoveItem() removes an item whether it is a quest item or not. Is there a way to check for a 'quest flag' on an item?

Failing that, what happens when a quest item is removed to a container? Will the quest bomb, or be suspended at the part where the quest item is needed, until it is retrieved by the player?
User avatar
Alexander Lee
 
Posts: 3481
Joined: Sun Nov 04, 2007 9:30 pm

Post » Mon Nov 19, 2012 12:33 am

There's not really any such thing as a Quest Item.

Only an Item that is assigned as an Alias in a Quest.

So, it depends what you are trying to do? You could check every single Alias in every single quest, to see whether an object is an alias in one of them ... but that's not a good idea at all.

Maybe someone else here knows a better way?


And you can't "drop" a Quest Object ... the game won't let the player do that ... but there is a scripted work-around to allow "Quest Items" to be dropped ... sort of: http://www.creationkit.com/Complete_Example_Scripts#A_Quest_item_you_can_drop_and_pick_up_again_and_set_or_reset_objectives_and_Stages.
User avatar
Riky Carrasco
 
Posts: 3429
Joined: Tue Nov 06, 2007 12:17 am

Post » Sun Nov 18, 2012 2:41 pm

And you can't "drop" a Quest Object ... the game won't let the player do that ...


Not the player, my script. Let's say I did

Game.GetPlayer().RemoveAllItems(akTransferTo = mycontainer, abKeepOwnership = true, abRemoveQuestItems = true)

would the 'quest item' and the quest the item is attached to, be safe until the player retrieved the items? I'm wondering if the quest that needs the item will crash if the player tries to advance the quest without the quest item.


Edit:

Scratch that. abRemoveQuestItems = true seems not to work. But this code (using SKSE) definitely does:

myTotalItemCount = akCaster.GetNumItems()while (myTotalItemCount > 0)         myTotalItemCount = myTotalItemCount - 1     myForm = akCaster.GetNthForm(myTotalItemCount)                       if !akCaster.IsEquipped(myForm)                                 myFormCount = akCaster.GetItemCount(myForm)          akCaster.RemoveItem(myForm, myFormCount, true, mycontainer)     endifendwhile


Removes all unequipped items, including quest items. Not good if it breaks the game later on, but OK if the player can just retrieve the item when needed.
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Sun Nov 18, 2012 2:50 pm

See the post (and link) I gave earlier ... that script handles what happens to a Quest if the player "loses" the Quest Item :wink:
User avatar
Jade Payton
 
Posts: 3417
Joined: Mon Sep 11, 2006 1:01 pm

Post » Sun Nov 18, 2012 9:59 am

would the 'quest item' and the quest the item is attached to, be safe until the player retrieved the items? I'm wondering if the quest that needs the item will crash if the player tries to advance the quest without the quest item.

I don't go to jail that often, just went once in Cidhna mine, but doesn't that happen when you do: quest items stay in inventory. Maybe you should check how they do it in vanilla, or if they remove all items then you'd be as safe as vanilla is.

Edit:
If you want more safety the only thing I can think of is to try to assign every dropped object to an alias in a new quest NOT allowing reserved objects. But:
1. May be slow.
2. I don't know if "allow reserved" has any effect blocking if you try to fill a reference from script, not letting the engine fill those. You can do it with without script but will be even slower I think.
3. This will work only for items marked as reserved but let's say the most critical ones will be like that and this will give you a higher level of safety if that's all you look for.
I can't think of some other method to check if a reference is a "quest item".
User avatar
jodie
 
Posts: 3494
Joined: Wed Jun 14, 2006 8:42 pm

Post » Sun Nov 18, 2012 2:44 pm

See the post (and link) I gave earlier ... that script handles what happens to a Quest if the player "loses" the Quest Item :wink:

Thanks for the link, though I'm not sure what to take away from it. I wish Bethesda would release more information about the underlying mechanics of how the game operates. The creation kit wiki is about as bare boned as a Corrupted shade.

The reason I ask is because of the mod I just released called http://skyrim.nexusmods.com/mods/23001/. It gives the player extra sorted storage and retrieval options on any container through a magic spell. The store all feature removes everything, including quest items.

But I think I may have a easy solution. I'll use the RemoveAllItems() function to remove everything but the quest items to a hidden chest. Then I'll run the sorting routines on the hidden chest's inventory, sending back to the player what wasn't sorted to the container. I'll have to write extra routines to remember what was equipped.
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm


Return to V - Skyrim