Postado Agosto 10, 2020 4 anos Bom dia amigos, hoje venho pedir sua ajuda visto que estou recebendo alguns erros no console. O primeiro npc é comprar a bless, recebo este erro no console [0:48:46.533] [Error - LuaInterface::loadFile] data/npc/scripts/BlessMan.lua:40: 'do' expected near 'doPlayerAddBlessing' [0:48:46.534] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/BlessMan.lua [0:48:46.535] data/npc/scripts/BlessMan.lua:40: 'do' expected near 'doPlayerAddBlessing' meu script 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 price = 60000 -------- precio if msgcontains(msg, 'bless') then ----------------Z lo que hay que decirle if isPremium(cid) == TRUE then if getPlayerMoney(cid) <= price then selfSay('I will give to you all blessings, but you will have to make a sacrifice. Are you prepared to pay '.. price ..' gold for the blessings?', cid) talkState[talkUser] = 1 else selfSay('Oh. You do not have enough money.', cid) talkState[talkUser] = 0 end else selfSay('Oh. Only premium players can buy blessings.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerBlessing(cid) < 0 then selfSay('Sorry, but you already have one of the blessing.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, price) == TRUE then for i = 1, 5 -----------then --------> wajajajajaajajajajaajjajajjaaj doPlayerAddBlessing(cid, i) selfSay('Now the Gods blessed you.', cid) else selfSay('Oh. You do not have enough money.', cid) end end elseif msgcontains(msg, 'no') and (talkState[talkUser] == 1) then selfSay('Ok, Good Bye Adventurer.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Error NPC de task Consola: [0:48:46.737] [Error - LuaInterface::loadFile] data/npc/scripts/simple_task.lua:90: ')' expected near '∩' [0:48:46.739] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/simple_task.lua [0:48:46.740] data/npc/scripts/simple_task.lua:90: ')' expected near '∩' Script: domodlib('task_func') 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,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","mision","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Felicidades, ahora estas participando en la task "..task_sys[task].name.." y deberas matar "..task_sys[task].count.." de esta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah y por favor traeme "..getItemsFromList(task_sys[task].items).." para mi." or "").."" , cid) else npcHandler:say("Disculpa, necesitas ser nivel "..task_sys[task].level.." para poder participar en la task de "..task_sys[task].name.."!", cid) end else npcHandler:say("Lo siento, actualmente ya participas en la task "..task_sys[task].name..". Puedes {entregar} en caso de que ya la hayas completado.", cid) end else npcHandler:say("Disculpa, por el momento no tengo ninguna task para ti!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Disculpa, debes esperar "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar una nueva task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Tienes una task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Sorry, no tienes nivel para completar una task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Felicidades, ahora estas participando en la task diaria de "..dtask.name.." y deberas matar "..dtask.count.." monstruos de esta lista: "..getMonsterFromList(dtask.monsters_list).." hasta "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Buena suerte!" , cid) elseif isInArray({"recibir","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Disculpa, pero tambien necesitas entregar los items de esta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Gracias! tus recompensas: "..(str == "" and "ninguna" or ""..str.."").." por haber terminado la task de "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) else npcHandler:say("Disculpa, pero aun no terminas la task de "..v.name..". necesito que mates mas "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." De estos horribles monstruos!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, k.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Gracias por tu ayuda! Recompensas: "..(rst == "" and "ninguna" or ""..rst.."").." por haber completado la task de "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Disculpa pero no terminaste la task diaria de "..k.name..". Necesito que mates mas "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." De estos monstruos!", cid) end end end elseif msg == "no" then selfSay("Todo bien entonces", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Pfv algem pode me ajudar? +Repp
Postado Agosto 10, 2020 4 anos @Darwiinxp tenta assim o npc de bless: 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 price = 60000 -------- precio if msgcontains(msg, 'bless') then ----------------Z lo que hay que decirle if isPremium(cid) == TRUE then if getPlayerMoney(cid) <= price then selfSay('I will give to you all blessings, but you will have to make a sacrifice. Are you prepared to pay '.. price ..' gold for the blessings?', cid) talkState[talkUser] = 1 else selfSay('Oh. You do not have enough money.', cid) talkState[talkUser] = 0 end else selfSay('Oh. Only premium players can buy blessings.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerBlessing(cid) < 0 then selfSay('Sorry, but you already have one of the blessing.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, price) == TRUE then doPlayerAddBlessing(cid, 1) doPlayerAddBlessing(cid, 2) doPlayerAddBlessing(cid, 3) doPlayerAddBlessing(cid, 4) doPlayerAddBlessing(cid, 5) selfSay('Now the Gods blessed you.', cid) else selfSay('Oh. You do not have enough money.', cid) end end elseif msgcontains(msg, 'no') and (talkState[talkUser] == 1) then selfSay('Ok, Good Bye Adventurer.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 10, 2020 4 anos Autor Já não me dá o erro no console, mas quando digo "hi", "bless" "yes" isso aparece no console [Warning - Bless William] NpcSystem: Parameter 'keyword_reply2' missing. Skipping...
Postado Agosto 10, 2020 4 anos @Darwiinxp 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 price = 60000 -------- precio if msgcontains(msg, 'bless') then ----------------Z lo que hay que decirle if isPremium(cid) == TRUE then if getPlayerMoney(cid) <= price then selfSay('I will give to you all blessings, but you will have to make a sacrifice. Are you prepared to pay '.. price ..' gold for the blessings?', cid) talkState[talkUser] = 1 else selfSay('Oh. You do not have enough money.', cid) talkState[talkUser] = 0 end else selfSay('Oh. Only premium players can buy blessings.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerBlessing(cid) < 0 then selfSay('Sorry, but you already have one of the blessing.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, price) == TRUE then for i = 1, 5 then doPlayerAddBlessing(cid, i) selfSay('Now the Gods blessed you.', cid) else selfSay('Oh. You do not have enough money.', cid) end end elseif msgcontains(msg, 'no') and (talkState[talkUser] == 1) then selfSay('Ok, Good Bye Adventurer.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 10, 2020 4 anos Autor Em 10/08/2020 em 02:14, Baalszor disse: @Darwiinxp 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 price = 60000 -------- precio if msgcontains(msg, 'bless') then ----------------Z lo que hay que decirle if isPremium(cid) == TRUE then if getPlayerMoney(cid) <= price then selfSay('I will give to you all blessings, but you will have to make a sacrifice. Are you prepared to pay '.. price ..' gold for the blessings?', cid) talkState[talkUser] = 1 else selfSay('Oh. You do not have enough money.', cid) talkState[talkUser] = 0 end else selfSay('Oh. Only premium players can buy blessings.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerBlessing(cid) < 0 then selfSay('Sorry, but you already have one of the blessing.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, price) == TRUE then for i = 1, 5 then doPlayerAddBlessing(cid, i) selfSay('Now the Gods blessed you.', cid) else selfSay('Oh. You do not have enough money.', cid) end end elseif msgcontains(msg, 'no') and (talkState[talkUser] == 1) then selfSay('Ok, Good Bye Adventurer.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) [2:16:51.247] [Error - NpcScript Interface] [2:16:51.249] (Unknown script file) [2:16:51.250] Description: [2:16:51.250] attempt to call a nil value [2:16:51.252] stack traceback: :c Meu BlessMan.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Bless William" script="BlessMan.lua" walkinterval="2000" floorchange="0" speechbubble="1"> <health now="100" max="100"/> <look type="134" head="58" body="114" legs="87" addons="3"/> <parameters> <parameter key="module_keywords" value="1" /> <parameter key="keywords" value="bless;blessings" /> <parameter key="keyword_reply1" value="Excelente! si aun estas interesado confirmame la compra con {yes} para concluir ." /> </parameters> </npc>
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.