Witam, mógłby mi ktoś opisać co trzeba zmienić, aby otrzymać takiego samego npc, tylko na wizard outfit.
Ten kod poniżej jest na Citizen Outfit.
Kod :
local focuses = {}
local nestings = {}
function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end
function getNesting(cid)
return nestings[cid]
end
function setNesting(cid, i)
nestings[cid] = i
end
function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
function removeFocus(cid)
nestings[cid] = nil
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
function _(msg, text)
if type(text) == 'string' then
return string.find( msg, string.lower(text), 1, true )
else
for index,textnode in pairs(text) do
if string.find( msg, string.lower(textnode), 1, true ) then
return true
end
end
return false
end
end
function onCreatureDisappear(cid)
if isFocused(cid) then
selfSay( 'How rude!' )
if isPlayer(cid) == TRUE then
closeShopWindow(cid)
removeFocus(cid)
end
end
end
function onCreatureMove(cid,frompos,topos)
if isFocused(cid) then
local distance = getDistanceToCreature(cid) or -1
if((distance > 3) or (distance == -1)) then
selfSay( "How rude!" )
closeShopWindow(cid)
removeFocus(cid)
end
end
end
function onPlayerCloseChannel(cid)
selfSay( "How rude!" )
closeShopWindow(cid)
removeFocus(cid)
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if _(msg, {'hi','hello','hiho'}) and not isFocused(cid) then
selfSay( 'Hello, ' .. getCreatureName(cid) .. '! I\'m selling {citizen} {addon}.', cid )
addFocus(cid)
nestings[cid] = 0
end
if isFocused(cid) and type == 4 then
if getNesting(cid) == 0 then
if _(msg, 'job') then
selfSay( 'I\'m addoner.', cid )
elseif _(msg, 'citizen addon') then
selfSay( 'I\'m offering citizen {backpack} and citizen {hat}.', cid )
elseif _(msg, 'backpack') then
if getPlayerStorageValue(cid, 7000) == -1 then
selfSay('To obtain citizen backpack, bring me 100 minotaur leathers. After that, ask me again.', cid)
setPlayerStorageValue(cid,7000,1)
elseif getPlayerStorageValue(cid,7000) == 1 then
selfSay('Do you have 100 minotaur leathers with you?', cid)
setNesting(cid,1)
elseif getPlayerStorageValue(cid,7000) == 2 then
selfSay('You already have this addon.', cid)
end
elseif _(msg, 'hat') then
if getPlayerStorageValue(cid, 7001) == -1 then
selfSay('To obtain citizen hat, bring me 100 chicken feathers, 50 honeycombs and a legion helmet. After that, ask me again.', cid)
setPlayerStorageValue(cid,7001,1)
elseif getPlayerStorageValue(cid, 7001) == 1 then
selfSay('Do you have 100 chicken feathers, 50 honeycombs and a legion helmet with you?', cid)
setNesting(cid,2)
elseif getPlayerStorageValue(cid,7001) == 2 then
selfSay('You already have this addon.', cid)
end
elseif _(msg, {'bye','farewell'}) then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!', cid)
removeFocus(cid)
end
elseif getNesting(cid) == 1 then
if _(msg, 'yes') then
local leathers = getPlayerItemCount(cid, 5878)
if leathers >= 100 then
doPlayerRemoveItem(cid, 5878, 100)
selfSay('Fine. You now have citizen backpack.', cid)
looktype = 128
if getPlayerSex(cid) == FEMALE then looktype = 136; end
if canPlayerWearOutfit(cid, looktype, 2) == TRUE then
doPlayerAddOutfit(cid, looktype, 3)
else
doPlayerAddOutfit(cid, looktype, 1)
end
setPlayerStorageValue(cid,7000,2)
setNesting(cid,0)
else
selfSay('Come back when you\'ll have 100 leathers.', cid)
setNesting(cid,0)
end
else
selfSay('Maybe next time.',cid)
setNesting(cid,0)
end
elseif getNesting(cid) == 2 then
if _(msg, 'yes') then
local feathers = getPlayerItemCount(cid, 5890)
local honeycombs = getPlayerItemCount(cid, 5902)
local helmet = getPlayerItemCount(cid, 2480)
if feathers >= 100 and honeycombs >= 50 and helmet >= 1 then
doPlayerRemoveItem(cid, 5890, 100)
doPlayerRemoveItem(cid, 5902, 50)
doPlayerRemoveItem(cid, 2480, 1)
selfSay('Fine. You now have citizen hat.', cid)
looktype = 128
if getPlayerSex(cid) == FEMALE then looktype = 136; end
if canPlayerWearOutfit(cid, looktype, 1) == TRUE then
doPlayerAddOutfit(cid, looktype, 3)
else
doPlayerAddOutfit(cid, looktype, 2)
end
setPlayerStorageValue(cid,7001,2)
setNesting(cid,0)
else
selfSay('Come back when you\'ll have 100 chicken feathers, 50 honeycombs and 1 legion helmet.', cid)
setNesting(cid,0)
end
else
selfSay('Maybe next time.',cid)
setNesting(cid,0)
end
end
end
end
Zrobiłem coś takiego, (kod poniżej na wizard) ale gdy pisze do tego npc "wizard outfit" on odpowiada "Noob"
Dodam jeszcze, że jak zrobiłem tego npc na Wizard, nie działa mi ten npc na Citizen, jak podchodze i pisze do niego np. "backpack" to nic sie nie dzieje ; /
Kod :
local focuses = {}
local nestings = {}
function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end
function getNesting(cid)
return nestings[cid]
end
function setNesting(cid, i)
nestings[cid] = i
end
function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
function removeFocus(cid)
nestings[cid] = nil
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
function _(msg, text)
if type(text) == 'string' then
return string.find( msg, string.lower(text), 0, true )
else
for index,textnode in pairs(text) do
if string.find( msg, string.lower(textnode), 1, true ) then
return true
end
end
return false
end
end
function onCreatureDisappear(cid)
if isFocused(cid) then
selfSay( 'How rude!' )
if isPlayer(cid) == TRUE then
closeShopWindow(cid)
removeFocus(cid)
end
end
end
function onCreatureMove(cid,frompos,topos)
if isFocused(cid) then
local distance = getDistanceToCreature(cid) or -1
if((distance > 4) or (distance == -1)) then
selfSay( "How rude!" )
closeShopWindow(cid)
removeFocus(cid)
end
end
end
function onPlayerCloseChannel(cid)
selfSay( "How rude!" )
closeShopWindow(cid)
removeFocus(cid)
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if _(msg, {'hi','hello','hiho'}) and not isFocused(cid) then
selfSay( 'Hello, ' .. getCreatureName(cid) .. '! I\'m selling {wizard} {addon}.', cid )
addFocus(cid)
nestings[cid] = 0
end
if isFocused(cid) and type == 4 then
if getNesting(cid) == nil then
selfSay('Noob')
end
if getNesting(cid) == 0 then
if _(msg, 'job') then
selfSay( 'I\'m addoner.', cid )
elseif _(msg, 'wizard addon') then
selfSay( 'I\'m offering wizard {skull mask} and wizard {skull shoulder pad}.', cid )
elseif _(msg, 'skull mask') then
if getPlayerStorageValue(cid, 7005) == -1 then
selfSay('To obtain wizard skull mask, bring me medusa shield, dragon scale mail, cron legs, and ring of the sky. After that, ask me again.', cid)
setPlayerStorageValue(cid,7005,1)
elseif getPlayerStorageValue(cid,7005) == 1 then
selfSay('Do you have medusa shield, dragon scale mail, cron legs, and ring of the sky?', cid)
setNesting(cid,1)
elseif getPlayerStorageValue(cid,7005) == 2 then
selfSay('You already have this addon.', cid)
end
elseif _(msg, 'skull shoulder pad') then
if getPlayerStorageValue(cid, 7006) == -1 then
selfSay('To obtain wizard skull shoulder pad, bring me Ferumbras Hat. After that, ask me again.', cid)
setPlayerStorageValue(cid,7006,1)
elseif getPlayerStorageValue(cid, 7006) == 1 then
selfSay('Do you have 50 Holy Orchid?', cid)
setNesting(cid,2)
elseif getPlayerStorageValue(cid,7006) == 2 then
selfSay('You already have this addon.', cid)
end
end
elseif getNesting(cid) == 1 then
if _(msg, 'yes') then
local shield = getPlayerItemCount(cid, 2536)
local dmail = getPlayerItemCount(cid, 2492)
local clegs = getPlayerItemCount(cid, 2488)
local rots = getPlayerItemCount(cid, 2123)
if shield >= 1 and dmail >= 1 and clegs >= 1 and rots >= 1 then
doPlayerRemoveItem(cid, 2536, 1)
doPlayerRemoveItem(cid, 2492, 1)
doPlayerRemoveItem(cid, 2488, 1)
doPlayerRemoveItem(cid, 2123, 1)
selfSay('Fine. You now have wizard skull mask.', cid)
looktype = 145
if getPlayerSex(cid) == FEMALE then looktype = 149; end
if canPlayerWearOutfit(cid, looktype, 2) == TRUE then
doPlayerAddOutfit(cid, looktype, 3)
else
doPlayerAddOutfit(cid, looktype, 1)
end
setPlayerStorageValue(cid,7005,2)
setNesting(cid,0)
else
selfSay('Come back when you\'ll have all wand of sorcerer, all rods of druid, 10 Magic Sulphur, 20 Ankh and Soul Stone.', cid)
setNesting(cid,0)
end
else
selfSay('Maybe next time.',cid)
setNesting(cid,0)
end
elseif getNesting(cid) == 2 then
if _(msg, 'yes') then
local fhat = getPlayerItemCount(cid, 5922)
if fhat >= 50 then
doPlayerRemoveItem(cid, 5922, 50)
selfSay('Fine. You now have wizard skull shoulder pad.', cid)
looktype = 145
if getPlayerSex(cid) == FEMALE then looktype = 149; end
if canPlayerWearOutfit(cid, looktype, 1) == TRUE then
doPlayerAddOutfit(cid, looktype, 3)
else
doPlayerAddOutfit(cid, looktype, 2)
end
setPlayerStorageValue(cid,7006,2)
setNesting(cid,0)
else
selfSay('Come back when you\'ll have 50 holy orchid.', cid)
setNesting(cid,0)
end
else
selfSay('Maybe next time.',cid)
setNesting(cid,0)
end
end
end
end
Bardzo proszę o pomoc!
Zakładki