make quest stages advance with multiple items

Post » Tue Feb 16, 2016 6:13 am

In a quest I'm trying to make I want it to go from stage 10 to stage 20 after picking up 4 items. I have the mod working but you need to pick up the items in a certain order. That all fine and dandy but I know that the mod would just flow a lot better if the quest was scripted that way.



Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)

if (newContainer == Game.GetPlayer())

PLQP01.SetObjectivedisplayed(20)

PLQP01.SetStage(20)

endif

EndEvent



This is the script I'm using but I'm wondering if it is at all possible to some how modify it to set the objective once all for items have been picked up.

User avatar
Austin England
 
Posts: 3528
Joined: Thu Oct 11, 2007 7:16 pm

Post » Tue Feb 16, 2016 2:23 am

If the items are all quest items that can't be dropped, then you could just test if the player has them all before the SetStage.



I did something similar in my http://www.nexusmods.com/skyrim/mods/71553, but used about 20 different stages as I wanted to tell the player what he was looking for next. Each item was in a separate dungeon, so there had to be a large number of objectives, and hence stages to set them. If you just have a single objective of "pick up the set" it's much easier.



Assuming the items are unique you just test



if (player.GetItemCount( a ) > 0 && player.GetItemCount( b ) > 0 && ...)


PLQP01.SetStage(20)


endif

User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Mon Feb 15, 2016 10:44 pm

Awesome! So I'm guessing that you would have to make the items all the same in the kit for the script to work?



For example. My four items would have have to be iron ingots but I could just change the models for the iron so the they all look different. Do you think that would work?

User avatar
Czar Kahchi
 
Posts: 3306
Joined: Mon Jul 30, 2007 11:56 am

Post » Tue Feb 16, 2016 9:30 am

No all different is fine. In fact if you want to use GetItemCount to detect them they need to be distinct from vanilla items. You're checking the count on each one, not the whole set.

User avatar
Rachel Cafferty
 
Posts: 3442
Joined: Thu Jun 22, 2006 1:48 am

Post » Tue Feb 16, 2016 8:15 am

So in your code "a" and "b" would be replaced with the item name right? Sorry for all the questions. Still getting the hang of this.

User avatar
Andrew Tarango
 
Posts: 3454
Joined: Wed Oct 17, 2007 10:07 am

Post » Mon Feb 15, 2016 11:42 pm

yeah a and b would be the names of the items you want to check.

User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Tue Feb 16, 2016 1:48 pm

So I keep getting a complier error.


Starting 1 compile threads for 1 files...

Compiling "PirateScriptStage01"...

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(5,0): missing EOF at 'if'

No output generated for PirateScriptStage01, compilation failed.


Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on PirateScriptStage01


Here is my code.

if (player.GetItemCount(PirateIronQuest) > 0 && player.GetItemCount(PirateLeatherQuest) > 0 && player.GetItemCount(RumPirateQuest) > 0 && player.GetItemCount(EctoPirateQuest))

PirateQuestHook01.SetObjectivedisplayed(23)

PirateQuestHook01.SetStage(23)

endif

EndEvent


Do you think the error is because of indentations? What would be the proper way to set this up?



User avatar
Alberto Aguilera
 
Posts: 3472
Joined: Wed Aug 29, 2007 12:42 am

Post » Tue Feb 16, 2016 10:06 am


player.GetItemCount(EctoPirateQuest))

That isn't checking anything.



Also you're probably missing the Event identifier, unless you copy/pasted that and left out the Event stuff.

User avatar
Catherine Harte
 
Posts: 3379
Joined: Sat Aug 26, 2006 12:58 pm

Post » Tue Feb 16, 2016 9:40 am

I was thinking that might be throwing it off as well. How would write the event line? Event OnContainerChanged Do you know of any good sites to learn this script?

User avatar
Darian Ennels
 
Posts: 3406
Joined: Mon Aug 20, 2007 2:00 pm

Post » Tue Feb 16, 2016 5:43 am


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if (player.GetItemCount(PirateIronQuest) > 0 && player.GetItemCount(PirateLeatherQuest) > 0 && player.GetItemCount(RumPirateQuest) > 0 && player.GetItemCount(EctoPirateQuest) > 0)
PirateQuestHook01.SetObjectiveDisplayed(23)
PirateQuestHook01.SetStage(23)
endif
EndEvent

The best way to learn papyrus is by looking at the vanilla scripts and getting an idea how things are done.



And just in case you don't understand how that event is going to fire: If one of those conditions is not greater than 0, the stage will not change.

User avatar
Andrew Tarango
 
Posts: 3454
Joined: Wed Oct 17, 2007 10:07 am

Post » Tue Feb 16, 2016 6:30 am

I'm starting to get the hang of it I think. Now I've got all these errors if I use the script you wrote. In regards to the names for the items do you use the alias for the names?


Starting 1 compile threads for 1 files...

Compiling "PirateScriptStage01"...

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,5): variable player is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,25): variable PirateIronQuest is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,12): none is not a known user-defined type

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,42): cannot compare a none to a int (cast missing or types unrelated)

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,42): cannot relatively compare variables to None

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,49): variable player is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,69): variable PirateLeatherQuest is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,56): none is not a known user-defined type

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,89): cannot compare a none to a int (cast missing or types unrelated)

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,89): cannot relatively compare variables to None

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,96): variable player is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,116): variable RumPirateQuest is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,103): none is not a known user-defined type

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,132): cannot compare a none to a int (cast missing or types unrelated)

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,132): cannot relatively compare variables to None

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,139): variable player is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,159): variable EctoPirateQuest is undefined

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,146): none is not a known user-defined type

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,176): cannot compare a none to a int (cast missing or types unrelated)

D:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PirateScriptStage01.psc(6,176): cannot relatively compare variables to None

No output generated for PirateScriptStage01, compilation failed.


Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on PirateScriptStage01


User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm

Post » Tue Feb 16, 2016 4:57 am

The situation here is that you have no properties defined.



http://www.creationkit.com/Variables_and_Properties

User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm


Return to V - Skyrim