I'm trying to figure out how to give an NPC a shout via scripting, NOT already within the spell list. In my research, I've come across a code that does this but I'm not experienced enough to know what it's doing. The limit of my papyrus knowledge is if x then apply(y). As such I don't know if the whole script is necessary, this is the particular function that I think adds the shout but if the whole thing is necessary then I can provide it.
Int Function ApplyCharacterShouts(String sCharacterName){Apply shouts to named character. Return -1 for failure, or number of shouts applied for success. Needed because AddShout causes savegame corruption. } If _bApplyShoutsBusy Return -1 EndIf _bApplyShoutsBusy = True Int iConfigShoutHandling = GetConfigInt("SHOUTS_HANDLING") vMYC_Shoutlist.Revert() Int jCharacterShouts = GetCharacterObj(sCharacterName,"Shouts") Int i = JArray.Count(jCharacterShouts) Int iMissingCount = 0 While i > 0 i -= 1 Shout kShout = JArray.getForm(jCharacterShouts,i) as Shout If !kShout iMissingCount += 1 Else Shout kStormCallShout = GetFormFromFile(0x0007097D,"Skyrim.esm") as Shout Shout kDragonAspectShout If GetModByName("Dragonborn.esm") kDragonAspectShout = GetFormFromFile(0x0201DF92,"DragonBorn.esm") as Shout EndIf If kShout == kStormCallShout && (iConfigShoutHandling == 1 || iConfigShoutHandling == 3) ;Don't add it ElseIf kShout == kDragonAspectShout && (iConfigShoutHandling == 2 || iConfigShoutHandling == 3) ;Don't add it ElseIf GetConfigBool("SHOUTS_BLOCK_UNLEARNED") If PlayerREF.HasSpell(kShout) vMYC_ShoutList.AddForm(kShout) EndIf Else vMYC_ShoutList.AddForm(kShout) EndIf EndIf ;Debug.Trace("MYC/CM/" + sCharacterName + ": Adding Shout " + kShout + " (" + kShout.GetName() + ") to list...") EndWhile ;Debug.Trace("MYC/CM/" + sCharacterName + ": Loading " + vMYC_ShoutList.GetSize() + " Shouts to Actorbase...") If vMYC_ShoutList.GetSize() == 0 ;Debug.Trace("MYC/CM/" + sCharacterName + ": ShoutList size is 0. Won't attempt to apply this.") _bApplyShoutsBusy = False Return 0 EndIf If iMissingCount Debug.Trace("MYC/CM/" + sCharacterName + ": Loading " + vMYC_ShoutList.GetSize() + " Shouts with " + iMissingCount + " skipped.",1) Else ;Debug.Trace("MYC/CM/" + sCharacterName + ": Loaded " + vMYC_ShoutList.GetSize() + " Shouts.") EndIf FFUtils.LoadCharacterShouts(GetCharacterDummy(sCharacterName),vMYC_Shoutlist) WaitMenuMode(0.1) _bApplyShoutsBusy = False Return vMYC_ShoutList.GetSize()EndFunction
I'd like to simplify this to just add a single shout from property to an NPC, I just have no idea what the script is doing and why.
Any help or advice is appreciated.