Siemka =D Dawno ju? nie bawi?em si? z Tibi? ani z lua/xml i ju? nie pami?tam dosy? du?o.. A wi?c m?j problem polega na tym, ?e chce aby w NPC "Oracle", kt?ry teleportuje z RookGardu na MainLand do 6 levela. Czyli je?li kto? ma 5 level przejdzie na main i tak samo z 6 ale je?li b?dzie mia? 7 to ju? nie
M?g?by kto? go tak przerobi??? Poleci rep.
Skrypt:
[LUA]focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
cname = ''
vocation = 0
mainlevel = 5
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Nara.')
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)
cname = creatureGetName(cid)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witam ' .. cname .. '! Jestes gotowy na przeznaczenie?')
talk_state = 0
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Momento rozmawiam z ' .. cname .. '!')
elseif msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Narazie ' .. cname .. '!')
talk_state = 0
focus = 0
talk_start = 0 elseif focus == cid then
talk_start = os.clock() if talk_state == 0 then
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then wanna go to mainland
level = getPlayerLevel(cname)
if level >= mainlevel then
selfSay('To swietnie kim chcesz byc na MainLand Sorcerer, Druid, Paladin czy moze Knight?')
talk_state = 1
else
selfSay('Ej noo ziomek na main idzie sie od ' .. mainlevel .. ' poziomu!')
talk_state = 0
end
else
selfSay('Przyjdz jak bedziesz gotowy.')
talk_state = 0
end
elseif talk_state == 1 then telling vocation
talk_state = 2
if msgcontains(msg, 'sorcerer') then
selfSay('Na pewno sorcerer! Jestes tego pewien?')
vocation = 1
elseif msgcontains(msg, 'druid') then
selfSay('Na pewno druid! Jestes tego pewien?')
vocation = 2
elseif msgcontains(msg, 'paladin') then
selfSay('Na pewno paladin! Jestes tego pewien?')
vocation = 3
elseif msgcontains(msg, 'knight') then
selfSay('Na pewno knight! Jestes tego pewien?')
vocation = 4
else
selfSay('Wybacz, ale mamy tylko tu 4 profesje.')
vocation = 0
talk_state = 1
end
elseif talk_state == 2 then confirming vocation
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
selfSay('No to git mamy juz profesje teraz mozemy isc na MainLand? Czy jestes tego pewien?')
talk_state = 3
else
selfSay('Jaka bys chcial zostac profesja na MainLand?')
talk_state = 1
end
elseif talk_state == 3 then telling city name
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
selfSay('Powodzenia na MainLand!')
setPlayerVocation(cid,vocation)
setPlayerMasterPos(cid,160,54,7)
selfSay('/send ' .. cname .. ', 160 54 7')
talk_state = 0
focus = 0
talk_start = 0
else
selfSay('Wybacz albo chcesz isc na MainLand albo nie? Decyduj [tak] lub [nie].')
talk_state = 3
end
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() talk_start) > 45 then
if focus > 0 then
selfSay('Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Narazie.')
focus = 0
end
end
end
[/LUA]
Z g?ry dzi?kuje
M?g?by kto? go tak przerobi??? Poleci rep.
Skrypt:
[LUA]focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
cname = ''
vocation = 0
mainlevel = 5
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Nara.')
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)
cname = creatureGetName(cid)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witam ' .. cname .. '! Jestes gotowy na przeznaczenie?')
talk_state = 0
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Momento rozmawiam z ' .. cname .. '!')
elseif msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Narazie ' .. cname .. '!')
talk_state = 0
focus = 0
talk_start = 0 elseif focus == cid then
talk_start = os.clock() if talk_state == 0 then
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then wanna go to mainland
level = getPlayerLevel(cname)
if level >= mainlevel then
selfSay('To swietnie kim chcesz byc na MainLand Sorcerer, Druid, Paladin czy moze Knight?')
talk_state = 1
else
selfSay('Ej noo ziomek na main idzie sie od ' .. mainlevel .. ' poziomu!')
talk_state = 0
end
else
selfSay('Przyjdz jak bedziesz gotowy.')
talk_state = 0
end
elseif talk_state == 1 then telling vocation
talk_state = 2
if msgcontains(msg, 'sorcerer') then
selfSay('Na pewno sorcerer! Jestes tego pewien?')
vocation = 1
elseif msgcontains(msg, 'druid') then
selfSay('Na pewno druid! Jestes tego pewien?')
vocation = 2
elseif msgcontains(msg, 'paladin') then
selfSay('Na pewno paladin! Jestes tego pewien?')
vocation = 3
elseif msgcontains(msg, 'knight') then
selfSay('Na pewno knight! Jestes tego pewien?')
vocation = 4
else
selfSay('Wybacz, ale mamy tylko tu 4 profesje.')
vocation = 0
talk_state = 1
end
elseif talk_state == 2 then confirming vocation
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
selfSay('No to git mamy juz profesje teraz mozemy isc na MainLand? Czy jestes tego pewien?')
talk_state = 3
else
selfSay('Jaka bys chcial zostac profesja na MainLand?')
talk_state = 1
end
elseif talk_state == 3 then telling city name
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
selfSay('Powodzenia na MainLand!')
setPlayerVocation(cid,vocation)
setPlayerMasterPos(cid,160,54,7)
selfSay('/send ' .. cname .. ', 160 54 7')
talk_state = 0
focus = 0
talk_start = 0
else
selfSay('Wybacz albo chcesz isc na MainLand albo nie? Decyduj [tak] lub [nie].')
talk_state = 3
end
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() talk_start) > 45 then
if focus > 0 then
selfSay('Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Narazie.')
focus = 0
end
end
end
[/LUA]
Z g?ry dzi?kuje