What does "(GetOwningQuest() as MG03QuestScript)" mean?
What does "(GetOwningQuest() as MG03QuestScript)" mean?
It's used to manipulate variables in the script attached to the quest.
But what does it mean? I don't understand what happens when a function is casted to a script.
If you call GetOwningQuest(), it will return a Quest object. However, MG03QuestScript probably has additional variables that Quest doesn't; if you want to manipulate those variables, you need to cast the object as a MG03QuestScript (which is extended from Quest).
Or, put another way:
All MG03QuestScript objects are Quests, but not all Quests are MG03QuestScript objects. If the owning quest happens to be an MG03QuestScript and you need to access the properties that make MG03QuestScript objects special, then you need to cast the owning quest as an MG03QuestScript.
I hope you're well rested and can wrap your head around the following as it is convoluted.
GetOwningQuest() returns the quest that for example the info topic, where the function is called, belongs to. Casting the returned quest as a script that is attached to that quest gives you access to the specific instance of the script that is attached to the aforementioned quest.
EDIT: