Advertisement
Uissu

[X-TIBIA][ACTION] Sacrifice 6 books to create a NPC

Feb 6th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. function onUse(cid, item, frompos, item2, topos)
  2.     local positions, npcpos, books, countBooks, tableBooks = {}, {x=759,y=827,z=7,stackpos=1}, {10309, 10310, 10311, 10312, 10314, 10215}, 0, {}
  3.     for x = 1,6 do
  4.         table.insert(positions, {x=756+x,y=828,z=7,stackpos=1})
  5.     end
  6.     if item.itemid == 1945 then
  7.         for i,pos in pairs(positions) do
  8.             book = getThingFromPos(pos)
  9.             if book.itemid == books[i] then
  10.                 table.insert(tableBooks, {pos, books[i]})
  11.                 countBooks = countBooks+1
  12.             end
  13.         end
  14.         if countBooks == 6 then
  15.             for _,value in pairs(tableBooks) do
  16.                 book = getThingFromPos(value[1])
  17.                 if book.itemid == value[2] then
  18.                     doRemoveItem(book.uid, 1)
  19.                     doTransformItem(item.uid,item.itemid+1)
  20.                     doCreateNpc('Shenron', npcpos)
  21.                 end
  22.             end
  23.         else
  24.             doPlayerSendCancel(cid, "You need at least ".. 6-(countBooks).." books as sacrifice to summon Shenron.")
  25.         end
  26.     else
  27.         doPlayerSendTextMessage(cid,22,"It doesn't seems to work.")
  28.     end
  29. return true
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement