GeneralPallas Posted January 16, 2015 Share Posted January 16, 2015 I have the script below, which checks to see if the player is a Thane of various holds. I'm calling this script from my MCM menu; however, it doesn't matter which hold I'm a Thane of every function is returning false. Scriptname RKCheckThaneStatusScript extends Quest FavorJarlsMakeFriendsScript Property jarlsMakeFriendsScript Auto Event OnInit() jarlsMakeFriendsScript = Game.GetForm(0x00087E24) As FavorJarlsMakeFriendsScript EndEvent Bool Function isThaneOfEastmarch() If (jarlsMakeFriendsScript.EastmarchImpGetOutofJail > 0 || jarlsMakeFriendsScript.EastmarchSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfFalkreath() If (jarlsMakeFriendsScript.FalkreathImpGetOutofJail > 0 || jarlsMakeFriendsScript.FalkreathSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfHaafingar() If (jarlsMakeFriendsScript.HaafingarImpGetOutofJail > 0 || jarlsMakeFriendsScript.HaafingarSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfHjaalmarch() If (jarlsMakeFriendsScript.HjaalmarchImpGetOutofJail > 0 || jarlsMakeFriendsScript.HjaalmarchSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfThePale() If (jarlsMakeFriendsScript.PaleImpGetOutofJail > 0 || jarlsMakeFriendsScript.PaleSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfTheReach() If (jarlsMakeFriendsScript.ReachImpGetOutofJail > 0 || jarlsMakeFriendsScript.ReachSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfTheRift() If (jarlsMakeFriendsScript.RiftImpGetOutofJail > 0 || jarlsMakeFriendsScript.RiftSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfWhiterun() If (jarlsMakeFriendsScript.WhiterunImpGetOutofJail > 0 || jarlsMakeFriendsScript.WhiterunSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfWinterhold() If (jarlsMakeFriendsScript.WinterholdImpGetOutofJail > 0 || jarlsMakeFriendsScript.WinterholdSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Can someone please help guide me in the right direction? Link to comment Share on other sites More sharing options...
smashly Posted January 16, 2015 Share Posted January 16, 2015 (edited) Hi,The reason it's failing is your querying a new instance of the FavorJarlsMakeFriendsScript that doesn't have properties set. Maybe Get the Quest and pas it as the script eg: (Quest.GetQuest("FavorJarlsMakeFriends") As FavorJarlsMakeFriendsScript).EastmarchImpGetOutofJail > 0I tested this with out declaring Properties for FavorJarlsMakeFriendsScript or the OnInit() and it works. Here's your script back, just assign the quest property in the CK (It compiles but I haven't tested it) Scriptname RKCheckThaneStatusScript extends Quest Quest Property FJMFQuest Auto ;Assign this property to the FavorJarlsMakeFriends quest in CK Bool Function isThaneOfEastmarch() If ((FJMFQuest As FavorJarlsMakeFriendsScript).EastmarchImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).EastmarchSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfFalkreath() If ((FJMFQuest As FavorJarlsMakeFriendsScript).FalkreathImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).FalkreathSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfHaafingar() If ((FJMFQuest As FavorJarlsMakeFriendsScript).HaafingarImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).HaafingarSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfHjaalmarch() If ((FJMFQuest As FavorJarlsMakeFriendsScript).HjaalmarchImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).HjaalmarchSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfThePale() If ((FJMFQuest As FavorJarlsMakeFriendsScript).PaleImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).PaleSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfTheReach() If ((FJMFQuest As FavorJarlsMakeFriendsScript).ReachImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).ReachSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfTheRift() If ((FJMFQuest As FavorJarlsMakeFriendsScript).RiftImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).RiftSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfWhiterun() If ((FJMFQuest As FavorJarlsMakeFriendsScript).WhiterunImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).WhiterunSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Bool Function isThaneOfWinterhold() If ((FJMFQuest As FavorJarlsMakeFriendsScript).WinterholdImpGetOutofJail > 0 || (FJMFQuest As FavorJarlsMakeFriendsScript).WinterholdSonsGetOutofJail > 0) return true Else return false EndIf EndFunction Edited January 16, 2015 by smashly Link to comment Share on other sites More sharing options...
GeneralPallas Posted January 16, 2015 Author Share Posted January 16, 2015 If you don't mind me asking, what's the purpose of using the As FavorJarlsMakeFriendsScriptif you're not going to declare it once and use variable in all the if statements? Link to comment Share on other sites More sharing options...
smashly Posted January 16, 2015 Share Posted January 16, 2015 (edited) I'm declaring the Quest is what I'm using, the quest is not a script.So I use the quest to call it's attached script. Myself I would not do it the way you have it. I would have 1 function which you would feed a parameter and it returns the value for that parameter.. Edit:Here's what I did as a standalone function, no properties needed, just pass the hold string (eg: "Falkreath") to the function and it returns true or false, tested it in a mod I was working on and it works.Bool Function isThaneOf(String sHold) FavorJarlsMakeFriendsScript FJMFS = Quest.GetQuest("FavorJarlsMakeFriends") As FavorJarlsMakeFriendsScript If sHold == "Eastmarch" If FJMFS.EastmarchImpGetOutofJail > 0 || FJMFS.EastmarchSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Falkreath" If FJMFS.FalkreathImpGetOutofJail > 0 || FJMFS.FalkreathSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Haafingar" If FJMFS.HaafingarImpGetOutofJail > 0 || FJMFS.HaafingarSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Hjaalmarch" If FJMFS.HjaalmarchImpGetOutofJail > 0 || FJMFS.HjaalmarchSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Pale" If FJMFS.PaleImpGetOutofJail > 0 || FJMFS.PaleSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Reach" If FJMFS.ReachImpGetOutofJail > 0 || FJMFS.ReachSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Rift" If FJMFS.RiftImpGetOutofJail > 0 || FJMFS.RiftSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Whiterun" If FJMFS.WhiterunImpGetOutofJail > 0 || FJMFS.WhiterunSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Winterhold" If FJMFS.WinterholdImpGetOutofJail > 0 || FJMFS.WinterholdSonsGetOutofJail > 0 Return True EndIf EndIf Return False EndFunction Edited January 16, 2015 by smashly Link to comment Share on other sites More sharing options...
GeneralPallas Posted January 17, 2015 Author Share Posted January 17, 2015 I just got a chance to try that out. Unfortunately it's giving me errors with your second line saying that GetQuest is not a function or does not existAny idea what could cause that since it works for you? Link to comment Share on other sites More sharing options...
smashly Posted January 18, 2015 Share Posted January 18, 2015 (edited) Bit anxious on the post button, double posted Edited January 18, 2015 by smashly Link to comment Share on other sites More sharing options...
smashly Posted January 18, 2015 Share Posted January 18, 2015 Should of mentioned GetQuest requires SKSE. I found the function on the CK Wiki, not sure what version of SKSE introduced GetQuest as the wiki doesn't say. http://www.creationkit.com/GetQuest_-_Quest If not wanting to use SKSE then Declare the Quest as a script property outside the function, there goes standalone....lol (untested, but imagine it would work the same) eg: Quest Property FJMFQuest Auto ;Assign this property to the FavorJarlsMakeFriends quest in CK Bool Function isThaneOf(String sHold) FavorJarlsMakeFriendsScript FJMFS = FJMFQuest As FavorJarlsMakeFriendsScript If sHold == "Eastmarch" If FJMFS.EastmarchImpGetOutofJail > 0 || FJMFS.EastmarchSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Falkreath" If FJMFS.FalkreathImpGetOutofJail > 0 || FJMFS.FalkreathSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Haafingar" If FJMFS.HaafingarImpGetOutofJail > 0 || FJMFS.HaafingarSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Hjaalmarch" If FJMFS.HjaalmarchImpGetOutofJail > 0 || FJMFS.HjaalmarchSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Pale" If FJMFS.PaleImpGetOutofJail > 0 || FJMFS.PaleSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Reach" If FJMFS.ReachImpGetOutofJail > 0 || FJMFS.ReachSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Rift" If FJMFS.RiftImpGetOutofJail > 0 || FJMFS.RiftSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Whiterun" If FJMFS.WhiterunImpGetOutofJail > 0 || FJMFS.WhiterunSonsGetOutofJail > 0 Return True EndIf ElseIf sHold == "Winterhold" If FJMFS.WinterholdImpGetOutofJail > 0 || FJMFS.WinterholdSonsGetOutofJail > 0 Return True EndIf EndIf Return False EndFunction Link to comment Share on other sites More sharing options...
smashly Posted January 18, 2015 Share Posted January 18, 2015 (edited) Yep, just tested the above and it works fine for me, also tried a stripped version of the function less the If/EndIf's Quest Property FJMFQuest Auto ;Assign this property to the FavorJarlsMakeFriends quest in CK Bool Function isThaneOf(String sHold) FavorJarlsMakeFriendsScript FJMFS = FJMFQuest As FavorJarlsMakeFriendsScript If (sHold == "Eastmarch") && (FJMFS.EastmarchImpGetOutofJail > 0 || FJMFS.EastmarchSonsGetOutofJail > 0) Return True ElseIf (sHold == "Falkreath") && (FJMFS.FalkreathImpGetOutofJail > 0 || FJMFS.FalkreathSonsGetOutofJail > 0) Return True ElseIf (sHold == "Haafingar") && (FJMFS.HaafingarImpGetOutofJail > 0 || FJMFS.HaafingarSonsGetOutofJail > 0) Return True ElseIf (sHold == "Hjaalmarch") && (FJMFS.HjaalmarchImpGetOutofJail > 0 || FJMFS.HjaalmarchSonsGetOutofJail > 0) Return True ElseIf (sHold == "Pale") && (FJMFS.PaleImpGetOutofJail > 0 || FJMFS.PaleSonsGetOutofJail > 0) Return True ElseIf (sHold == "Reach") && (FJMFS.ReachImpGetOutofJail > 0 || FJMFS.ReachSonsGetOutofJail > 0) Return True ElseIf (sHold == "Rift") && (FJMFS.RiftImpGetOutofJail > 0 || FJMFS.RiftSonsGetOutofJail > 0) Return True ElseIf (sHold == "Whiterun") && (FJMFS.WhiterunImpGetOutofJail > 0 || FJMFS.WhiterunSonsGetOutofJail > 0) Return True ElseIf (sHold == "Winterhold") && (FJMFS.WinterholdImpGetOutofJail > 0 || FJMFS.WinterholdSonsGetOutofJail > 0) Return True EndIf Return False EndFunctionAnd yes I ran that from in a MCM menu in a loop against array of all the hold names, just in case your wondering :) Edited January 18, 2015 by smashly Link to comment Share on other sites More sharing options...
GeneralPallas Posted January 18, 2015 Author Share Posted January 18, 2015 haha well then I'm apparently doing something wrong on my end, because I'm still getting false everytime. Link to comment Share on other sites More sharing options...
smashly Posted January 18, 2015 Share Posted January 18, 2015 Are you assigning the FJMFQuest property to FavorJarlsMakeFriends quest in the CK? Link to comment Share on other sites More sharing options...
Recommended Posts