[0.13] Moddable achievements

Suggestions that have been added to the game.

Moderator: ickputzdirwech

Post Reply
User avatar
bigyihsuan
Filter Inserter
Filter Inserter
Posts: 299
Joined: Thu Jan 01, 2015 12:57 pm
Contact:

[0.13] Moddable achievements

Post by bigyihsuan »

EDIT: I just found the achievements.lua file in data/base/prototypes. I'm dumb, it seems you can do everything that I suggested, but better. I also notice that there's no documentation on the achievement types.

NOTE: I don't know much about how events work, but I get the general idea. Mods, feel free to move this to Interface Requests if you feel it's better there.

This suggestion is about a way for mods to add their own achievements via an achievements.lua file.

I don't know how the current 0.13 achievements are coded into the game, but some parameters for it would be name, goal, description, and completed.

name is self-explanatory.

goal is a list, possibly of events, like on_player_death or on_tick. This defines what the goal is. When the event is done, it sets completed to true.

description is a string that allows for a short description for an achievement.

completed is a boolean that shows if the achievement is completed.

An example:

Code: Select all

--achievements.lua
data:extend({
{
     name = 'rocket-researched',
     description = 'You researched the rocket!',
     goal = on_research_finished.research.name('rocket-silo'),
     completed = false
},
{
     name = '10k-belts',
     description = '10k belts placed',
     goal = belts_placed >= 10000
     completed = false
})

belts_placed = 0
if on_robot_built_entity.created_entity.name['transport-belt'] or on_built_entity.created_entity.name['transport-belt'] do
     belts_placed = belts_placed + 1
end

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [0.13] Moddable achievements

Post by daniel34 »

Moved to Implemented Suggestions.
quick links: log file | graphical issues | wiki

Post Reply

Return to “Implemented Suggestions”