It's opposite day in Papyrus land!

Post » Fri Sep 13, 2013 7:52 am

OK, I tried, I don't know, I'm confused.

I made a script where you stick an item (alias: SoulGem1) into a box, and that should complete the objective. I added the item to a list, and I set up the items alias.

Scriptname ltowerSoulgemReceptacleScript extends ObjectReference  Conditional;"Work, damn it!"~ScoutReferenceAlias Property SoulGem1  Auto  Quest Property ltowerQuestPart1  Auto  int Property Used Auto ConditionalEvent OnInit()	AddInventoryEventFilter(ltowerQuestSoulGemList)EndEventEvent OnItemAdded(Form BaseItem, int ItemCount, ObjectReference ItemReference, ObjectReference SourceContainer)	if Used == 0		if ItemReference == SoulGem1.GetReference()			Debug.MessageBox("It works")			ltowerQuestPart1.SetObjectiveCompleted(20)			Used=1		endif	endifEndEventFormList Property ltowerQuestSoulGemList  Auto  

So, from this script, it should:

  1. Exclude items not on list
  2. Place item in box
  3. Check if item in box is Soulgem1
  4. Display message on screen "It Works!" and completes objective

Very simple stuff, or it should be. For some reason that's beyond me; it's doing just the opposite. It's ignoring Soulgem1 and Soulgem1 only. If you place anything else in the box, it completes the objective and displays the debug message.

Seriously, this is beyond me. Not only is my form list check being ignored for some reason

		if ItemReference == SoulGem1.GetReference()

is acting like

		if ItemReference != SoulGem1.GetReference()

:ahhh: :ahhh:

User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am

Post » Fri Sep 13, 2013 9:16 am

ItemReference is the specific reference of the item added to the container. Most items don't have specific references because they aren't persistent (meaning almost everything in your inventory). Thus, in most cases, ItemReference will == none. Since the SoulGem1 alias isn't filled with random items either, it also returns none when you check getReference if it is empty. That would explain why it fires whenever you put anything besides SoulGem1 in--since none == none.

On the other hand, it would seem that when you put SoulGem1 in, assuming the alias is filled, ItemReference is still returning none for some reason. You could try instead:

if BaseItem == (SoulGem1.GetReference() as form)

That should take care of your problems.

User avatar
Lyndsey Bird
 
Posts: 3539
Joined: Sun Oct 22, 2006 2:57 am

Post » Fri Sep 13, 2013 1:31 am

Most likely SoulGem1.GetReference() is returning None, either because the properties aren't filled or because the alias isn't filled.

Make sure all the properties are pointing at the right entries in the script's Properties window, and that when you test in-game, you're using a "clean" save made before the quest this relates to was started.
User avatar
Silvia Gil
 
Posts: 3433
Joined: Mon Nov 20, 2006 9:31 pm


Return to V - Skyrim