OTS i Tibia
sam szukalem tego skryptu i go nieumialem znalezc... Skrypt nie muj.
ale napewno sie komus przyda bo zadko sie go spotyka ;]
w data/npc robnimy the oracle.xml :
Spoiler:
<?xml version="1.0" ?>
<npc name="The Oracle" script="data/npc/scripts/oracle.lua" access="3">
<look type="1448" head="57" body="59" legs="40" feet="76" />
</npc>
a w scripts robimy Oracle.lua:
focus = 0 talk_start = 0 target = 0 following = false attacking = false talk_state = 0 cname = '' vocation = 0 mainlevel = 8 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) cname = creatureGetName(cid) msg = string.lower(msg) if (msgcontains(msg, 'cze') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. cname .. '! Are You reapered Your destiny?') talk_state = 0 focus = cid talk_start = os.clock() elseif msgcontains(msg, 'cze') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. cname .. '! I talk to You in a minute.') elseif msgcontains(msg, 'nara') and focus == cid and getDistanceToCreature(cid) < 4 then selfSay('Goodbye, ' .. 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') then -- wanna go to mainland level = getPlayerLevel(cname) if level >= mainlevel then selfSay('Great! What vocation You prefer? knight, paladin,sorcerer,druid?') talk_state = 1 else selfSay('Sorry, You need ' .. mainlevel .. 'to go to mainland.') talk_state = 0 end else selfSay('Come back when You'll grow.') talk_state = 0 end elseif talk_state == 1 then -- telling vocation talk_state = 2 if msgcontains(msg, 'sorcerer') then selfSay('Sorcerer! Are You sure?') vocation = 1 elseif msgcontains(msg, 'druid') then selfSay('Druid! Are You sure?') vocation = 2 elseif msgcontains(msg, 'paladin') then selfSay('Paladin! Are You sure?') vocation = 3 elseif msgcontains(msg, 'knight') then selfSay('Knight! Are You sure?') vocation = 4 else selfSay('Sorry,this vocation is not match.') vocation = 0 talk_state = 1 end elseif talk_state == 2 then -- confirming vocation if msgcontains(msg, 'yes') then selfSay('Great! What City you prefer? twoja nazwa 1, twoja nazwa 2 itd') talk_state = 3 else selfSay('What vocation do you want then?') talk_state = 1 end elseif talk_state == 3 then -- telling city name if msgcontains(msg, 'nazwa miasta 1') then selfSay('Good luck!') setPlayerVocation(cid,vocation) setPlayerMasterPos(cid,x,y,z) templa na mainie miasta 1 selfSay('/send ' .. cname .. ', x y z') templa na mainie miasta 1 if msgcontains(msg, 'nazwa miasta 2') then selfSay('Good luck!') setPlayerVocation(cid,vocation) setPlayerMasterPos(cid,x,y,z) templa na mainie miasta 2 selfSay('/send ' .. cname .. ', x y z') templa na mainie miasta 2 talk_state = 0 focus = 0 talk_start = 0 else selfSay('This city don't match..') 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('Next please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye!.') focus = 0 end end end
Offline