EdguyFan Posted August 22, 2016 Share Posted August 22, 2016 Hi guys, This should be a really simple task but I've been scouring the net for hours and can't seem to find anything that works. I want a variable to be set to Property Value + 1 when the player chooses a certain dialogue option with an NPC. I set the property up in my Quest Script: ScriptName MFG01QuestScript extends Quest int Property MFGWorkersHired = 0 Auto Conditional Simple enough so far, right? I found instructions for exactly this on the Creation Kit wiki page about variables and properties! It instructs: ;I have a quest script with this in it: scriptName MQ01Script extends Quest int property deadCount auto ;I have a result script (OWNED by MQ01) with this in it: MQ01Script myQuest ;declares a variable "myQuest" which is a TYPE of MQ01Script myQuest = GetOwningQuest() as MQ01Script ;sets the myQuest variable to it's owning quest as the type MQ01Script float myDeadCount ;declaring the variable "myDeadCount" myDeadCount = myQuest.deadCount ;setting local variable to be the quest's property value ;you can also set the quest property thusly: myQuest.deadCount = 10 But I'll be damned if I can't get that bit of code to work. I have it typed out as a Fragment at the "End" of the response from the NPC, obviously with the information I want correctly plugged into where it should be. MFG01QuestScript MFG MFG = GetOwningQuest() as MFG01QuestScript float WorkersHired WorkersHired = MFG.MFGWorkersHired MFG.MFGWorkersHired = MFGWorkersHired + 1 But all I get is errors: Starting 1 compile threads for 1 files... Compiling "TIF__03008D78"... D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(9,17): unknown type mfg01questscript D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(10,23): cannot convert to unknown type mfg01questscript D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(10,23): cannot cast a quest to a mfg01questscript, types are incompatible D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(12,19): mfg01questscript is not a known user-defined type D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(12,0): type mismatch while assigning to a float (cast missing or types unrelated) D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(13,4): mfg01questscript is not a known user-defined type D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(13,22): variable MFGWorkersHired is undefined D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__03008D78.psc(13,38): cannot add a none to a int (cast missing or types unrelated) No output generated for TIF__03008D78, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on TIF__03008D78 I'm brand new to Papyrus and scripting in general and I can't decipher that. That being said I do have a good grasp on the concepts and I understand the instructions, but I guess I'm doing something wrong?? I've tried tons of other solutions and I just can't get it to compile. What gives? Link to comment Share on other sites More sharing options...
skinnytecboy Posted August 23, 2016 Share Posted August 23, 2016 (edited) So let me get this straight; Using dialogue you want to increase an int value on a script that's attached to your quest? (EDIT: Reading your post a second time... and I note that you aren't calling a function. Ie setvalueint() ) What does the int value do? (Would not a global be better) Is the value running inside a state that does something when the value increases or decreases or are you using the int as a condition? http://www.cipscis.com/skyrim/tutorials/states.aspx I'd answer in more detail, but just checking what it is you're trying to do. Edited August 23, 2016 by skinnytecboy Link to comment Share on other sites More sharing options...
agerweb Posted August 23, 2016 Share Posted August 23, 2016 Is there any reason why you don't want to use a global int set to zero and then in the dialogue fragment just put: WorkersHired.SetValue(WorkersHired.GetValueInt()+1) As skinnytecboy says it depends on what your trying to do - specifically what do you want to use the incremented variable for after you've incremented it. Link to comment Share on other sites More sharing options...
lofgren Posted August 23, 2016 Share Posted August 23, 2016 As for your original question, the error messages you are getting seem to suggest that MFG01QuestScript is not attached to the quest or has not been compiled correctly. Did you exit out of the quest window and save your mod before you started trying to create the dialogue fragment? Link to comment Share on other sites More sharing options...
EdguyFan Posted August 24, 2016 Author Share Posted August 24, 2016 So let me get this straight; Using dialogue you want to increase an int value on a script that's attached to your quest? (EDIT: Reading your post a second time... and I note that you aren't calling a function. Ie setvalueint() ) What does the int value do? (Would not a global be better) Is the value running inside a state that does something when the value increases or decreases or are you using the int as a condition? http://www.cipscis.com/skyrim/tutorials/states.aspx I'd answer in more detail, but just checking what it is you're trying to do. Is there any reason why you don't want to use a global int set to zero and then in the dialogue fragment just put: WorkersHired.SetValue(WorkersHired.GetValueInt()+1) As skinnytecboy says it depends on what your trying to do - specifically what do you want to use the incremented variable for after you've incremented it. As for your original question, the error messages you are getting seem to suggest that MFG01QuestScript is not attached to the quest or has not been compiled correctly. Did you exit out of the quest window and save your mod before you started trying to create the dialogue fragment? Thanks for the help guys! I ended up working it out on my own, and I actually did end up using a global variable. Link to comment Share on other sites More sharing options...
Recommended Posts