How do I check if a quest alias is inside the players invent

Post » Wed Jun 20, 2012 4:21 pm

I am doing a quest where 3 items need to be in the players inventory in order to advance the quest.

So what I am trying to do is that I am trying to apply a script to a alias to check if other aliases exist within the players inventory.

So I have no proper idea on how to go about doing this but what I thought it would look like is something like this:


Scriptname LPGLootPickup1 extends ReferenceAlias  Event onContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)if akNewContainer == Game.GetPlayer()if akNewContainer == Alias_RuufgardLoot2.GetReference()if akNewContainer == Alias_RuufgardLoot3.GetReference()GetOwningQuest().SetStage(30)endifendifendifendEvent


But I'm guessing the "if akNewContainer == Alias_RuufgardLoot2.GetReference()" doesn't exactly work. But what I didn't expect was that it responded with an error:




e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LPGLootPickup1.psc(5,23): variable Alias_RuufgardLoot2 is undefined
e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LPGLootPickup1.psc(5,43): none is not a known user-defined type
e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LPGLootPickup1.psc(6,23): variable Alias_RuufgardLoot3 is undefined
e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LPGLootPickup1.psc(6,43): none is not a known user-defined type


So TL;DR question is basically: What sort of papyrus script do I need/use in order to check if an alias exists within the players inventory? Bear in mind that this script is applied to an alias. (basically 3 items checking if the other 2 are in the players inventory each time their containers get changed)
User avatar
Mark Hepworth
 
Posts: 3490
Joined: Wed Jul 11, 2007 1:51 pm

Post » Thu Jun 21, 2012 12:11 am

I think the format you need to use is (GetOwningQuest().). At least that's what they type in quest objectives and whatnot to make it dynamically change. (If I remember correctly)
User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Wed Jun 20, 2012 4:53 pm

So where do I put the "(GetOwningQuest().)" ?
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Wed Jun 20, 2012 10:31 am

Would it look something like:

if akNewContainer == (GetOwningQuest().)


Like that?
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Wed Jun 20, 2012 10:30 am

Try that and see if it works. (I'm kind of just throwing out ideas here...)
User avatar
Spooky Angel
 
Posts: 3500
Joined: Thu Aug 10, 2006 5:41 pm

Post » Wed Jun 20, 2012 5:47 pm

Yeah that just gave me a bunch of errors. It seemed like a pretty unique way of scripting to me as well.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Wed Jun 20, 2012 8:10 pm

Try this:


Scriptname LPGLootPickup1 extends ReferenceAlias  ReferenceAlias Property Alias_RuufgardLoot2 AutoReferenceAlias Property Alias_RuufgardLoot3 AutoEvent onContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)if (akNewContainer == Game.GetPlayer()) && (akNewContainer.GetiItemCount(Alias_RuufgardLoot2.GetReference()) >= 1) && (akNewContainer.GetItemCount(Alias_RuufgardLoot3.GetReference()) >= 1)GetOwningQuest().SetStage(30)endifendEvent

if the script compiles, go to properties and fill the alias properties with your aliases (if the naming is exact, hitting auto-fill will do it automatically)


the problem with your original script is that your aliases were not defined as properties, and also your 2nd and 3rd if statements are checking whether the newContainer IS the item itself (which would never return true). you need GetItemCount if you are checking to see if something is in the inventory.
User avatar
Sarah Edmunds
 
Posts: 3461
Joined: Sat Jul 08, 2006 8:03 pm


Return to V - Skyrim