What's new

Npc problem

PicWick

Advanced User
Joined
Aug 17, 2008
Messages
236
Reaction score
8
Witam mam taki problem z silnikiem YurOTS 094 zrobilem npc w scripts utworzylem plik lua o nazwie corka i napisalem tam cos takiego
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('Dozobaczenia przyjacielu.')
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
selfLook(cid)
selfSay('Witaj ' .. creatureGetName(cid) .. '! Spotkalo mnie wielkie nieszczescie nie mam sily o tym rozmawiac. Oj biedna moja CORKA ')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Z kims teraz rozmawiam.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'corka') then
selfSay('Poslalam moja corke po jagody a tam bandyci przyszykowali zasadzke i porwali mi corke. Szukam kogos kto uratuje moja pocieche.')
focus = 0
talk_state = 0
if msgcontains(msg, 'ratunek') then
selfSay('Widac ze masz waleczne serce, ale z takim uzbrojeniem nie masz szans, na goze na strychu w skrzyni jest tarcza. Jak juz ja bedziesz mial to udaj sie do mojego meza ktory jest strarznikiem miasta ')
focus = 0
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Dozobaczenia, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
else
selfSay('Nie mam sily rozmawiac')
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Jest ktos jeszcze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dozobaczenia przyjacielu.')
focus = 0
end
end
end
I jak odpalam siknik to wyskakujemi cos takiego:
 

Arbuz1194

User
Joined
Jan 3, 2009
Messages
37
Reaction score
1
Odp: Npc problem

Pobierz jeszcze raz ots'a i spr?buj poprawi? jeszcze raz jak ci si? nie uda to napisz do mnie pw to mo?e ci pomog? :D
 
Top