Quote from: alexgleason on October 25, 2018, 03:15:55 AM
The only thing blocking me is that Solarus doesn't seem to have a way to list all the possible items in the quest, so I can't loop through them.
Here's a bit of a hack, but you can get the names of all items in your quest by reading the contents of the project_db.dat file:
Code (lua) Select
local function get_all_items()
local all_items = {}
local env = {}
function env.item(properties)
local id = properties.id
assert(type(id)=="string", "item id must be a string")
table.insert(all_items, id)
end
setmetatable(env, {__index = function() return function() end end})
local chunk = sol.main.load_file("project_db.dat")
setfenv(chunk, env)
chunk()
return all_items
end
Then you can use game:get_item(item_name) to convert the item names into item objects.