Jump to content

[LE] Cannot remove item from inventory when quest is finished


Minasim

Recommended Posts

Hello all!

 

I am making my first quest in the CreationKit, something really simple where, after accepting the quest, you must get into a dungeon, kill a witch to get the hammer on her body and bring the hammer back to the quest giver. I have followed tutorial online to create this quest step by step but I am stuck when I need to give back the hammer to the quest giver. After having created aliases for the quest giver (Wyzimar) and the hammer,I have put in the last stage of the quest this bit of script:

SetObjectiveCompleted(30)
Game.GetPlayer().AddItem(Gold001, 100)
Alias_Wyzimar.GetReference().AddItem(Alias_Hammer.GetReference())
However while I do get my gold and the quest is completed, the item is not removed from my inventory to give it to Wyzimar. I have also tried to use Game.GetPlayer().RemoveItem(Alias_Hammer.GetReference()) but still the item remains in my inventory.
Is there something I am doing wrong?
Some potential leads: I am using the SE of Skyrim. In the hammer alias, I have used "Create Reference to Object. Create in Enemy" in order to get the hammer in the inventory of the quest enemy, which works.
Thanks so much for your help!
Minasim
Link to comment
Share on other sites

Usually a ref like Alias_Hammer.GetReference() is not valid, in case the item is inside a container or inventory.

As workaround try next:

 

 

 

  ReferenceAlias PROPERTY Alias_Hammer  auto
  ReferenceAlias PROPERTY Alias_Wyzimar auto

  MiscItem PROPERTY Gold001 auto
  Weapon   PROPERTY QuestHammer auto   ; use this for the hammer, its the basobject which should work every time

; ---- fragment code

    SetObjectiveCompleted(30)
    actor player = Game.GetPlayer()

; give player 100 gold as reward!
    player.AddItem(Gold001, 100)

; set alias free
    Alias_Hammer.Clear()

; remove the item from players inentory and give it to quest giver
; https://www.creationkit.com/index.php?title=RemoveItem_-_ObjectReference

    player.RemoveItem(QuestHammer, 1, False, Alias_Wyzimar.GetReference())
; ----

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Hi!

Thanks for your quick answer.

However I get this one I compile your script:

Starting 1 compile threads for 1 files...
Compiling "QF_TESTQuest_01001ED0"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(23,15): no viable alternative at input 'PROPERTY'
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(23,24): script property Alias_Hammer already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(23,24): script variable ::Alias_Hammer_var already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(23,24): script property Alias_Hammer already has a get function defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(23,24): script property Alias_Hammer already has a set function defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(24,25): script property Alias_Wyzimar already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(24,25): script variable ::Alias_Wyzimar_var already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(24,25): script property Alias_Wyzimar already has a get function defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(24,25): script property Alias_Wyzimar already has a set function defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(31,25): no viable alternative at input '('
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(32,19): no viable alternative at input 'Game'
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(32,23): required (...)+ loop did not match anything at input '.'
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(32,10): Unknown user flag Game
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(75,20): script property Gold001 already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(75,20): script variable ::Gold001_var already defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(75,20): script property Gold001 already has a get function defined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\QF_TESTQuest_01001ED0.psc(75,20): script property Gold001 already has a set function defined
No output generated for QF_TESTQuest_01001ED0, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_TESTQuest_01001ED0

Do you know what is going on? Is there anything else I should do beside copying the code in the last stage of the quest?

Link to comment
Share on other sites

Hmm.. hopefully you do not use Mod Organizer to handle Skyrim mods.

 

You have installed Skyrim SE, and will find next papyrus source code "QF_TESTQuest_01001ED0.psc" as text file in this folder

    C:\ Program Files (x86) \ Steam \ steamapps \ common \ Skyrim Special Edition \ Data \

    Skyrim (32-bit):     Scripts \ Source
    
    Skyrim SE (64-bit):  Source \ Scripts     --> your installed Skyrim

A fragment quest script looks as follow (next is vanilla sample):

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname QF_DBSuspensionQuest_000A2490 Extends Quest Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0()
;BEGIN CODE
;DBEviction.SetStage (0)
    DBEviction.Start()
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

quest Property DBEviction  Auto

 

 

 

your papyrus quest script could be as follow, keep in mind your script will have more than one fragments inside:

 

;BEGIN FRAGMENT Fragment_0
Function Fragment_0()
;BEGIN CODE
    SetObjectiveCompleted(30)
    actor player = Game.GetPlayer()

; give player 100 gold as reward!
    player.AddItem(Gold001, 100)

; set alias free
    Alias_Hammer.Clear()

; remove the item from players inentory and give it to quest giver
; https://www.creationkit.com/index.php?title=RemoveItem_-_ObjectReference

    player.RemoveItem(QuestHammer, 1, False, Alias_Wyzimar.GetReference())
;END CODE
EndFunction
;END FRAGMENT

; *** Do not forget to add next property and fill with CreationKit! ***
  Weapon PROPERTY QuestHammer auto   ; use this for the hammer, it have to be the basobject of your quest weapon, which should work every time

 

 

 

Use the windows "explorer" to open your papyrus source file "QF_TESTQuest_01001ED0.psc" with a normal texteditor and add the code you need to the fragment (last stage you mentioned)

Do not forget the Weapon property outside the fragment. After that open the CreationKit and fill the new property and see if its work after compiling.

Edited by ReDragon2013
Link to comment
Share on other sites

Do you absolutely need to make the item a quest object and use an alias? Can't you make an unique item and simply check to see if you have an item with that form in your inventory? That way you could drop it at any time during or after the quest. Yes if you misplace it the quest can not be finished but so what, have a statement that the object might be important when you first acquire it and if you lose it you lose it. I really hate quest objects that you can't get rid of and most of the time aliases are not needed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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