Page 1 of 1

Achievement events + per_game property, etc...

Posted: Thu Sep 22, 2016 3:48 am
by aubergine18
Would it be possible to get:

* An `on_player_achievement` event, with `event.achievement = <achievement-name>` and `player_index = <number>` properties
* Achievement prototype properties `per_game = <boolean>` (default: `false`) and `hidden = <boolean>` (default: false)

If `per_game = true` then each time a new game is started the achievement is reset. If `hidden = true` the achievement doesn't appear to player, it's purely for event triggering & scripting.

I think this could open up quite a lot of potential for modders, because achievements will allow tracking and notification of certain things that would otherwise be very painful or gruesome for mods to implement themselves.

For example, a per-game 'build-entity-achievement' could be used as one-time trigger - mod no longer needs to worry about state, as game is already handling that internally. It would be very useful for tutorials and scenarios, progression of story, etc.

Imagine also if some new achievement types were added to take advantage of `per_game` property, for example a `discovery_achievement` where prototype specifies name and type of thing to be discovered. Now I can get one time events when player discovers a specific terrain (tile type), decoration, entity, enemy, etc... Script could then provide hits to player - for example, on first discovery of water player told that fish = food = restore health. To have a Lua script work out when the first time player encounters something will be slow and clunky; but I bet there's really fast way to do it in C.

Re: Achievement events + per_game property, etc...

Posted: Thu Sep 22, 2016 1:16 pm
by aubergine18
`discovery_achievement` could be evaluated when chunks are generated to avoid lag