monkseal Posted February 17, 2023 Share Posted February 17, 2023 So I wanted to try and do something beyond my usual "make a follower - drop them into the world - done", even despite the fact I know nothing about coding. The idea was to make a mini-quest by ripping off vanilla Moss Mother (Valdr) quest - NPC sits wounded, player offers them potion, NPC is no longer wounded and can become follower. But, as expected, my copying strategy didn't take me very far... For the potion-giving part, Mossmother uses the following:If akSpeaker.ShowGiftMenu(True, PotionList) > 0 GetOwningQuest().SetStage(20)Else; Debug.Trace("ShowGiftMenu returned a value <= 0")EndIf But if I try to just copy it, it refuses to compile, claiming that "variable PotionList is undefined"From my (VERY limited) understanding of what's going on, script has no idea what PotionList is, and, while the vanilla one probably had it "explained" somewhere earlier along the line, I would need to do it again to make it work. I tried to locate where that happened in the vanilla quest to figure out how it's done, but failed miserably. So, how to? Or is it actually more complicated than I thought? Thanks! Link to comment Share on other sites More sharing options...
Sphered Posted February 17, 2023 Share Posted February 17, 2023 I tend to avoid fluffy functions like giftmenu. IDK the word im looking for but I just prefer to simplify things I guess. Anyhow. It sounds like you simply dont have a formlist declared. Perhaps the owning quest has a list? Anyway, its a decent chance its referring to the FavorHealingPotions list. You can fetch that with getform and sidestep a couple headaches and just enjoy your follower Example... Actor Whoever = akSpeaker as Actor Formlist FavorHealingPotions = Game.GetForm(0xB15F9) as Formlist Int BananaSomethingPointsIGot = Whoever.ShowGiftMenu(True,FavorHealingPotions) Bool ThatEndedFavorably = BananaSomethingPointsIGot > 0 If ThatEndedFavorably GetOwningQuest().SetStage(20) EndIfAbove could be made a lot shorter (akSpeaker as Actor).ShowGiftMenu(True,Game.GetForm(0xB15F9) as Formlist) > 0 && GetOwningQuest().SetStage(20) But it can be helpful for understanding, to break it up to see whats going on. Anyhow, either of those should do what you are needing, without worrying with a property Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 18, 2023 Share Posted February 18, 2023 Dialog fragments are individual script functions. As such, properties cannot be declared and defined within them. Instead they have to be added via the properties window brought up by the properties button. However, when first starting out the script does not exist and the CK cannot add the properties to a non-existing script. One must first put something into the fragment box and compile it. The easiest is a single semi-colon but the desired code commented out with semi-colons would work too. Once the script is initially compiled with the place holder stuff, the desired properties can be added. After the properties are added, the script can be re-compiled with the actual desired code. In the MossMother case PotionList is the variable name for a FormList property that has been assigned the FavorHealingPotions list as Sphered correctly guessed. While there are ways to avoid using a property, I personally lean towards GetFormFromFile, it is still a good idea to learn how to use properties with the various types of script fragments. Link to comment Share on other sites More sharing options...
monkseal Posted February 18, 2023 Author Share Posted February 18, 2023 Thank you for your help! I think it's working now - on my way to iron out some other things. Link to comment Share on other sites More sharing options...
Recommended Posts