Making Status Attributes change over time.

TnT90
12 Aug 2021, 15:01

I'm making a game where your stats start at 20 and decrease over time and have some objects restore them. How do I do something like that?


mrangel
12 Aug 2021, 15:24

It depends how you want them to change. After every action? Every new room? At timed intervals?

I'd probably go for at intervals based on activity. So, for example, every 5 turns. So I'd make a turnscript like:

if (HasInt (this, "delaytimer")) {
  this.count = this.count + 1
  if (this.count >= 5) {
    this.count = null
    player.strength = player.strength - 1
    // if you  want to do something when it hits zero
    // you could insert the script here or use a changescript
  }
}
else {
  this.count = 1
}

TnT90
12 Aug 2021, 16:26

Thanks. I'm planning for the attributes to decrease each action. How do I make them start at max?