foamyesque Posted June 17, 2017 Share Posted June 17, 2017 I'm doing some work with factions, and there's some SKSE functions (undocumented on the CK wiki, but ah well) that look like they should be quite useful for me. Unfortunately they seem to've been done kind of sloppily. My Faction.psc has the following stuff: ; SKSE additions built 2015-05-24 00:46:48.937000 UTC int property kFaction_HiddenFromNPC = 0x00000001 AutoReadOnly int property kFaction_SpecialCombat = 0x00000002 AutoReadOnly int property kFaction_TrackCrime = 0x00000010 AutoReadOnly int property kFaction_IgnoreMurder = 0x00000020 AutoReadOnly int property kFaction_IgnoreAssault = 0x00000040 AutoReadOnly int property kFaction_IgnoreStealing = 0x00000080 AutoReadOnly int property kFaction_IgnoreTrespass = 0x00000100 AutoReadOnly int property kFaction_NoReportCrime = 0x00000200 AutoReadOnly int property kFaction_CrimeGoldDefaults = 0x00000400 AutoReadOnly int property kFaction_IgnorePickpocket = 0x00000800 AutoReadOnly int property kFaction_Vendor = 0x00001000 AutoReadOnly int property kFaction_CanBeOwner = 0x00002000 AutoReadOnly int property kFaction_IgnoreWerewolf = 0x00004000 AutoReadOnly ; Not recommended unless the faction was previously a vendor ; due to the faction not having a package location the vendor ; may not be able to set up shop anywhere at all Function MakeVendor() SetFactionFlag(self.kFaction_Vendor) EndFunction bool Function IsVendor() return IsFactionFlagSet(self.kFaction_Vendor) EndFunction Function ClearVendor() ClearFactionFlag(self.kFaction_Vendor) EndFunction bool Function IsFactionFlagSet(int flag) native Function SetFactionFlag(int flag) native Function ClearFactionFlag(int flag) native bool Function OnlyBuysStolenItems() native Function SetOnlyBuysStolenItems(bool onlyStolen) native int Function GetVendorStartHour() native Function SetVendorStartHour(int hour) native int Function GetVendorEndHour() native Function SetVendorEndHour(int hour) native int Function GetVendorRadius() native Function SetVendorRadius(int radius) native ObjectReference Function GetMerchantContainer() native Function SetMerchantContainer(ObjectReference akContainer) native bool Function IsNotSellBuy() native Function SetNotSellBuy(bool notSellBuy) native FormList Function GetBuySellList() native Function SetBuySellList(FormList akList) native This appears to be the .cpp file that matches that update: https://github.com/NightQuest/SKSE/blob/master/src/skse/skse/PapyrusFaction.cpp The problems I've encountered are thus: 1. For some reason, IsVendor() always returns false.2. GetVendorEndHour() -- and this is obvious in the source code -- returns the start hour instead of the end hour. ... help? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 18, 2017 Share Posted June 18, 2017 IsVendor simply calls IsFactionFlagSet. Why not skip the isVendor step and go directly to isFactionFlagSet? Could also be the use of Self in front of the kFaction_Vendor property that is screwing things up for IsVendor. Anyway, try isFactionFlagSet directly and see if that works. GetVendorEndHour is definitely a bug. You can contact the SKSE team at their official thread at the Bethesda Forums (latest thread). At least they'll be more likely to see it there than here. Link to comment Share on other sites More sharing options...
foamyesque Posted June 18, 2017 Author Share Posted June 18, 2017 (edited) IsVendor simply calls IsFactionFlagSet. Why not skip the isVendor step and go directly to isFactionFlagSet? Could also be the use of Self in front of the kFaction_Vendor property that is screwing things up for IsVendor. Anyway, try isFactionFlagSet directly and see if that works. GetVendorEndHour is definitely a bug. You can contact the SKSE team at their official thread at the Bethesda Forums (latest thread). At least they'll be more likely to see it there than here. I haven't tried IsFactionFlagSet(), because the Papyrus code would be identical to the IsVendor() implementation. I've sent an e-mail to the address listed on the Silverlock page, but so far no answer; if I don't get one in a day or two I'll see about the Beth forums. Thanks. EDIT: Although looking at the flags I notice an odd jump in the bitmask. It goes from SpecialCombat, at x02, to TrackCrime, at x10, while all the others go x02, x04, x08, x10. I may do some inspections to see whether those flags are in fact set up correctly. Edited June 18, 2017 by foamyesque Link to comment Share on other sites More sharing options...
foamyesque Posted June 18, 2017 Author Share Posted June 18, 2017 (edited) Hokay, running some tests and I'm getting weird results outta IsFactionFlagSet(). It returns wildly incorrect values as compared to what the properties say should be returned. For example, the vendor flag appears to be what the properties are claiming is the IgnoreWerewolf flag. The Thieves Guild, which has all the ignore crime flags ticked, returns a grand total of one true flag, which is allegedly the "hidden from NPC" flag. Stuff is weird. EDIT: 0x0004000 = vendor0x0008000 = owner Edited June 18, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Recommended Posts