SlyraksL Posted July 14, 2024 Share Posted July 14, 2024 (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, 2024 by SlyraksL adding tags Link to comment Share on other sites More sharing options...
dylbill Posted July 14, 2024 Share Posted July 14, 2024 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, 2024 Author Share Posted July 14, 2024 On 7/14/2024 at 2:37 PM, 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() Expand It worked, Thank you! Link to comment Share on other sites More sharing options...
dylbill Posted July 14, 2024 Share Posted July 14, 2024 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