Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { ['text']='test', freeze = true, affectionMin = 300, affectionMax = 500},
- function NPC:itemUpdate(player)
- --adds and removes items from the talk items based on affection level
- local Player = require 'player'
- local player = Player.factory()
- local affection = player.affection[self.name] or 0
- local props = require('npcs/' .. self.name)
- for k,v,w in pairs(self.props.talk_items) do
- if v["option"] then
- for kk,vv,ww in pairs(v["option"]) do
- if vv['affectionMin'] and vv['affectionMin'] > affection then
- if ww['affectionMax'] and ww['affectionMax'] > affection then
- table.remove(self.props.talk_items[k]["option"],kk)
- end
- elseif vv['affectionMin'] and vv['affectionMin'] < affection then
- if ww['affectionMax'] and ww['affectionMax'] < affection then
- table.remove(self.props.talk_items[k]["option"],kk)
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement