Skip to content

Instantly share code, notes, and snippets.

@8bitgentleman
Last active August 29, 2015 14:05
Show Gist options
  • Save 8bitgentleman/b638d448789c42e64790 to your computer and use it in GitHub Desktop.
Save 8bitgentleman/b638d448789c42e64790 to your computer and use it in GitHub Desktop.
hide npc items based on affection
--this is an example of what talk_items could look like in the npc's file
{ ['text']='test', affectionMin=200, affectionMax=400 },
--in iventory before you load the table of commands run function commandUpdate() to add/remove based on affection level
update = function(dt, npc, player)
local talkTable = (talk_items or {}) --self.commands[item.text]
local affection = player.affection.hilda or 0
if npc.menu.state ~= "closed" then
--look in the table for {{ min, max }}
if affection >= affectionMin and affection<= affectionMax then
--return comTable
else
--remove text from table
table.remove(text, test)
--return comTable
end
end
end,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment