chucksteel Posted September 7, 2016 Share Posted September 7, 2016 Can anyone help me with what should be a simple quest script? I know everything I need to have in the script but Papyrus just confuses me so much and I don't know of any way to search through the vanilla scripts for examples of what I need to do. I've spent some time opening scripts and poking around them but it's random and pointless. I've also been looking up the functions on CreationKit.com but again the examples there aren't all that helpful to me. The quest it self should be fairly simple and I was able to do it in FO3/NV. When you pick up an item it gets counted, every five the player finds a quest stage gets set. Once the counter gets to 30 the quest prize is given. I know I need to set up,a counter an Inventory filter for my items Remote event registration for when picking up the itemsI just can't get anything to work that's more complicated then Enabling, disabling ref's or setting a quest stage and I'm getting frustrated. :wallbash: Thanks in advance for any help. Link to comment Share on other sites More sharing options...
LoneRaptor Posted September 7, 2016 Share Posted September 7, 2016 Add this to a quest alias for the player:Scriptname CountingScript extends ReferenceAlias FormList Property FilterFormList Auto Actor Property PlayerREF Auto Quest Property YourQuest Auto MiscObject Property QuestReward Auto ;Depending on what the reward is you need to change the type of property Int Counter = 0 ;If you want to be able acces this count outside the script you could replace the int with a global property. Event OnInit() playerREF.AddInventoryEventFilter(FilterFormList) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Counter += 1 If(Counter == 5) YourQuest.SetStage(5) ;change the 5 after setstage to wathever stage you need. ElseIf(Counter == 10) YourQuest.SetStage(10) ElseIf(Counter == 15) YourQuest.SetStage(15) ElseIf(Counter == 20) YourQuest.SetStage(20) ElseIf(Counter == 25) YourQuest.SetStage(25) ElseIf(Counter == 30) YourQuest.SetStage(30) PlayerREF.AddItem(QuestReward, 1) ;Change the 1 to however many you want to add. EndIf EndEvent If you have questions about how it works or need help getting it to work in game feel free to ask. Link to comment Share on other sites More sharing options...
kinggath Posted September 7, 2016 Share Posted September 7, 2016 EDIT: looks like LoneRaptor hooked you up! This guy posted a tutorial today that does pretty much what you want. Just replace the raider section with whatever items you want the player to collect, and use the onactivatea script instead of the ondeath script. This will at least show you how to setup the quest, and use the counters. If you don't want to place collectible objects in the world and instead want to just let the player collect a certain number of items in a form list, you'll need to add an alias to the player on the quest and then add a script, that script will need a combination of the two functions I'm about to link to and the code in the default counter scripts: http://www.creationkit.com/fallout4/index.php?title=AddInventoryEventFilter_-_ScriptObjecthttp://www.creationkit.com/fallout4/index.php?title=OnItemAdded_-_ObjectReference All that should give you a starting point so you can get your quest set up and a starter script written, once you have that if you post what you came up with for your script I can help you fix any bugs. Link to comment Share on other sites More sharing options...
chucksteel Posted September 7, 2016 Author Share Posted September 7, 2016 Thank you so much! I'll let you know if I have any more questions. Link to comment Share on other sites More sharing options...
LoneRaptor Posted September 7, 2016 Share Posted September 7, 2016 I just tought of something you could add if you want a notification to pop up telling the player how many of 30 he/she collected:In the script i posted add this line at the top below Miscobject ...: Message Property CollectedMessage AutoThis is the notification you want to show after finding one. then Below the EndIf line (second to last) You add this line: CollectedMessage.show(afArg1 = Counter)In the creation kit you make a message for example: %.0f/30 collected. the "%.0f" will in game be replaced by the count. Link to comment Share on other sites More sharing options...
chucksteel Posted September 7, 2016 Author Share Posted September 7, 2016 Awesome you rock! I'll be adding that thanks! Link to comment Share on other sites More sharing options...
chucksteel Posted September 8, 2016 Author Share Posted September 8, 2016 Well somethings gone wrong and I'm assuming it's my Player alias. I did edit the script a bit and it compiled and saved. Scriptname BTInt_DRGN_Alias_Script extends ReferenceAlias FormList Property BTInt_DRGN_Gnome_List Auto Actor Property PlayerREF Auto Quest Property BTint_DRGN_Quest Auto Message Property DRGN_CollectedMessage Auto Int Counter = 0 ;If you want to be able acces this count outside the script you could replace the int with a global property. Event OnInit() playerREF.AddInventoryEventFilter(BTInt_DRGN_Gnome_List) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Counter += 1 If(Counter == 1) BTint_DRGN_Quest.SetStage(10) ;change the 5 after setstage to wathever stage you need. ElseIf(Counter == 5) BTint_DRGN_Quest.SetStage(15) ElseIf(Counter == 10) BTint_DRGN_Quest.SetStage(20) ElseIf(Counter == 15) BTint_DRGN_Quest.SetStage(25) ElseIf(Counter == 20) BTint_DRGN_Quest.SetStage(30) ElseIf(Counter == 25) BTint_DRGN_Quest.SetStage(35) ElseIf(Counter == 30) BTint_DRGN_Quest.SetStage(40) EndIf DRGN_CollectedMessage.show(afArg1 = Counter) EndEvent I removed the misc object because the player get's lead to a key after collecting all 30 of the items and it doesn't get added to the inventory. when testing on a clean save with only Beantown interiors installed (just exited vault 111) and then COCing to my test cell, picking up any item from the list does not start the quest. I ran console "SQV BTInt_DRGN_Quest" (My Quest) and it returned. Script state = "" No auto properties Variables: No Variables No papyrus scripts attached - Aliases for quest 'BTInt_DRGN_Quest' (09187f18)- REF 'DRGNPlayerAlias'-> " (00000014) ---Quest state--------------------- Enabled? Yes State: Running Current stage: 5 Priority: 70 So my best guess is there is something wrong with my Alias. The quest is set to "Start Game Enabled so I did force "Allow Reserved" in the alias because of a tutorial I read but trying it toggled on and off had the same result, The Alias's script didn't fire when picking up the gnome from the list. Any thoughts on where I went wrong? Thanks again and I do appreciate the script it at least is helping me to understand papyrus a bit more. Link to comment Share on other sites More sharing options...
MasterMagnus Posted September 8, 2016 Share Posted September 8, 2016 (edited) Shot in the dark here, this seems like something I ran into. Was also trying to use an Actor Property from Quest Alias and couldn't get that to work. Instead of Actor (type in your property definition) make your PlayerRef a ReferenceAlias. Then in code:ObjectReference ThisPlayerRef = PlayerRef.GetReference() and use it like so for Actor specific functions (ThisPlayerRef as Actor) (ThisPlayerREF as Actor).AddInventoryEventFilter(BTInt_DRGN_Gnome_List) Edited September 8, 2016 by MasterMagnus Link to comment Share on other sites More sharing options...
TummaSuklaa Posted September 8, 2016 Share Posted September 8, 2016 I think you don't have to call the player or any object on AddInventoryEventFilter. I've never seen it used that way. It should always work only for the object that the script is attached to. It could be or not be the source of the issue. Link to comment Share on other sites More sharing options...
kinggath Posted September 8, 2016 Share Posted September 8, 2016 Your Alias is set up correctly. To confirm it, add this to your script, then load the game and run to another location (like from Sanctuary to Red Rocket) Event OnLocationChangeDebug.MessageBox("Location change detected.")EndEvent If that doesn't work, then your Alias is the problem, if it does, than your Inventory filter is the issue. You mention that you have a clean save with just Beantown Interiors loaded (love that mod by the way), is the save from before or after you installed the mod? Link to comment Share on other sites More sharing options...
Recommended Posts