
Tudo que Wise postou
-
arrumar esse script de addon
É, esse script que eu fiz de madrugada não foi muito lógico. Refiz tudo agora: addoner.lua local prices = {500000, 1000000} -- {first, second} local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local outfits = { [0] = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 336, 366}, [1] = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 335, 367} } if(msgcontains(msg, 'first addons')) then talkState[talkUser] = 1 selfSay('Are you sure?', cid) elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, prices[1]) == true) then for x = 1, (#outfits[getPlayerSex(cid)]) do talkState[talkUser] = 0 doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 1) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) end selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you need '..prices[1]..' gold coins to buy this addons.', cid) end elseif(msgcontains(msg, 'second addons')) then talkState[talkUser] = 2 selfSay('Are you sure?', cid) elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if(doPlayerRemoveMoney(cid, prices[2]) == true) then for x = 1, (#outfits[getPlayerSex(cid)]) do talkState[talkUser] = 0 doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 2) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) end selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you need '..prices[2]..' gold coins to buy this addons.', cid) end elseif(msgcontains(msg, 'no')) then talkState[talkUser] = 0 selfSay('Okay, goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Addoner.xml <npc name="Addoner" script="data/npc/scripts/addoner.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="133" head="39" body="113" legs="38" feet="0" addons="3"/> <parameters> <parameter key="message_greet" value="Hi |PLAYERNAME|. I sell the {first addons} and the {second addons}." /> </parameters> </npc>
- Spell Teleporte
- Entrar no TP sem Battle
- (Resolvido)[pedido] Como adicionar X vocação em X item
-
arrumar esse script de addon
Cada erro ridículo que estou fazendo. Falta de atenção minha, fiz esse script as 05 da manhã. Enfim, agora deve dar certo: [script removido] Desculpa pela falta de atenção. Muito sono..
-
Aleatório
Já que no script padrão do membro haviam outros valores a serem configurados, eu ia simplificar tudo em uma única tabela. Mas depois eu notei que o item era removido, então não tinha a necessidade daqueles outros valores, mas daí esqueci de fazer da tabela uma única variável. Obrigado por avisar. Agora, falando do seu script (já que falou do meu). Qual a necessidade de haver uma checagem de remoção de um item que dará ao player de 3 à 5, dentre 20 itens? Não é óbvio que ele deve ser removido? Ou será que tem alguma lógica receber de 3 à 5 itens a qualquer hora? Isso sim é desnecessário. Agora sim você explicou melhor.. local items = {2183, 8920, 2181, 8912, 8921, 2187, 8910, 8922, 7764, 7773, 7770, 7855, 7864, 7861, 7745, 7754, 7751, 7748, 7755, 7753} function onUse(cid, item, frompos, item2, topos) local bbp = doPlayerAddItem(cid, 2002, 1) for i = 1, math.random(3, 5) do doAddContainerItem(bbp, items[math.random(1, #items)], 1) end doRemoveItem(item.uid, 1) doSendAnimatedText(getThingPos(cid), "SURPRESA!", 5) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você abriu a mochila surpresa azul e recebeu uma backpack com alguns itens.") return true end
-
arrumar esse script de addon
Não precisa ficar fazendo quote do meu post, vai prolongar demais o tópico ;s Mas enfim, coloquei o nome da tabela errada..falta de atenção minha: [script removido]
-
arrumar esse script de addon
Certo.. addoner.lua [script removido]
-
[pedido] Porta só abrir depois de matar
Disponha.
-
sistema akatsuki e anbu
Atualizei meu post, editei o script. Está tudo certo, e os erros no distro que você citou anteriormente não tem nenhuma ligação com essas actions.
-
Aleatório
Já que no seu script padrão o item é removido, então eu o simplifiquei. Não testei local items = {2183, 8920, 2181, 8912, 8921, 2187, 8910, 8922, 7764, 7773, 7770, 7855, 7864, 7861, 7745, 7754, 7751, 7748, 7755, 7753} function onUse(cid, item, frompos, item2, topos) local bbp, chances = doPlayerAddItem(cid, 2002, 1), math.random(3, 5) for x = 1, table.maxn(items) do doRemoveItem(item.uid, 1) doAddContainerItem(bbp, items[x], chances) doSendAnimatedText(getThingPos(cid), "SURPRESA!", 5) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você abriu a mochila surpresa azul e recebeu uma backpack com alguns equipamentos.") return true end
-
Npc que muda vocação por storage
exchanger.lua (data/npc/scripts): local tab = { [1] = {voc = 5, item = {1234, 5}, sto = {12345, 1}, -- [paraqualvocID] = {voc = novavocID, item {itemID, count}, sto = {storage, valordastorage}}, [2] = {voc = 6, item = {1234, 5}, sto = {12345, 1}, [3] = {voc = 7, item = {1234, 5}, sto = {12345, 1}, [4] = {voc = 8, item = {1234, 5}, sto = {12345, 1} } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if(msgcontains(msg, 'favor')) then talkState[talkUser] = 1 selfSay('You need to bring me '..tab[getPlayerVocation].item[2]..' '..getItemNameById(tab[getPlayerVocation].item[1])..' and then I can {change} your vocation.', cid) elseif(msgcontains(msg, 'change') and talkState[talkUser] == 1) then talkState[talkUser] = 2 selfSay('Are you sure you want to do this change?', cid) elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if(getPlayerVocation(cid) ~= tab[getPlayerVocation(cid)].voc) then if(tab[getPlayerVocation(cid)] and getPlayerStorageValue(cid, tab[getPlayerVocation(cid)].sto[1]) > tab[getPlayerVocation(cid)].sto[2]) then if(doPlayerRemoveItem(cid, tab[getPlayerVocation(cid)].item[1], tab[getPlayerVocation(cid)].item[2]) == true) then talkState[talkUser] = 0 doPlayerSetVocation(cid, tab[getPlayerVocation(cid)].voc) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) else talkState[talkUser] = 0 selfSay('You do not have the required items.', cid) end else talkState[talkUser] = 0 selfSay('You can not change your vocation.', cid) end else talkState[talkUser] = 0 selfSay('You already have changed your vocation.', cid) end elseif(msgcontains(msg, 'no')) then talkState[talkUser] = 0 selfSay('Sure. Goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Exchanger.xml (data/npc): <npc name="Exchanger" script="data/npc/scripts/exchanger.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="133" head="39" body="113" legs="38" feet="0" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I can change your vocation but before I need a {favor}." /> </parameters> </npc>
- Entrar no TP sem Battle
-
arrumar esse script de addon
Uma desatenção minha, desculpe: local tab = { prices = {500000, 1000000} -- {first, second} } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid npcHandler:setMessage(MESSAGE_GREET, 'Hi |PLAYERNAME|. I sell the {first addons} set for '..tab.prices[1]..' gold coins and the {second addons} set for '..tab.prices[2]..' gold coins.') if(msgcontains(msg, 'first addons')) then talkState[talkUser] = 1 selfSay('Are you sure?', cid) elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, tab.prices[1]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 1) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif(msgcontains(msg, 'second addons')) then talkState[talkUser] = 2 selfSay('Are you sure?', cid) elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if(doPlayerRemoveMoney(cid, tab.prices[2]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 2) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif(msgcontains(msg, 'no')) then talkState[talkUser] = 0 selfSay('Okay, goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Entrar no TP sem Battle
battleportal.lua (data/movements/scripts): function onStepIn(cid, item, pos, fromPos) local pos = {x=123, y=456, z=7} if isPlayer(cid) and getCreatureCondition(cid, CONDITION_INFIGHT) then doTeleportThing(cid, fromPos) doSendMagicEffect(fromPos, CONST_ME_POFF) doPlayerSendCancel(cid, "You can't enter in battle.") else doTeleportThing(cid, pos) doSendMagicEffect(pos, CONST_ME_TELEPORT) end return true end Tag - movements.xml (data/movements): <movevent type="StepIn" actionid="ACTIONID" script="battleportal.lua" /> Adicione o actionID configurado na tag, ao teleport (sem que tenha posição de destino configurada) e configure a posição de destino no script.
-
Spell Teleporte
O erro acusado não é um erro de função, e sim de estrutura. data/spells/scripts/teleporte.lua:12 'end' expected (to close 'function' at line 7) near '<eof>' Isso indica que há um end faltando no script, para fechar uma função. E como você pode ver acima, o script que postei não tem nenhum erro na estrutura dele. Verifique se por acaso não copiou o code errado por acidente, esquecendo então de adicionar algo no fim do arquivo e resultando nesse erro.
-
arrumar esse script de addon
@eviltox Relaxa, eu estou calmo. Só quero dizer que não vejo mudança alguma no resultado do script que você postou, por ter as funções praticamente idênticas as do meu, que não deu certo no servidor dele.
-
arrumar esse script de addon
Amigo, você postou um script quase exatamente igual ao meu, além de que nem fez questão de modificar os valores do custo de cada parâmetro do NPC. Como acha que vai mudar o resultado? Está tudo certo. Fiz outro: local tab = { prices = {500000, 1000000} -- {first, second} } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid npcHandler:setMessage(MESSAGE_GREET, 'Hi |PLAYERNAME|. I sell the {first addons} set for '..tab.prices[1]..' gold coins and the {second addons} set for '..tab.prices[2]..' gold coins.') if (msgcontains(msg, 'first addons')) then talkState[talkUser] = 1 selfSay('Are you sure?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (doPlayerRemoveMoney(cid, tab.prices[1]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 1) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif (msgcontains(msg, 'second addons')) then talkState[talkUser] = 2 selfSay('Are you sure?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if (doPlayerRemoveMoney(cid, tab.prices[2]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 2) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif (msgcontains(msg, 'no')) then talkState[talkUser] = 0 selfSay('Okay, goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Se ainda não der certo enquanto ao player receber os addons, verifique se você tem a função doPlayerAddAddons em sua 050-function.lua. É uma possibilidade pra esse problema, e não se esqueça de reportar erros no distro (caso tenha).
-
arrumar esse script de addon
addoner.lua (data/npc/scripts): local tab = { prices = {500000, 1000000} -- {first, second} } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function buyAddons(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end local addon = parameters.addon local cost = parameters.cost local premium = (parameters.premium ~= nil and parameters.premium) if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then if doPlayerRemoveMoney(cid, cost) == true then doPlayerAddAddons(cid, addon) npcHandler:say('There, you are now able to use all addons!', cid) else npcHandler:say('Sorry, you do not have enough money.', cid) end else npcHandler:say('I only serve customers with premium accounts.', cid) end keywordHandler:moveUp(1) return true end local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for '..tab.prices[1]..' gold coins?'}) node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = tab.prices[1], premium = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for '..tab.prices[2]..' gold coins?'}) node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = tab.prices[2], premium = true}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for '..tab.prices[1]..' gold coins and the second addons set for '..tab.prices[2]..' gold coins.'}) npcHandler:addModule(FocusModule:new()) Addoner.xml (data/npc): <?xml version="1.0" encoding="UTF-8"?> <npc name="Addoner" script="data/npc/scripts/addoner.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> </npc>
-
[pedido] Porta só abrir depois de matar
Certo, já editei. Tente agora.
- Magnus Challenger
-
PK ao Atacar Summon de Outro Player
xWhiteWolf Pois é, bem por isso que tive a ideia de fazer o script haha Não necessariamente. O player recebe a condição de battle (INFIGHT) e tem a skull setada como white (pk) assim que ataca o summon de um outro player, não importando se tem o Normal Mode ativado ou não. luanluciano93 Obrigado.
-
PK ao Atacar Summon de Outro Player
Serei breve, já que o próprio título já diz sobre o sistema. É um creaturescript bem simples, porém pode ser útil. onattacksummon.lua (data/creaturescripts/scripts): local stime = 10 -- tempo de pk (minutos) local condition_infight = createConditionObject(CONDITION_INFIGHT) setConditionParam(condition_infight, CONDITION_PARAM_TICKS, stime * 60 * 1000) function onAttack(cid, target) if getCreatureSkullType(cid) < 3 and isPlayer(getCreatureMaster(target)) then doCreatureSetSkullType(cid, SKULL_WHITE) doAddCondition(cid, condition_infight) doPlayerSetPzLocked(cid, true) end return true end No mesmo diretório, adicione o registro ao arquivo login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "onAttackSummon") Adicione a tag - creaturescripts.xml (data/creaturescripts): <event type="attack" name="onAttackSummon" event="script" value="onattacksummon.lua"/> Créditos: Suicide (aprendiz de xWhiteWolf).
-
Erro no Login.lua
Não testei, mas a estrutura e as funções estão aparentemente corretas: local config = { loginMessage = getConfigValue('loginMessage') } function onLogin(cid) local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") end if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Idle") registerCreatureEvent(cid, "SkullCheck") registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "LevelProtection") registerCreatureEvent(cid, "advanced") if getPlayerStorageValue(cid, 42309) < 1 then for i = 42300, 42309 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42319) < 1 then for i = 42310, 42319 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42329) < 1 then for i = 42320, 42329 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42355) == -1 then setPlayerStorageValue(cid, 42355, 0) end setPlayerStorageValue(cid, 42350, 0) setPlayerStorageValue(cid, 42352, 0) return true end
-
(Resolvido)[PEDIDO]Talkaction 8.54
buyvoc.lua (data/talkactions/scripts): local tab = { [1] = {item = {1234, 5}}, -- [vocid] = {item = {itemid, count}}, [2] = {item = {1234, 5}}, [3] = {item = {1234, 5}} } function onSay(cid, words, param, channel) local p = string.explode(param, " ") if(param == "") then return doPlayerSendCancel(cid, "Enter the vocation number that you want to buy.") end if not (tab[tonumber(p[1])]) then return doPlayerSendCancel(cid, "Vocation not found.") end if(p[2]) then return doPlayerSendCancel(cid, "Invalid parameter specified.") end if(tonumber(p[1])) then if(doPlayerRemoveItem(cid, tab[tonumber(p[1])].item[1], tab[tonumber(p[1])].item[2]) == true) then doPlayerSetVocation(cid, tonumber(p[1])) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought a new vocation!!") else doPlayerSendCancel(cid, "You need "..tab[tonumber(p[1])].item[2].." "..getItemNameById(tab[tonumber(p[1])].item[1]).." to buy this vocation.") end end return true end Tag - talkactions.xml (data/talkactions): <talkaction words="!buyvoc" event="script" value="buyvoc.lua"/> Parâmetro de uso: !buyvoc number Ex: !buyvoc 3