What's new

Problem z NPC ;/

Status
Not open for further replies.

ArekDrax98

Active User
Joined
May 6, 2010
Messages
72
Reaction score
1
Witam mam mianowicie taki problem ze gdy wlacze silnik wyskakuje taki blad SS:
beztytuugc.png


A oto kod npc :
PHP:
focus = 0 
talk_start = 0 
target = 0 
following = false 
attacking = false 

function onThingMove(creature, thing, oldpos, oldstackpos) 

end 


function onCreatureAppear(creature) 

end 


function onCreatureDisappear(cid, pos) 
if focus == cid then 
selfSay('Narazie') 
focus = 0 
talk_start = 0 
end 
end 


function onCreatureTurn(creature) 

end 
function msgcontains(txt, str) 
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) 
end 


function onCreatureSay(cid, type, msg) 
msg = string.lower(msg) 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then 
selfSay('Witaj ' .. creatureGetName(cid) .. '! Wymieniam gp na platinum, platinum na cc i sc na cc') 
focus = cid 
talk_start = os.clock() 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then 
selfSay('Sorry, ' .. creatureGetName(cid) .. 'Zaczekaj Chwile') elseif focus == cid then 
talk_start = os.clock() 


if msgcontains(msg, 'sc') or msgcontains(msg, 'sc') then sell(cid,2159,1,1000000) 

if msgcontains(msg, '100 platinum') or msgcontains(msg, 'platinum') then sell(cid,2152,100,10000) 

elseif msgcontains(msg, '100 gold') or msgcontains(msg, 'gold') then sell(cid,2148,100,100) 

elseif msgcontains(msg, 'powtorz') then selfSay('Aby wymienic monety wpisz - "gold" [zamienia 100gp na 1 platinum, "platinum" [zamienia 100 platinum na 1cc]') 


elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then 
selfSay('Narazie, ' .. creatureGetName(cid) .. '!') 
focus = 0 
talk_start = 0 
end 
end 
end 


function onCreatureChangeOutfit(creature) 

end 


function onThink() 
if (os.clock() - talk_start) > 30 then 
if focus > 0 then 
selfSay('Nastepny...') 
end 
focus = 0 
end 
if focus ~= 0 then 
if getDistanceToCreature(focus) > 5 then 
selfSay('Narazie.') 
focus = 0 
end 
end 
end 

function onThink() 
if (os.clock() - talk_start) > 30 then 
end
end
end

PS. Gdyby ktos mogl przerobic go i wstawic tutaj to prosze napisac post
 

ArekDrax98

Active User
Joined
May 6, 2010
Messages
72
Reaction score
1
Odp: Problem z NPC ;/

Nikt nie moze pomoc???Prosze o pillna odpowiedz (dla mnie to jest bardzooo wazne)
 

GibkiRasta

Advanced User
Joined
May 12, 2010
Messages
176
Reaction score
8
Odp: Problem z NPC ;/

Npc jakos dziwnie zbudowany pierwszy raz takie cos widze powiedz moze od czego on jest opisz jego funkcje to moze ci napisze go inaczej
 

Xavizou

Advanced User
Joined
Dec 26, 2009
Messages
176
Reaction score
20
Odp: Problem z NPC ;/

#Up
PHP:
selfSay('Witaj ' .. creatureGetName(cid) .. '! Wymieniam gp na platinum, platinum na cc i sc na cc')
Jak mo?esz napisa? go inaczej skoro nie umiesz go przeczyta??

#Topic
Ten tw?j npc ?mierdzi. Trzymaj tego!
PHP:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
      end
end
function onCreatureTurn(creature)
end 
function msgcontains(txt, str)
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
      msg = string.lower(msg)
      if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
          selfSay('Siema ' .. creatureGetName(cid) .. '! Zamienie twoje pieniadz!e. Powiedz 'na platynki' lub 'na cc' a dokonamy zamiany.')
          focus = cid
          talk_start = os.clock()
    elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Poczekaj chwilke.')       elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'na platynki') then
              sell(cid,2148,100,100)
          elseif msgcontains(msg, 'na cc') then
              sell(cid,2152,100,10000)
          elseif string.find(msg, '(%a*)bye(%a*)')  and    getDistanceToCreature(cid) < 4 then
              selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
              focus = 0
              talk_start = 0
          end
      end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
      if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Nastepny...')
          end
              focus = 0
      end
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Strzaleczka.')
             focus = 0
         end
     end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end
 

ArekDrax98

Active User
Joined
May 6, 2010
Messages
72
Reaction score
1
Odp: Problem z NPC ;/

@UP
Chodzi wlasnie o to zeby zamienial gold na paltynki, platynki na cc, cc na platynki, sc na cc i cc na sc xD gdybys mogl cos takiego napisac to pomoz
 

Nevonx

New User
Joined
Jan 29, 2010
Messages
7
Reaction score
0
Age
28
Odp: Problem z NPC ;/

Potrzebny Jest do tego tobie npc ? Jak mo?na doda? skrypt i masz nie potrzebnie Bawi? si? w Bank na Ots -;-
 

ArekDrax98

Active User
Joined
May 6, 2010
Messages
72
Reaction score
1
Odp: Problem z NPC ;/

Tak potrzebne poniewaz mam armie 6.6.6 i nie zawiera ona funkcji zamiany kasy i gdybym dodal to to moznalo by klonowac kaske bictrainerem.
 

Xavizou

Advanced User
Joined
Dec 26, 2009
Messages
176
Reaction score
20
Odp: Problem z NPC ;/

No przecie? poda?em ci skrypt, nie widzisz? Sp?jrz do mojego postu wy?ej. To jest w?a?nie npc od tej zamiany.
 

ArekDrax98

Active User
Joined
May 6, 2010
Messages
72
Reaction score
1
#########
##refresh##
########

OK temat do zamkniecia Sam zrobilem takiego npc ktory nie buguje ;d

Notka moderatorska:
??cz? i zamykam.
 
Last edited by a moderator:
Status
Not open for further replies.
Top