Advertisement
DieFeM

Player

May 26th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. Scriptname FOMiami:Misc:ReputationSystem extends Quest
  2.  
  3. Actor Player
  4.  
  5. Event OnQuestInit()
  6. Player = Game.GetPlayer()
  7. EndEvent
  8.  
  9. Function RepuUp(int RepPoints, Faction myFaction) ;Increases the points of the chosen faction by the value the of RepPoints
  10. GetCurrentRepPoints(myFaction) ;A seperate function that checks which faction the player should get the points for
  11. FactionPoints[Selector].setValue(FactionPoints[Selector].getValue()+ RepPoints) ;
  12. RepNotification[Selector].show() ;Let's the Player now that is reputation gots increased
  13. if FactionPoints[Selector].getValue() >= 2000 && (Player.getFactionRank(myFaction) != 3 || Player.getFactionRank(myFaction) != 6 || Player.getFactionRank(myFaction) != 9 || Player.getFactionRank(myFaction) != 12 || Player.getFactionRank(myFaction) != 15)
  14. Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) + 1)
  15. ChangePerk(myFaction, -1) ;ChangePerk to current Rank
  16. FactionPoints[Selector].setValue(1000)
  17. elseif FactionPoints[Selector].getValue() >= 2000
  18. Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) + 4)
  19. ChangePerk(myFaction, -4) ;ChangePerk to current Rank
  20. endif
  21. Debug.Messagebox("The Reputation with "+myfaction+" has increased by "+Factionpoints[Selector]+" points!")
  22. EndFunction
  23.  
  24. Function RepuDown(int RepPoints, Faction myFaction)
  25. GetCurrentRepPoints(myFaction)
  26. FactionPoints[Selector].setValue(FactionPoints[Selector].getValue()- RepPoints)
  27. RepNotification[Selector].show()
  28. if FactionPoints[Selector].getValue() < 0 && Player.getFactionRank(myFaction) > 3
  29. Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) - 4)
  30. ChangePerk(myFaction, 4) ;ChangePerk to current Rank
  31. FactionPoints[Selector].setValue(1000)
  32. elseif FactionPoints[Selector].getValue() < 0 && Player.getFactionRank(myFaction) <= 3
  33. Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) - 1)
  34. ChangePerk(myFaction, 1) ;ChangePerk to current Rank
  35. FactionPoints[Selector].setValue(1000)
  36. endif
  37. Debug.Messagebox("The Reputation with "+myfaction+" has decreased by "+Factionpoints[Selector]+" points!")
  38. EndFunction
  39.  
  40. Function GetCurrentRepPoints(Faction myFaction) ;A function to detect the Faction in which the player is
  41. int i = 0
  42. while i < ThisFaction.length
  43. if myFaction == ThisFaction[i]
  44. Selector = i
  45. endif
  46. i += 1
  47. Debug.Notification("i="+i)
  48. endwhile
  49. Endfunction
  50.  
  51. Function ChangePerk(Faction myFaction, int myInt) ;A function that detecs the repu faction which needs to get updated and then swaps the perks out
  52. AddRepPerk = AllRepPerk[Player.getFactionRank(myFaction)+(16*selector)]
  53. RemoveRepPerk = AllRepPerk[Player.getFactionRank(myFaction)+(16*selector)+myint]
  54. Player.RemovePerk(RemoveRepPerk)
  55. Player.RemovePerk(addRepPerk)
  56. EndFunction
  57.  
  58. Faction[] Property ThisFaction Auto Const
  59.  
  60. int property Selector Auto ;To select the right perk or factionrank
  61.  
  62. GlobalVariable[] Property FactionPoints Auto Const ;The points of all the factions
  63.  
  64. Message[] Property RepNotification Auto ;All reps up and down messages
  65.  
  66. Perk Property AddRepPerk Auto ;All Reputation perks that will be shown in the Pip-boy
  67. Perk Property RemoveRepPerk Auto
  68. Perk[] Property AllRepPerk Auto Const ;collection of all perks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement