Quantcast
Channel: Tibia.net.pl - welcome to OpenTibia community
Viewing all articles
Browse latest Browse all 3598

Skrypty & Kody Pomoc npc. 7.6 LUA

$
0
0
Witam wszystkichh :)
mam takie pytanie, co jest tutaj źle zrobione, że jak pisze do NPC to rozpisuje mi sie tylko na temat pacc oraz czary, ale np jak napisz sorc, knight , domki albo cos innego to juz nie trybi :P:vroam:
Kod Lua:
  1. focus = 0
  2. talk_start = 0
  3. target = 0
  4. following = false
  5. attacking = false
  6.  
  7. function onThingMove(creature, thing, oldpos, oldstackpos)
  8.  
  9. end
  10.  
  11.  
  12. function onCreatureAppear(creature)
  13.  
  14. end
  15.  
  16.  
  17. function onCreatureDisappear(cid, pos)
  18. if focus == cid then
  19. selfSay('Good bye then.')
  20. focus = 0
  21. talk_start = 0
  22. end
  23. end
  24.  
  25.  
  26. function onCreatureTurn(creature)
  27.  
  28. end
  29.  
  30.  
  31. function msgcontains(txt, str)
  32. return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
  33. end
  34.  
  35.  
  36. function onCreatureSay(cid, type, msg)
  37. msg = string.lower(msg)
  38.  
  39. if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
  40. selfSay('Siemanko ' .. creatureGetName(cid) .. '! Co bys chcial wiedziec na temat servera? /n "pacc" /n "czary /n "przedmioty" /n "przedzial" /n "domki". ')
  41. focus = cid
  42. talk_start = os.clock()
  43.  
  44. elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  45. selfSay('Przykro mi, ' .. creatureGetName(cid) .. '! Musisz chwileczke zaczekac.')
  46.  
  47. elseif focus == cid then
  48. talk_start = os.clock()
  49.  
  50. if msgcontains(msg, 'pacc') then
  51. selfSay('Witaj! Pacc runa (60h) kosztuje sms 3.76 zl /n Pacc runa (180h) kosztuje sms 11.07 zl. /n Jezeli jestesmy w posiadaniu PACCa to mamy dostep do nowych potworow, przedmiotow, questow oraz czarow, a takze mozemy kupowac domki.')
  52. elseif msgcontains(msg, 'czary') then
  53. selfSay('Aby korzystac z nowych czarow, trzeba posiadac PACC! Czary dla jakiej profesji Cie interesuja? "Sorc" , "Druid" , "Pall" , "Knight" .')
  54. elseif msgcontains(msg, 'Sorc') then
  55. selfSay('Death sio "nick od 45 poziomu magicznego.')
  56. elseif msgcontains(msg, 'Druid') then
  57. selfSay('Druid posiada dostep do run paralizujacych (od 35 poz. magicznego) oraz z tzw. "krzakow" (od 35 poz. magicznego) . /n Rowniez posiada czar Death sio "nick od 45 poziomu magicznego.')
  58. elseif msgcontains(msg, 'Pall') then
  59. selfSay('Exura San (od 13 poz. mag.) /n Exura Gran San (od 23 poz. mag.) /n Utamo Tempo San (od 15 poz. mag.) /n Exevo Mas San (od 20 poz. mag.) /n Poison sio "nick ( od 17 poz. mag.) .')
  60. elseif msgcontains(msg, 'Knight') then
  61. selfSay('Exana Mort (od 3 poz. mag.) /n Utani Tempo Hur (od 5 poz. mag) /n Exori mas (od 4 poz. mag.) Exori Gran (od 7 poz. mag.) /n Explosion sio"nick (od 4 poz. mag.).')
  62. elseif msgcontains(msg, 'Przedmioty') then
  63. selfSay('Na serverze sa przedmioty, ktore dodaja mane/hp, rowniez sa nowe bronie, ktorych moc sie nie konczy! Sa rowniez pierscienie, ktore daja 2x wiecej expa, ale nic nie przebije EQ, ktore redukuje 25% zadawanych obrazen i drugie 25% dodaje do atakow ;)!!')
  64. elseif msgcontains(msg, 'Przedzial') then
  65. selfSay('Server posiada bramki PvP /n 1-50, /n 51-100, /n 101-150, /n 151-200, /n 201-300, /n 301-500, /n 501+ .')
  66. elseif msgcontains(msg, 'Domki') then
  67. selfSay('Domku kupujemy komenda !buyhouse. Aby kupic domek musimy posiadac pacc, jak i zarowno setny poziom.')
  68.  
  69.  
  70. elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
  71. selfSay('Powodzenia, ' .. creatureGetName(cid) .. '!')
  72. focus = 0
  73. talk_start = 0
  74. end
  75. end
  76. end
  77.  
  78.  
  79. function onCreatureChangeOutfit(creature)
  80.  
  81. end
  82.  
  83.  
  84. function onThink()
  85. if (os.clock() - talk_start) > 30 then
  86. if focus > 0 then
  87. selfSay('Zobaczymy czy wam sie uda...')
  88. end
  89. focus = 0
  90. end
  91. if focus ~= 0 then
  92. if getDistanceToCreature(focus) > 5 then
  93. selfSay('Good bye then.')
  94. focus = 0
  95. end
  96. end
  97. end

Viewing all articles
Browse latest Browse all 3598