What's new

[8.1][SZUKAM] Profesja

Status
Not open for further replies.

kubeusz32

Active User
Joined
Jun 6, 2008
Messages
112
Reaction score
5
Szukam NPC Profesja, kt?ry po wyj?ciu z rooka zmieni profesj? ale tylko 1 raz!
Ja go pr?bowa?em zrobi? ale nic z tego. ;[
Je?eli kto? b?dzie mia? tego NPC to dam reputka.

Pozdrawiam,
Kubeusz32.
 

Neox111

New User
Joined
Dec 25, 2008
Messages
5
Reaction score
0
Odp: [8.1][SZUKAM] Profesja

Wchodzimy do data/NPC i robimy plik o nazwie The Oracle.xml
Wklejamy ten KOD
HTML:
<?xml version="1.0"?>

<npc name="The Oracle" script="data/npc/scripts/oracle.lua" access="3">

	<look typeex="1448" corpse="3128"/>
	
</npc>

Nast?pnie wchodzimy w data/NPC/scripts i robimy plik oracle.lua
local focus = 0
local talk_start = 0
local target = 0
local following = false
local 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)

-- greeting phrase
if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then
selfSay('Hello, young adventurer! Are you ready to face your destiny?')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()




if msgcontains(msg, 'yes') and talk_state ~= 458 then
if getPlayerLevel(cid) >= 8 then
selfSay('Great! What would you like to be? A sorcerer, a druid, a paladin or a knight?')
talk_state = 459
else
selfSay('Sorry, you need level 8 to leave rookgaard.')
talk_state = 0
end

elseif msgcontains(msg, 'no') then
selfSay('Come back when you are ready then.')
talk_state = 0

elseif talk_state == 459 then
vocationid = 0
talk_state = 458

if msgcontains(msg, 'sorcerer') then
selfSay('A mighty sorcerer! Are you sure?')
vocationid = 1

elseif msgcontains(msg, 'knight') then
selfSay('A valorous knight! Are you sure?')
vocationid = 4

elseif msgcontains(msg, 'paladin') then
selfSay('A nimble paladin! Are you sure?')
vocationid = 3

elseif msgcontains(msg, 'druid') then
selfSay('A mysterious druid! Are you sure?')
vocationid = 2

else
selfSay('Sorry, I can\'t understand that. Please type your vocation again.')
talk_state = 459
end



elseif talk_state == 458 then
if msgcontains(msg, 'yes') then
selfSay('Great! Where would you like to go? I can take you to Karmia.')
talk_state = 452
else
selfSay('What vocation do you want then?')
talk_state = 459
end

elseif talk_state == 452 then
if msgcontains(msg, 'karmia') or msgcontains(msg, 'main') or msgcontains(msg, 'mainland') then
doPlayerSetVocation(cid,vocationid)
doPlayerSetTown(cid,1) -- Karmia TownID
selfSay('Let\'s go!')
travel(cid,438,504,8,1)
end
talk_state = 0
talk_start = 0



elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(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('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
 
Last edited:
Status
Not open for further replies.
Top