Advertisement
honey_the_codewitch

papyrus perk brew script

Sep 29th, 2021
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. Scriptname HTCW_PerkBrewCharismaScript extends activemagiceffect
  2. {Adds a Perk/Rank}
  3. Message Property HTCW_PerkBrewCharismaMessage auto const
  4. GlobalVariable Property HTCW_PerkBrewMenuFlag01 auto const
  5. GlobalVariable Property HTCW_PerkBrewMenuFlag02 auto const
  6. GlobalVariable Property HTCW_PerkBrewMenuFlag03 auto const
  7. GlobalVariable Property HTCW_PerkBrewMenuFlag04 auto const
  8. GlobalVariable Property HTCW_PerkBrewMenuFlag05 auto const
  9. GlobalVariable Property HTCW_PerkBrewMenuFlag06 auto const
  10. GlobalVariable Property HTCW_PerkBrewMenuFlag07 auto const
  11. GlobalVariable Property HTCW_PerkBrewMenuFlag08 auto const
  12. GlobalVariable Property HTCW_PerkBrewMenuFlag09 auto const
  13. GlobalVariable Property HTCW_PerkBrewMenuFlag10 auto const
  14. ActorValue Property Charisma auto const
  15. Perk Property CapCollector01 auto const
  16. Perk Property LadyKiller01 auto const
  17. Perk Property BlackWidow01 auto const
  18. Perk Property LoneWanderer01 auto const
  19. Perk Property AttackDog01 auto const
  20. Perk Property AnimalFriend01 auto const
  21. Perk Property LocalLeader01 auto const
  22. Perk Property PartyBoy01 auto const
  23. Perk Property PartyGirl01 auto const
  24. Perk Property Inspirational01 auto const
  25. Perk Property WastelandWhisperer01 auto const
  26. Perk Property Intimidation01 auto const
  27.  
  28.  
  29. Perk Function GetLastPerk(Perk firstPerk)
  30. Perk tp = firstPerk
  31. Perk p = tp.GetNextPerk()
  32. while(p!=firstPerk)
  33. tp = p;
  34. p=tp.GetNextPerk()
  35. endwhile
  36. return tp
  37. EndFunction
  38.  
  39. Function AddNextRank(Perk firstPerk)
  40. Perk fp = firstPerk
  41. while(Game.GetPlayer().HasPerk(firstPerk))
  42. firstPerk=firstPerk.GetNextPerk()
  43. if(firstPerk==fp)
  44. return
  45. endif
  46. endwhile
  47. Game.GetPlayer().AddPerk(firstPerk)
  48. endfunction
  49.  
  50. Event OnEffectStart(Actor akTarget, Actor akCaster)
  51. ; prepare the message dialog
  52. HTCW_PerkBrewMenuFlag01.SetValue((akTarget.GetBaseValue(Charisma)>0) as float * (!akTarget.HasPerk(GetLastPerk(CapCollector01))) as float)
  53. if(akTarget.GetActorBase().GetSex()==0)
  54. HTCW_PerkBrewMenuFlag02.SetValue((akTarget.GetBaseValue(Charisma)>1) as float * (!akTarget.HasPerk(GetLastPerk(LadyKiller01))) as float)
  55. Else
  56. HTCW_PerkBrewMenuFlag02.SetValue((akTarget.GetBaseValue(Charisma)>1) as float * (!akTarget.HasPerk(GetLastPerk(BlackWidow01))) as float)
  57. endif
  58. HTCW_PerkBrewMenuFlag03.SetValue((akTarget.GetBaseValue(Charisma)>2) as float * (!akTarget.HasPerk(GetLastPerk(LoneWanderer01))) as float)
  59. HTCW_PerkBrewMenuFlag04.SetValue((akTarget.GetBaseValue(Charisma)>3) as float * (!akTarget.HasPerk(GetLastPerk(AttackDog01))) as float)
  60. HTCW_PerkBrewMenuFlag05.SetValue((akTarget.GetBaseValue(Charisma)>4) as float * (!akTarget.HasPerk(GetLastPerk(AnimalFriend01))) as float)
  61. HTCW_PerkBrewMenuFlag06.SetValue((akTarget.GetBaseValue(Charisma)>5) as float * (!akTarget.HasPerk(GetLastPerk(LocalLeader01))) as float)
  62. if(akTarget.GetActorBase().GetSex()==0)
  63. HTCW_PerkBrewMenuFlag07.SetValue((akTarget.GetBaseValue(Charisma)>6) as float * (!akTarget.HasPerk(GetLastPerk(PartyBoy01))) as float)
  64. Else
  65. HTCW_PerkBrewMenuFlag07.SetValue((akTarget.GetBaseValue(Charisma)>6) as float * (!akTarget.HasPerk(GetLastPerk(PartyGirl01))) as float)
  66. endif
  67. HTCW_PerkBrewMenuFlag08.SetValue((akTarget.GetBaseValue(Charisma)>7) as float * (!akTarget.HasPerk(GetLastPerk(Inspirational01))) as float)
  68. HTCW_PerkBrewMenuFlag09.SetValue((akTarget.GetBaseValue(Charisma)>8) as float * (!akTarget.HasPerk(GetLastPerk(WastelandWhisperer01))) as float)
  69. HTCW_PerkBrewMenuFlag10.SetValue((akTarget.GetBaseValue(Charisma)>9) as float * (!akTarget.HasPerk(GetLastPerk(Intimidation01))) as float)
  70. int but = HTCW_PerkBrewCharismaMessage.Show()
  71. if(but==0)
  72. AddNextRank(CapCollector01)
  73. endif
  74. if(but==1)
  75. AddNextRank(LadyKiller01)
  76. endif
  77. if(but==2)
  78. AddNextRank(BlackWidow01)
  79. endif
  80. if(but==3)
  81. AddNextRank(LoneWanderer01)
  82. endif
  83. if(but==4)
  84. AddNextRank(AttackDog01)
  85. endif
  86. if(but==5)
  87. AddNextRank(AnimalFriend01)
  88. endif
  89. if(but==6)
  90. AddNextRank(LocalLeader01)
  91. endif
  92. if(but==7)
  93. AddNextRank(PartyBoy01)
  94. endif
  95. if(but==8)
  96. AddNextRank(PartyGirl01)
  97. endif
  98. if(but==9)
  99. AddNextRank(Inspirational01)
  100. endif
  101. if(but==10)
  102. AddNextRank(WastelandWhisperer01)
  103. endif
  104. if(but==10)
  105. AddNextRank(Intimidation01)
  106. endif
  107. EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement