Jump to content

Scripting help - Removing a specific item from a vendor


kuzi127

Recommended Posts

Bear with me here, I know next to nothing about scripting and very little about quests in the CK.

 

I'm making a combat rifle replacer, and I want to have my own unique spawn in place of Overseer's Guardian in Vault 81. To maintain mod compatibility with unique uniques and not touch the vanilla quest, I have a new quest set to start on location load at the vault. I then want to remove the old gun and spawn in my new one. I can do adding the new one, but I'm stuck on removing the old.

 

Right now, I just have a script fragment in the quest stage using extremely basic commands. I looked at the vanilla quest to see what commands they use, but what I'm doing is wrong since the compile fails.

 

Fragment:

ObjectReference oVendor = Alias_VendorV81Alexis.GetRef()
;from the vanilla quest to get the vendor id or whatever
oVendor.Removeitem(Aspiration_Weapon_V81_CombatRifle, -1)
;remove old gun using leveled list
SetStage(20)
;set next stage to spawn new gun
Compile errors:
\AppData\Local\Temp\PapyrusTemp\Fragments\Quests\QF_R91UniqueOverguard_020028ED.psc(7,26): variable Alias_VendorV81Alexis is undefined
\AppData\Local\Temp\PapyrusTemp\Fragments\Quests\QF_R91UniqueOverguard_020028ED.psc(7,48): none is not a known user-defined script type
\AppData\Local\Temp\PapyrusTemp\Fragments\Quests\QF_R91UniqueOverguard_020028ED.psc(7,16): type mismatch while assigning to a objectreference (cast missing or types unrelated)
\AppData\Local\Temp\PapyrusTemp\Fragments\Quests\QF_R91UniqueOverguard_020028ED.psc(9,19): variable Aspiration_Weapon_V81_CombatRifle is undefined
No output generated for Fragments:Quests:QF_R91UniqueOverguard_020028ED, compilation failed.

I really have no idea what's going on or how to do this properly. If anyone could help that would be greatly appreciated.

Link to comment
Share on other sites

In inventory its just a normal Combat Rifle, so;

Weapon Property pCombatRifle Auto Const Mandatory ;Actually just add in fragment properties
ThisREF = Alias_VendorV81Alexis.GetReference()
ThisREF.RemoveItem(pCombatRifle,  ThisREF.GetItemCount(pCombatRifle), abSilent = TRUE)

Link to comment
Share on other sites

Either open the script [advanced] [edit script] and paste it at the end then press [properties] [autofill], OR

 

Ignore that line, press [properties] [add property] down arrow [create using form] ID: CombatRifle Name: pCombatRifle

Link to comment
Share on other sites

I can't autofill the properties, it gives me a warning about cannot open store for class (quest fragment stuff), missing file. Maybe related to that it's a custom quest? When I use the second method, the compile fails and says no viable alternative at input =

Link to comment
Share on other sites

Apologies, I forget that we are just pushing buttons with no foundation:

ObjectReference ThisREF = Alias_VendorV81Alexis.GetReference()
ThisREF.RemoveItem(pCombatRifle, ThisREF.GetItemCount(pCombatRifle), abSilent = TRUE)

OR to avoid the extra declaration: 

Alias_VendorV81Alexis.GetReference().RemoveItem(pCombatRifle, Alias_VendorV81Alexis.GetReference().GetItemCount(pCombatRifle), abSilent = TRUE)

OR if you know there is only one in inventory:

Alias_VendorV81Alexis.GetReference().RemoveItem(pCombatRifle, 1, abSilent = TRUE)

Link to comment
Share on other sites

No need to apologize. Still gives the same no viable input at = error. I think the problem has something to do with that alias form, probably in the properties or something like that.

 

edit: After searching around some about errors, I may need to unpack the rest of the scripts since I forgot to do that. I had problems in the past with this too. Will continue experimenting.

 

edit2: Didn't fix the problem. I have a feeling I could fix the problem if I could add properties to the script, but I can't and get that cannot open store missing file error. No idea what to do about it yet.

 

edit3: Well I don't know how i did it but i managed to get into the properties dialogue, add the relevant ones, and compile it. I referenced the alias from the vanilla quest. It works, sort of. There's no rifles in her inventory now, so it removed the old one, but it won't spawn the new one. It's the same method as I used for other uniques that worked, but I can probably figure it out on my own. Thanks for your help.

Edited by kuzi127
Link to comment
Share on other sites

  • Recently Browsing   0 members

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