Adding Item Count Condition on a Container to Trigger Box Sc

Post » Mon Nov 19, 2012 4:30 pm

I was planning to use this script on a trigger box as part of a quest in order to determine when the player uses Unrelenting Force shout on a container.

http://pastebin.com/raw.php?i=M1tLREy6

However, I'd like to add two nested if conditions to check to make sure the player has inserted at least two different items into the nearby container (which in the quest has a ReferenceAlias labeled "Shrine"). Does the following part make sense to add to this trigger box script? Or should I make it a separate quest stage and a separate script?

Also, what is the correct way to reference the container?

				if (GetOwningQuest.Alias_Shrine().GetItemCount(MarkarthFreeformTalosAmulet) >= 1)					if (GetOwningQuest.Alias_Shrine().GetItemCount(ST_AetheriumPiece) >= 1)											EndIf				EndIf
User avatar
Ells
 
Posts: 3430
Joined: Thu Aug 10, 2006 9:03 pm

Post » Mon Nov 19, 2012 5:29 pm

OK, I tried it a different way and it compiled OK - hopefully this works

http://pastebin.com/raw.php?i=bWnxR03L

I suppose I need to revise it a bit to deal with the possibility of the player repeating the quest.
User avatar
George PUluse
 
Posts: 3486
Joined: Fri Sep 28, 2007 11:20 pm

Post » Mon Nov 19, 2012 5:28 am

That looks like it'll work, but there's something that might be interesting and will hopefully be helpful that I'd like to tell you. At the moment, because you're using an http://www.creationkit.com/ObjectReference_Script auto property that I assume is set in the Creation Kit. This approach will work just fine, but it's worth mentioning that it will also make your container permanently http://www.creationkit.com/Persistence_(Papyrus).

An alternate approach that you could try, if you want, would be to use a http://www.creationkit.com/ReferenceAlias property instead, and have an alias on your quest that points to your chest. So long as the property is filled, you can access your chest and everything's fine. The difference is that the alias is cleared automatically when the quest is stopped, and the chest will no longer be persistent.

If this quest never stops then that approach wouldn't really change anything, but I thought it was something that would be worth mentioning.

Also, just as a side note, because you only have one auto state in this script, you should be able to just remove the state and have the whole script exist in the default "empty" state.

Cipscis
User avatar
casey macmillan
 
Posts: 3474
Joined: Fri Feb 09, 2007 7:37 pm

Post » Mon Nov 19, 2012 5:21 pm

That looks like it'll work, but there's something that might be interesting and will hopefully be helpful that I'd like to tell you. At the moment, because you're using an http://www.creationkit.com/ObjectReference_Script auto property that I assume is set in the Creation Kit. This approach will work just fine, but it's worth mentioning that it will also make your container permanently http://www.creationkit.com/Persistence_(Papyrus).

An alternate approach that you could try, if you want, would be to use a http://www.creationkit.com/ReferenceAlias property instead, and have an alias on your quest that points to your chest. So long as the property is filled, you can access your chest and everything's fine. The difference is that the alias is cleared automatically when the quest is stopped, and the chest will no longer be persistent.

If this quest never stops then that approach wouldn't really change anything, but I thought it was something that would be worth mentioning.

Also, just as a side note, because you only have one auto state in this script, you should be able to just remove the state and have the whole script exist in the default "empty" state.

Cipscis

Great to hear, thanks Cipscis!

So if I want to make this repeatable, for example, I have some activator with a message box that lets the player choose to go back to stage 30 of the quest, then I should add a line to enable the trigger box again during one of the earlier quest stages, since it is disabled here?
User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm

Post » Mon Nov 19, 2012 2:14 pm

I'm not sure what might be required to get your script working with it, although from the look of your script its stage should be somewhere between 60 and 80 for this to work? But yeah, you'll need to enable the scripted ObjectReference again before this can run a second time.

Just looking at that script again, another improvement you could make would be to replace your http://www.creationkit.com/Spell_Script properties with a single http://www.creationkit.com/FormList_Script property, and point it to a FormList that contains all applicable spells. Then, just use http://www.creationkit.com/HasForm_-_FormList to check whether or not the spell exists in that list.

This will also allow you to edit the applicable spells without needing to touch the script or properties.

Cipscis
User avatar
Naomi Ward
 
Posts: 3450
Joined: Fri Jul 14, 2006 8:37 pm


Return to V - Skyrim