reputation system questions

Hello 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.)


Give the player object an attribute called whatever you like reputationor rep.
Give it an initial value. Possibly of 0if 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.reputationattribute 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.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums