MimiTheAlchemist Posted May 23, 2013 Posted May 23, 2013 (edited) I am working on a quest in which a bard asks the player needs to gather some items so he can make a lute.After making sure all of the script properties pointed to the right items, I wrote this script fragment in quest stage 10 (the stage where you agree to get the items). I used the original names for the items properties, and bq is the property for the quest. if (game.getplayer().getitemcount(firewood01) >= 3 && game.getplayer().getitemcount(leatherstrips) >= 2 && game.getplayer().getitemcount(ingotsteel) >= 1 && game.getplayer().getitemcount(gemsapphire) >= 1) bq.SetObjectiveCompleted(10) bq.setStage(20) bq.SetObjectiveDisplayed(20)endif I have combed the internet for some other way of checking to see how many items are in a player's inventory. I have even looked at other quests in the game, but I can't seem to figure out why the quest doesn't progress even though I've gotten the items in the correct amount. The quest won't go past stage 10. I appreciate your help. Edited May 23, 2013 by MimiTheAlchemist
Purr4me Posted May 24, 2013 Posted May 24, 2013 Try this:if (game.getplayer().getitemcount(firewood01) >= 3 && game.getplayer().getitemcount(leatherstrips) >= 2 && game.getplayer().getitemcount(ingotsteel) >= 1 && game.getplayer().getitemcount(gemsapphire) >= 1) bq.SetObjectiveCompleted(10)else bq.setStage(20) bq.SetObjectiveDisplayed(20)endif
MimiTheAlchemist Posted May 24, 2013 Author Posted May 24, 2013 I tried it, but it didn't work. I want to write the code so that if the player has enough items, the quest advances to stage 20. It still won't advance to stage 20 even though I've acquired all of the firewood, leather strips, steel ingots, and sapphires needed. Thanks for your reply, though.
Purr4me Posted May 24, 2013 Posted May 24, 2013 (edited) ok, understand, what is the script "tied too?". which quest?what I am getting at is, I understand you wrote your own, but, I don't see a trigger to complete the segments here.no trigger....>kitty. Edited May 24, 2013 by Purr4me
Ghaunadaur Posted May 24, 2013 Posted May 24, 2013 (edited) I have another suggestion you could try. I suspect you made a dialogue topic info to hand over the items to the quest giver. The code to advance the quest should be added to the 'end script' of that topic info. In the conditions section above, add the conditions from your if-statement as condition functions, you don't need to declare script properties for the items or the quest. GetItemCount MiscItem:Firewood01 >= 3 ANDGetItemCount MiscItem:LeatherStrips >= 2 AND....And so on. The code on the topic infoGetOwningQuest().setStage(20) This goes on the quest stage (20 right?)SetObjectiveCompleted(10) SetObjectiveDisplayed(20) Edit: Of course you need properties to remove the items from the player inventory. Edited May 24, 2013 by Ghaunadaur
MimiTheAlchemist Posted May 25, 2013 Author Posted May 25, 2013 That is a good idea, but stage 20's objective is to bring the items to the person. So, the player would get the quest objective "bring items back" right after the items were already returned. I'd like the stage set to 20 before the player brings the items back to the bard. Thanks for the help. I think I'm getting closer to completing my first quest. @Purr4me:I thought about adding an event to trigger the if-then statement, but I don't know which event I should use. Should I used oncontainerchanged or onitemadded? I'm not to familiar with events in papyrus. Thanks for your help.
Purr4me Posted May 25, 2013 Posted May 25, 2013 what is shown in other examples in the games structures, other scripts, you can find a match, copy and paste to an outside doc, then edit yours and use it, test it. there a gazillion other examples, choose one. test it, not working? choose another., using this method should take about 2 hours to check each way. Kitty.
Ghaunadaur Posted May 25, 2013 Posted May 25, 2013 (edited) That is a good idea, but stage 20's objective is to bring the items to the person. So, the player would get the quest objective "bring items back" right after the items were already returned. I'd like the stage set to 20 before the player brings the items back to the bard. Thanks for the help. I think I'm getting closer to completing my first quest.Ok, now I understand it. So you want to keep track if the player has the required items and then set the stage. Since the items are not quest items, the player can remove them any time. You might want to check for that too. This can't be done on a quest stage, it's not possible to add events to a script fragment. I suggest you make a quest alias for the player and put the following script on it. Not tested, but it should work. Scriptname InsertNameHere extends ReferenceAlias Quest Property bq auto Actor Property PlayerRef auto MiscObject Property firewood01 auto MiscObject Property leatherstrips auto MiscObject Property ingotsteel auto MiscObject Property gemsapphire auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if bq.GetStageDone(10) == 1 if PlayerRef.GetItemCount(firewood01) >= 3 && PlayerRef.GetItemCount(leatherstrips) >= 2 && PlayerRef.GetItemCount(ingotsteel) >= 1 && PlayerRef.GetItemCount(gemsapphire) >= 1 bq.setStage(20) bq.SetObjectiveCompleted(10, true) bq.SetObjectiveDisplayed(20, true) endif endif EndEvent Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if bq.GetStageDone(10) == 1 if PlayerRef.GetItemCount(firewood01) < 3 || PlayerRef.GetItemCount(leatherstrips) < 2 || PlayerRef.GetItemCount(ingotsteel) < 1 || PlayerRef.GetItemCount(gemsapphire) < 1 bq.SetObjectiveCompleted(10, false) bq.SetObjectiveDisplayed(20, false) bq.SetObjectiveDisplayed(10, true, true) endif endif EndEvent Edited May 26, 2013 by Ghaunadaur
MimiTheAlchemist Posted May 26, 2013 Author Posted May 26, 2013 Thanks for the help, Ghaunadaur. I still can't get it to work. I may have defined the player alias wrong.Is it supposed to be a unique actor or the playerref in any cell? I may try again with all my other mods disabled.It could be some kind of conflict.
Ghaunadaur Posted May 27, 2013 Posted May 27, 2013 Thanks for the help, Ghaunadaur. I still can't get it to work. I may have defined the player alias wrong.Is it supposed to be a unique actor or the playerref in any cell? I may try again with all my other mods disabled.It could be some kind of conflict. The player alias would have fill type specific reference. You could also look at vanilla quests that work similar to yours. FreeformRiften10 for instance (find 10 fire salts for Balimund). The script used on the player alias is very much like the script I posted above. I doubt there is a conflict unless you're altering vanilla stuff, but just to be sure, mod should be tested without other mods activated.
Recommended Posts