Starbound

Starbound

Scripted Artificial Intelligence Lattice (Customisable A.I.!)
bk3000 17 Jul, 2017 @ 12:42pm
Player's missions problem.
You mentioned in the description that "The main one is the fact that we cannot read the player's available missions via Lua." but there may be a way.
#### `bool` player.hasQuest(`String` questId)

Returns `true` if the player has a quest, in any state, with the specified quest id and `false` otherwise.

---

#### `bool` player.hasCompletedQuest(`String` questId)

Returns `true` if the player has a completed quest with the specified quest id and `false` otherwise.
Sadly they don't simply return a list of quests, but you could iterate a list you built. One problem remaining - from the object context - the player table is nil. But you could hook the player scripts to add a couple message handlers to the players, so the object can message the player. For example I have this to verify a certain player is the ship's true owner.

local bk3k_ownShip = { init = init } init = function(...) message.setHandler("is_own_shipWorld", function() return (player.worldId() == player.ownShipWorldId()) end) bk3k_ownShip.init(...) end

That could be annoying to do for every possible mission. Because you then have to keep checking for an answer for each one (that isn't answered). So rather than message the player for each one, the handler should accept a list of possible missions and return a table of boolean answers to this question.
local hasQuests = function(allMissions) local retTable = {} for _, mission in ipairs(allMissions) do retTable[mission] = player.hasQuest(mission) end return retTable end
so that your return looks like
{ apexmission1 = true, avianmission1 = true } --etc
So with that, you can verify what quests the player has available. And a similar handler to know if they've completed the quest. So you don't have to guess. That opens up another important door -
mod added mission support
I believe this mod(for example) might not be compatible as is.

http://steamproxy.net/sharedfiles/filedetails/?id=874013371

Once you have a list of their missions(and could probably ask their author to message you if they add more), you could just add those to the list of missions to check for. I don't believe it would be a problem to check for non-existent missions. If I'm wrong about that(you get errors), you could use root.assetJson() to check for specific things a particular mod adds, and in that case add their missions into the list of missions to check the status of.

If there is something you need me to clarify, let me know.
< >
Showing 1-3 of 3 comments
🐱  [developer] 17 Jul, 2017 @ 1:23pm 
Yeah, that's actually exactly what I'm doing: https://github.com/xn-5o8h/sbmod_scriptedsail/blob/master/interface/ai/aicustom.lua#L612
That's all in the interface's script, which has access to the player table
tl;dr I have a table of [aiMission, quest] and I use those functions to see if the player has them, my main problem comes from scrapping mods to get all the missions

For some reason, player.hasCompletedQuest() also returns weird things, but I don't recall exactly what
bk3000 18 Jul, 2017 @ 12:45am 
Ah I see.

As for having to look through lots of mods to collect info for support... I feel that pain for my inventory mod. Also I currently need to re-download every race mod to build racial support patches for ships, and to extract info on custom pets.
🐱  [developer] 18 Jul, 2017 @ 5:18am 
Yeah same haha, my setup is to have a collection of mods I use, unsubscribe from all of those, then subscribe to that one http://steamproxy.net/sharedfiles/filedetails/?id=880050795 (I try to keep it as up to date as possible), wait for it to download, then use a bunch of scripts to rename all the downloaded steam workshop's contents.pak into their mod's ID, move all of them in another folder, unpack them all, scrap them to find techstations and copy a patch at their locations.
I should probably do the same for quests

https://gist.github.com/GermaniumSystem/0c76d4c8871a7be7005b5631081e7854 was a big help!
< >
Showing 1-3 of 3 comments
Per page: 1530 50