Advertisement
honey_the_codewitch

Untitled

Sep 30th, 2021
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. Scriptname HTCW_PerkBrewStrengthScript extends activemagiceffect
  2. {Adds a Perk/Rank}
  3. Message Property HTCW_PerkBrewStrengthMessage 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 Strength auto const
  15. Perk Property IronFist01 auto const
  16. Perk Property BigLeagues01 auto const
  17. Perk Property Armorer01 auto const
  18. Perk Property Blacksmith01 auto const
  19. Perk Property HeavyGunner01 auto const
  20. Perk Property StrongBack01 auto const
  21. Perk Property SteadyAim01 auto const
  22. Perk Property Basher01 auto const
  23. Perk Property Rooted01 auto const
  24. Perk Property PainTrain01 auto const
  25.  
  26. Function AddNextRank(Perk firstPerk)
  27. Perk fp = firstPerk
  28. while(Game.GetPlayer().HasPerk(firstPerk))
  29. firstPerk=firstPerk.GetNextPerk()
  30. if(firstPerk==fp)
  31. return
  32. endif
  33. endwhile
  34. Game.GetPlayer().AddPerk(firstPerk)
  35. endfunction
  36.  
  37. Bool Function HasFreePerk(Actor akTarget,Perk firstPerk)
  38. int numRanks = firstPerk.GetNumRanks()
  39. Perk p = firstPerk
  40. int rank = 1
  41. while(akTarget.HasPerk(p))
  42. if(rank==numRanks)
  43. return False
  44. endif
  45. rank = rank + 1
  46. p=p.GetNextPerk()
  47. endwhile
  48. return True
  49. EndFunction
  50.  
  51. Event OnEffectStart(Actor akTarget, Actor akCaster)
  52. ; prepare the message dialog
  53. HTCW_PerkBrewMenuFlag01.SetValue((akTarget.GetBaseValue(Strength)>0) as float * (HasFreePerk(akTarget,IronFist01)) as float)
  54. HTCW_PerkBrewMenuFlag02.SetValue((akTarget.GetBaseValue(Strength)>1) as float * (HasFreePerk(akTarget,BigLeagues01)) as float)
  55. HTCW_PerkBrewMenuFlag03.SetValue((akTarget.GetBaseValue(Strength)>2) as float * (HasFreePerk(akTarget,Armorer01)) as float)
  56. HTCW_PerkBrewMenuFlag04.SetValue((akTarget.GetBaseValue(Strength)>3) as float * (HasFreePerk(akTarget,Blacksmith01)) as float)
  57. HTCW_PerkBrewMenuFlag05.SetValue((akTarget.GetBaseValue(Strength)>4) as float * (HasFreePerk(akTarget,HeavyGunner01)) as float)
  58. HTCW_PerkBrewMenuFlag06.SetValue((akTarget.GetBaseValue(Strength)>5) as float * (HasFreePerk(akTarget,StrongBack01)) as float)
  59. HTCW_PerkBrewMenuFlag07.SetValue((akTarget.GetBaseValue(Strength)>6) as float * (HasFreePerk(akTarget,SteadyAim01)) as float)
  60. HTCW_PerkBrewMenuFlag08.SetValue((akTarget.GetBaseValue(Strength)>7) as float * (HasFreePerk(akTarget,Basher01)) as float)
  61. HTCW_PerkBrewMenuFlag09.SetValue((akTarget.GetBaseValue(Strength)>8) as float * (HasFreePerk(akTarget,Rooted01)) as float)
  62. HTCW_PerkBrewMenuFlag10.SetValue((akTarget.GetBaseValue(Strength)>9) as float * (HasFreePerk(akTarget,PainTrain01)) as float)
  63. int but = HTCW_PerkBrewStrengthMessage.Show()
  64. if(but==0)
  65. AddNextRank(IronFist01)
  66. endif
  67. if(but==1)
  68. AddNextRank(BigLeagues01)
  69. endif
  70. if(but==2)
  71. AddNextRank(Armorer01)
  72. endif
  73. if(but==3)
  74. AddNextRank(Blacksmith01)
  75. endif
  76. if(but==4)
  77. AddNextRank(HeavyGunner01)
  78. endif
  79. if(but==5)
  80. AddNextRank(StrongBack01)
  81. endif
  82. if(but==6)
  83. AddNextRank(SteadyAim01)
  84. endif
  85. if(but==7)
  86. AddNextRank(Basher01)
  87. endif
  88. if(but==8)
  89. AddNextRank(Rooted01)
  90. endif
  91. if(but==9)
  92. AddNextRank(PainTrain01)
  93. endif
  94. EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement