Ir para conteúdo

Garou

Membro
  • Registro em

  • Última visita

Solutions

  1. Garou's post in (Resolvido)Bug NPC de promotion customizado. was marked as the answer   
    Checagem da promotion no lugar errado dá nisso.
     
    NPC 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 _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local storage = getCreatureStorage(cid, 2590) if msgcontains(msg, "promotion") then if getPlayerPromotionLevel(cid) == 0 then if storage == -1 then selfSay("So you need a promotion? I can give her for you, but first, give this letter to my brother, he always ask me if I am good, bad, you know...", cid) doCreatureSetStorage(cid, 2590, 0) local item = doPlayerAddItem(cid, 2597, 1) local text = "Querido, como você está? Espero que tenha tratado de sua saúde, mande-me notícias!" doSetItemText(item, text) npcHandler:releaseFocus(cid) elseif storage == 0 then selfSay("I am waiting for you to deliver my letter...", cid) npcHandler:releaseFocus(cid) else selfSay("Hey, you delivered my letter! Thanks, man. Here is your promotion!", cid) doPlayerSetPromotionLevel(cid, 1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) npcHandler:releaseFocus(cid) end else selfSay("You already are promoted!", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new()) NPC 2:
    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 _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local status = getCreatureStorage(cid, 2590) if msgcontains(msg, "letter") then if status == -1 then selfSay("What? I think you didn't talk with my brother...", cid) elseif status == 0 then if doPlayerRemoveItem(cid, 2590) then selfSay("Hey, thanks, this is my brother's letter. Thank you very much. I am going to tell him about you.", cid) doCreatureSetStorage(cid, 2590, 1) else selfSay("You don't have my brother's letter", cid) end else selfSay("You already gave me my brother's letter", cid) end npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new()) Como eu sou meio engessado, usei doCreatureSetStorage denovo, então sinta-se livre para fazer os ajustes necessários.
     
    Abraços.
  2. Garou's post in (Resolvido)Magia que custa % de mana was marked as the answer   
    Troque mana por manapercent no spells.xml
  3. Garou's post in (Resolvido)Erro creaturescript onkill gold cath was marked as the answer   
    Como eu testo meus scripts em localhost, não há influência de possíveis gargalos na conexão.
     
    Tente com o script abaixo, alterei apenas o tempo do addEvent para um intervalo maior.
    function autoloot(cid, position, corpseID) if not isPlayer(cid) then return end local corpse = getTileItemById(position, corpseID) if corpse and isContainer(corpse.uid) then local gold = 0 for slot = 1, getContainerSize(corpse.uid) do local item = getContainerItem(corpse.uid, slot) local amount = (item.itemid == 2148 and item.type or (item.itemid == 2152 and item.type * 100 or (item.itemid == 2160 and item.type * 10000)) or 0) if item.uid > 0 then if amount > 0 then gold = gold + amount doRemoveItem(item.uid) end else break end end doPlayerAddMoney(cid, gold) end end function onKill(cid, target) if isPlayer(target) then return true end local position = getCreaturePosition(target) local info = getMonsterInfo(getCreatureName(target)) addEvent(autoloot, 100, cid, position, info.lookCorpse) return true end
  4. Garou's post in (Resolvido)Problema com hits da spell was marked as the answer   
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat3 = createCombatObject() setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat3, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat3, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat4 = createCombatObject() setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat4, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat4, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local area3 = createCombatArea({ {1, 1, 1}, {1, 3, 1}, {1, 1, 1}, }) setCombatArea(combat3, area3) local area4 = createCombatArea({ {1, 1, 1}, {1, 3, 1}, {1, 1, 1}, }) setCombatArea(combat4, area4) function doSpell(cid, var) local target = getCreatureTarget(cid) if isCreature(target) then local position = getCreaturePosition(target) local toPosition = {x = position.x + 2, y = position.y + 1, z = position.z} doSendMagicEffect(toPosition, 164) addEvent(doCombat, 1, cid, combat, var) addEvent(doCombat, 200, cid, combat2, var) addEvent(doCombat, 800, cid, combat3, positionToVariant(position)) addEvent(doCombat, 1100, cid, combat4, positionToVariant(position)) end end function onCastSpell(cid, var) return doSpell(cid, var) end
  5. Garou's post in (Resolvido)Escolher magias! was marked as the answer   
    Eu testei superficialmente, mas acho que funciona.
    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 local spells = { ["rage of the skies"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["hells core"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["eternal winter"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["wrath of nature"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, } 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 moeda = 2157 if msgcontains(msg, "spells") then local text = "Eu vendo essas magias: " local name, values = next(spells, nil) while name do text = text .." {".. name .."}: ".. values.price .." moedas" name, values = next(spells, name) if not name then text = text .."." else text = text .."," end end selfSay(text, cid) elseif spells[msg:lower()] then local spell = msg:lower() if not getPlayerLearnedInstantSpell(cid, spell) then if getPlayerLevel(cid) >= spells[spell].level then if isInArray(spells[spell].vocations, getPlayerVocation(cid)) then if doPlayerRemoveItem(cid, moeda, spells[spell].price) then if getCreatureStorage(cid, spells[spell].storage) == -1 then doPlayerLearnInstantSpell(cid, spell) selfSay("Você aprendeu uma nova magia chamada ".. spell .."!", cid) doCreatureSetStorage(cid, spells[spell].storage, 1) else selfSay("Você aprendeu uma magia desse tipo", cid) end else selfSay("Você não possui ".. spells[spell].price .." ".. getItemNameById(moeda) ..".", cid) end else selfSay("Sua vocação não pode aprender essa magia.", cid) end else selfSay("Você não possui o level necessário para aprender essa magia.", cid) end else selfSay("Você já aprendeu essa magia.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  6. Garou's post in (Resolvido)Meu servidor não está aceitando as scripts was marked as the answer   
    Procure salvar o arquivo com codificação UTF8
     
    vlw flw

Informação Importante

Confirmação de Termo