Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1.  
  2. { ['text']='test', freeze = true, affectionMin = 300, affectionMax = 500},
  3.  
  4. function NPC:itemUpdate(player)
  5.     --adds and removes items from the talk items based on affection level
  6.     local Player = require 'player'
  7.     local player = Player.factory()
  8.     local affection = player.affection[self.name] or 0
  9.     local props = require('npcs/' .. self.name)
  10.  
  11.     for k,v,w in pairs(self.props.talk_items) do
  12.         if v["option"] then
  13.             for kk,vv,ww in pairs(v["option"]) do
  14.                 if vv['affectionMin'] and vv['affectionMin'] > affection then
  15.                     if ww['affectionMax'] and ww['affectionMax'] > affection then
  16.                         table.remove(self.props.talk_items[k]["option"],kk)
  17.                     end
  18.                 elseif vv['affectionMin'] and vv['affectionMin'] < affection then
  19.                     if ww['affectionMax'] and ww['affectionMax'] < affection then
  20.                         table.remove(self.props.talk_items[k]["option"],kk)
  21.                     end
  22.                 end
  23.             end
  24.         end
  25.     end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement