Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Scales all reputation changes received from NPC conversation in Enroth
- -- Can be saved into a file in Scripts/Global
- -- The scaling method is a bit convoluted, but it should work with any
- -- scaling factor without losing points to rounding errors.
- local SCALE_FACTOR = 50
- vars.EnrothQuestRep = vars.EnrothQuestRep or 0
- vars.EnrothRescaledQuestRep = vars.EnrothRescaledQuestRep or 0
- local function InEnroth()
- return TownPortalControls.GetCurrentSwitch() == 3
- end
- local reputation_before, talking_with_enrothian
- function events.ShowNPCTopics()
- if talking_with_enrothian or not InEnroth() then
- return
- end
- talking_with_enrothian = true
- reputation_before = NPCFollowers.GetPartyReputation()
- end
- function events.ExitNPC()
- local need_rescaling = talking_with_enrothian
- talking_with_enrothian = false
- if not need_rescaling then
- return
- end
- local rep_change = NPCFollowers.GetPartyReputation() - reputation_before
- vars.EnrothQuestRep = vars.EnrothQuestRep + rep_change
- local new_rescaled = math.round(vars.EnrothQuestRep / SCALE_FACTOR)
- local rescaled_change = new_rescaled - vars.EnrothRescaledQuestRep
- evt.Add("Reputation", rescaled_change - rep_change)
- vars.EnrothRescaledQuestRep = new_rescaled
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement