Last active
August 29, 2015 14:05
-
-
Save 8bitgentleman/b638d448789c42e64790 to your computer and use it in GitHub Desktop.
hide npc items based on affection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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