Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname FOMiami:Misc:ReputationSystem extends Quest
- Actor Player
- Event OnQuestInit()
- Player = Game.GetPlayer()
- EndEvent
- Function RepuUp(int RepPoints, Faction myFaction) ;Increases the points of the chosen faction by the value the of RepPoints
- GetCurrentRepPoints(myFaction) ;A seperate function that checks which faction the player should get the points for
- FactionPoints[Selector].setValue(FactionPoints[Selector].getValue()+ RepPoints) ;
- RepNotification[Selector].show() ;Let's the Player now that is reputation gots increased
- 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)
- Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) + 1)
- ChangePerk(myFaction, -1) ;ChangePerk to current Rank
- FactionPoints[Selector].setValue(1000)
- elseif FactionPoints[Selector].getValue() >= 2000
- Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) + 4)
- ChangePerk(myFaction, -4) ;ChangePerk to current Rank
- endif
- Debug.Messagebox("The Reputation with "+myfaction+" has increased by "+Factionpoints[Selector]+" points!")
- EndFunction
- Function RepuDown(int RepPoints, Faction myFaction)
- GetCurrentRepPoints(myFaction)
- FactionPoints[Selector].setValue(FactionPoints[Selector].getValue()- RepPoints)
- RepNotification[Selector].show()
- if FactionPoints[Selector].getValue() < 0 && Player.getFactionRank(myFaction) > 3
- Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) - 4)
- ChangePerk(myFaction, 4) ;ChangePerk to current Rank
- FactionPoints[Selector].setValue(1000)
- elseif FactionPoints[Selector].getValue() < 0 && Player.getFactionRank(myFaction) <= 3
- Player.setFactionRank(myFaction, Player.getFactionRank(myFaction) - 1)
- ChangePerk(myFaction, 1) ;ChangePerk to current Rank
- FactionPoints[Selector].setValue(1000)
- endif
- Debug.Messagebox("The Reputation with "+myfaction+" has decreased by "+Factionpoints[Selector]+" points!")
- EndFunction
- Function GetCurrentRepPoints(Faction myFaction) ;A function to detect the Faction in which the player is
- int i = 0
- while i < ThisFaction.length
- if myFaction == ThisFaction[i]
- Selector = i
- endif
- i += 1
- Debug.Notification("i="+i)
- endwhile
- Endfunction
- Function ChangePerk(Faction myFaction, int myInt) ;A function that detecs the repu faction which needs to get updated and then swaps the perks out
- AddRepPerk = AllRepPerk[Player.getFactionRank(myFaction)+(16*selector)]
- RemoveRepPerk = AllRepPerk[Player.getFactionRank(myFaction)+(16*selector)+myint]
- Player.RemovePerk(RemoveRepPerk)
- Player.RemovePerk(addRepPerk)
- EndFunction
- Faction[] Property ThisFaction Auto Const
- int property Selector Auto ;To select the right perk or factionrank
- GlobalVariable[] Property FactionPoints Auto Const ;The points of all the factions
- Message[] Property RepNotification Auto ;All reps up and down messages
- Perk Property AddRepPerk Auto ;All Reputation perks that will be shown in the Pip-boy
- Perk Property RemoveRepPerk Auto
- Perk[] Property AllRepPerk Auto Const ;collection of all perks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement