SlyraksL Posted July 14, 2024 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
dylbill Posted July 14, 2024 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()
SlyraksL Posted July 14, 2024 Author 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!
dylbill Posted July 14, 2024 Posted July 14, 2024 No problem be sure to change the name of MyQuestScript to something more unique
Recommended Posts