reputation system questions
Hidden moo
23 Nov 2018, 08:18Hello I was wondering if it is possible to setup a reputation system in quest.
For example I want to have the player be able to ask favors of npcs but it only works if they like you and the player needs to gain favor with multiple npcs to continue. So a basic + - rep feature, (bob rep 5 gorge rep -2 ect.)

CheeseMyBaby
23 Nov 2018, 09:25Give the player object an attribute called whatever you like reputation
or rep
.
Give it an initial value. Possibly of 0
if the player starts out with no reputation.
Everytime the player gains reputation do player.reputation = player.reputation + 1
(or - 1
if you want the value to decrease)
Then you simply need to check the value every time the player is trying to do something that requires a certain amount of reputation. There more than one way of doing this.
I'd probably go for a switch.
switch (player.reputation) {
case (1) {
// Script what's supposed to happen if player.reputation = 1 here
}
case (2) {
// Script what's supposed to happen if player.reputation = 2 here
}
default {
// Script a default response here
}
}
The above code simply checks the value of the player.reputation
attribute and then fires a different script based on that.
You can put the switch in a function, in the ask script, in the... actually, pretty much anywhere you'd like.