Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname HTCW_PerkBrewStrengthScript extends activemagiceffect
- {Adds a Perk/Rank}
- Message Property HTCW_PerkBrewStrengthMessage auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag01 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag02 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag03 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag04 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag05 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag06 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag07 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag08 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag09 auto const
- GlobalVariable Property HTCW_PerkBrewMenuFlag10 auto const
- ActorValue Property Strength auto const
- Perk Property IronFist01 auto const
- Perk Property BigLeagues01 auto const
- Perk Property Armorer01 auto const
- Perk Property Blacksmith01 auto const
- Perk Property HeavyGunner01 auto const
- Perk Property StrongBack01 auto const
- Perk Property SteadyAim01 auto const
- Perk Property Basher01 auto const
- Perk Property Rooted01 auto const
- Perk Property PainTrain01 auto const
- Function AddNextRank(Perk firstPerk)
- Perk fp = firstPerk
- while(Game.GetPlayer().HasPerk(firstPerk))
- firstPerk=firstPerk.GetNextPerk()
- if(firstPerk==fp)
- return
- endif
- endwhile
- Game.GetPlayer().AddPerk(firstPerk)
- endfunction
- Bool Function HasFreePerk(Actor akTarget,Perk firstPerk)
- int numRanks = firstPerk.GetNumRanks()
- Perk p = firstPerk
- int rank = 1
- while(akTarget.HasPerk(p))
- if(rank==numRanks)
- return False
- endif
- rank = rank + 1
- p=p.GetNextPerk()
- endwhile
- return True
- EndFunction
- Event OnEffectStart(Actor akTarget, Actor akCaster)
- ; prepare the message dialog
- HTCW_PerkBrewMenuFlag01.SetValue((akTarget.GetBaseValue(Strength)>0) as float * (HasFreePerk(akTarget,IronFist01)) as float)
- HTCW_PerkBrewMenuFlag02.SetValue((akTarget.GetBaseValue(Strength)>1) as float * (HasFreePerk(akTarget,BigLeagues01)) as float)
- HTCW_PerkBrewMenuFlag03.SetValue((akTarget.GetBaseValue(Strength)>2) as float * (HasFreePerk(akTarget,Armorer01)) as float)
- HTCW_PerkBrewMenuFlag04.SetValue((akTarget.GetBaseValue(Strength)>3) as float * (HasFreePerk(akTarget,Blacksmith01)) as float)
- HTCW_PerkBrewMenuFlag05.SetValue((akTarget.GetBaseValue(Strength)>4) as float * (HasFreePerk(akTarget,HeavyGunner01)) as float)
- HTCW_PerkBrewMenuFlag06.SetValue((akTarget.GetBaseValue(Strength)>5) as float * (HasFreePerk(akTarget,StrongBack01)) as float)
- HTCW_PerkBrewMenuFlag07.SetValue((akTarget.GetBaseValue(Strength)>6) as float * (HasFreePerk(akTarget,SteadyAim01)) as float)
- HTCW_PerkBrewMenuFlag08.SetValue((akTarget.GetBaseValue(Strength)>7) as float * (HasFreePerk(akTarget,Basher01)) as float)
- HTCW_PerkBrewMenuFlag09.SetValue((akTarget.GetBaseValue(Strength)>8) as float * (HasFreePerk(akTarget,Rooted01)) as float)
- HTCW_PerkBrewMenuFlag10.SetValue((akTarget.GetBaseValue(Strength)>9) as float * (HasFreePerk(akTarget,PainTrain01)) as float)
- int but = HTCW_PerkBrewStrengthMessage.Show()
- if(but==0)
- AddNextRank(IronFist01)
- endif
- if(but==1)
- AddNextRank(BigLeagues01)
- endif
- if(but==2)
- AddNextRank(Armorer01)
- endif
- if(but==3)
- AddNextRank(Blacksmith01)
- endif
- if(but==4)
- AddNextRank(HeavyGunner01)
- endif
- if(but==5)
- AddNextRank(StrongBack01)
- endif
- if(but==6)
- AddNextRank(SteadyAim01)
- endif
- if(but==7)
- AddNextRank(Basher01)
- endif
- if(but==8)
- AddNextRank(Rooted01)
- endif
- if(but==9)
- AddNextRank(PainTrain01)
- endif
- EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement