SameOldBard Posted April 10 Share Posted April 10 Last noob question of the day, I promise. How can I figure out the level of a perk an Actor has through code? Thanks, SameOldBard Link to comment Share on other sites More sharing options...
LarannKiar Posted April 11 Share Posted April 11 (edited) Function GetPerkRank() is not exposed to Papyrus but you can utilize it through ConditionForms. Create 4 ConditionForms in SF1Edit, each one should have only one condition item at Condition #0. Condition data ---> Type: Equal to; Comparison Value: X; Function: GetPerkRank; Perk: YourPerk; Run on: Subject. X = the PerkRank you want the ConditionForm to look for. So, by creating 4 ConditionForms with Comparison values 1, 2, 3, 4, only one ConditionForm would return True. And the one that returns True tells the PerkRank of theTargetReference. In Papyrus: ConditionForm HasPerkRank1 = (Game.GetFormFromFile(0x123, "YourMod.esp") as ConditionForm) ConditionForm HasPerkRank2 = (Game.GetFormFromFile(0x456, "YourMod.esp") as ConditionForm) If HasPerkRank1.IsTrue(theTargetReference, theTargetReference) Debug.MessageBox("theTargetReference has Rank 1 of the perk defined in the ConditionForm data") ElseIf HasPerkRank2.IsTrue(theTargetReference, theTargetReference) Debug.MessageBox("theTargetReference has Rank 2 of the perk defined in the ConditionForm data") EndIf 0x123 and 0x456 ---> replace these with the FormIDs of the ConditionForms "YourMod.esp" ---> replace with the name of the where this ConditionForm lives theTargetReference ---> replace with the Actor Reference you want the ConditionForm function GetPerkRank to be called on Edited April 11 by LarannKiar Link to comment Share on other sites More sharing options...
aurreth Posted April 11 Share Posted April 11 Seriously, no case statement in Papyrus? Sad. Link to comment Share on other sites More sharing options...
SameOldBard Posted April 11 Author Share Posted April 11 24 minutes ago, LarannKiar said: Function GetPerkRank() is not exposed to Papyrus but you can utilize it through ConditionForms. Create 4 ConditionForms in SF1Edit, each one should have only one condition item at Condition #0. Condition data ---> Type: Equal to; Comparison Value: X; Function: GetPerkRank; Perk: YourPerk; Run on: Subject. X = the PerkRank you want the ConditionForm to look for. So, by creating 4 ConditionForms with Comparison values 1, 2, 3, 4, only one ConditionForm would return True. And the one that returns True tells the PerkRank of theTargetReference. In Papyrus: ConditionForm HasPerkRank1 = (Game.GetFormFromFile(0x123, "YourMod.esp") as ConditionForm) ConditionForm HasPerkRank2 = (Game.GetFormFromFile(0x456, "YourMod.esp") as ConditionForm) If HasPerkRank1.IsTrue(theTargetReference, theTargetReference) Debug.MessageBox("theTargetReference has Rank 1 of the perk defined in the ConditionForm data") ElseIf HasPerkRank2.IsTrue(theTargetReference, theTargetReference) Debug.MessageBox("theTargetReference has Rank 2 of the perk defined in the ConditionForm data") EndIf 0x123 and 0x456 ---> replace these with the FormIDs of the ConditionForms "YourMod.esp" ---> replace with the name of the where this ConditionForm lives theTargetReference ---> replace with the Actor Reference you want the ConditionForm function GetPerkRank to be called on Woo. Thanks. That certainly will do. Link to comment Share on other sites More sharing options...
Recommended Posts