SlyraksL Posted July 14 Share Posted July 14 (edited) Greetings So, I'm practicing the use of functions to handle properties to get a better code structure (suggested in this post https://forums.nexusmods.com/topic/13494349-how-to-avoid-this-excessive-number-of-ifelseif-statements/). But i'm getting these compile errors when adding a function to an existing vanilla script: mismatched input 'Function' expecting ENDFUNCTION missing EOF at 'EndFunction' Edited July 14 by SlyraksL adding tags Link to comment Share on other sites More sharing options...
dylbill Posted July 14 Share Posted July 14 You can't add your own functions to fragments because fragments are already their own function and you can't add functions inside of other functions in papyrus. A common thing for fragments though is to call your code somewhere else. For example, add a script to the quest that the fragment is on. Scriptname MyQuestScript Extends Quest Function SameAmount() EndFunction Then in your fragment you can do: (GetOwningQuest() as MyQuestScript).SameAmount() Link to comment Share on other sites More sharing options...
SlyraksL Posted July 14 Author Share Posted July 14 20 minutes ago, dylbill said: You can't add your own functions to fragments because fragments are already their own function and you can't add functions inside of other functions in papyrus. A common thing for fragments though is to call your code somewhere else. For example, add a script to the quest that the fragment is on. Scriptname MyQuestScript Extends Quest Function SameAmount() EndFunction Then in your fragment you can do: (GetOwningQuest() as MyQuestScript).SameAmount() It worked, Thank you! Link to comment Share on other sites More sharing options...
dylbill Posted July 14 Share Posted July 14 No problem be sure to change the name of MyQuestScript to something more unique Link to comment Share on other sites More sharing options...
Recommended Posts