Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crafting Tables Pull from Nearby Chests #1

Closed
1 task done
xanderdunn opened this issue Aug 5, 2014 · 4 comments
Closed
1 task done

Crafting Tables Pull from Nearby Chests #1

xanderdunn opened this issue Aug 5, 2014 · 4 comments
Milestone

Comments

@xanderdunn
Copy link
Owner

Pulling items from the user's inventory is a pain in the ass. Instead, pull everything from a nearby designated chest.

  • Look at what script is attached to the alchemy table, smithing tables, and enchanting table and edit them.
@xanderdunn xanderdunn added this to the 1.0 milestone Aug 5, 2014
@xanderdunn xanderdunn changed the title Alchemy Table Pulls from Alchemy Chest Crafting Tables Pull from Nearby Chests Aug 5, 2014
@xanderdunn
Copy link
Owner Author

It looks like the location where workbenches get their items is hardcoded to the player.

Idea: Move all items in a container to the player's inventory and then back to the container when done.

  1. Set a custom script on the container that adds every added Form to a FormList:
ScriptName aaCustomContainerScript extends ObjectReference

FormList Property aaItemList auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

    While aiItemCount > 0
        aaItemList.AddForm(akBaseItem) ; tracking list of items in container
        aiItemCount -= 1
    EndWhile

EndEvent
  1. Move from container to RemoveAllItems(akTransferTo = Player, abKeepOwnership = true).
    • Will this add the items to the player silently?
    • Will I need to increase the player's max carry weight for this to work?
    • You could use an AddInventoryEventFilter to ignore any items the player might put in that aren't ingredients
  2. Two possibilities for getting the items back into the container:
    • Iterate through all the forms in the FormList to move it to the container if it still exists. (This will work only if the used items have a checkable state change from the unused ones)
    • Every time the player uses an item, if it is in the FormList, remove it. Then simply move all items in the FormList to the container on workbench completion.

@xanderdunn xanderdunn added the P1 label Aug 9, 2014
@xanderdunn
Copy link
Owner Author

The above isn't going to work because Papyrus is too slow, it doesn't tell me how much of each item is being removed from a container or allow me to get a list of what is in a container, and it doesn't allow arrays larger than 128 items.

property Container item list (cil)

To Do

  • Get cil from container
  • Add cil to player
  • Remove from cil when player removes an item from the container
  • On workbench completion, remove from the player everything in cil
  • Check that an item from the container is of Ingredient type before using it
  • Make sure the player does not see an encumbrance message when equipping a lot of ingredients. This is not a problem because the message does not appear since the player is inside the workbench menu.

Situations to worry about:

  • Items on the player that are not in the container
  • Items in the container that are not on the player
  • Items that are in both

Tests I need to do

  • Does spawning a new item that was added to the chest by my plugin cause any problems?
  • Do repeated workbench sessions work as expected? Do I get the right numbers of items?
  • Stress testing. How does it work with 200 different items?

@xanderdunn
Copy link
Owner Author

Improvements

  • Refactor to remove ExtraContainerInfo from SkaarSpecialInventoryCrafting.cpp
  • Remove the script on the Player object. Use a Story Manager Event with a quest the same as the Hardcore Mode.
    • Stop the quest when the player gets up from the workbench
    • Make sure the quest starts again a second time around
    • Remove the need for the GlobalVariable
  • Remove the sourceContainer property from the workbench script. Just use a linkedref and GetLinkedRef
  • Bug: Upon first entering the game, activate the workbench and the game will crash
  • Bug: SkaarAddItemsFromContainerToContainer will add some things that were in neither the source nor the destination. Look at the appearance of torches and extra lockpicks in your Misc inventory after using the workbench

xanderdunn pushed a commit that referenced this issue Aug 21, 2014
Also remove Debug statements and add usage info
xanderdunn pushed a commit that referenced this issue Aug 21, 2014
By using a Script Event on the Story Manager, the need for the
GlobalVariable was also removed
xanderdunn pushed a commit that referenced this issue Aug 25, 2014
Also fix release build settings, Remove unused ExtraContainerInfo
functions, Add DEBUG-only logging
@xanderdunn xanderdunn removed the P1 label Mar 8, 2018
@xanderdunn
Copy link
Owner Author

This is complete save for #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant