Ir para conteúdo

Strikerzerh

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Curtir
    boa, funcionou?
  2. Obrigado
    Strikerzerh deu reputação a Peemello em Criatura Spawnar mesmo com player na tela   
    Isso precisa ser feito nas source, e compilar novamente com o arquivo spawn.cpp editado.
    Se quiser, siga o tutorial abaixo:
     
     
    Em spawn.cpp
     
     
    Procure por 
    bool Spawn::findPlayer(const Position& pos) E no lugar de:
    bool Spawn::findPlayer(const Position& pos) { SpectatorVec list; g_game.getSpectators(list, pos); Player* tmpPlayer = NULL; for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it) { if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->hasFlag(PlayerFlag_IgnoredByMonsters)) return true; } return false; } Coloque:
    bool Spawn::findPlayer(const Position& pos) { SpectatorVec list; g_game.getSpectators(list, pos); Player* tmpPlayer = NULL; for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it) { if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->hasFlag(PlayerFlag_IgnoredByMonsters)) return false; } return false; } Pronto, irá spawnar com ou sem player na tela, já foi testado por mim.
  3. Obrigado
    Strikerzerh deu reputação a MatteusDeli em AJUDA NPC 8.60   
    @Strikerzerh Boa noite
     
    XML do Npc
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Traveller" script="data/npc/scripts/traveler.lua" walkinterval="1000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="96" body="99" legs="76" feet="115" addons="1"/> </npc>  
    Na pasta data/npc/scripts crie um arquivo chamado traveler.lua e adicione isso dentro: 
    local TELEPORT_EFFECT = 10 local config = { ['Demonland'] = { position = { x=160, y=54, z=7 }, items = { [2160] = { count = 1 }, [2124] = { count = 1 } } }, ['Orc Hall'] = { position = { x=160, y=54, z=7 }, items = { [8299] = { count = 1 }, } }, -- [DESTINO] = { -- position = { x=160, y=54, z=7 }, -- items = { -- [ITEM_ID] = { count = QUANTIDADE_DO_ITEM }, -- } -- }, } 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 if (not checkDestinyExists(msg)) then selfSay('Este lugar nao existe. Por favor diga outro.', cid) return false end local destinyData = getDestinyData(msg) if msgcontains(string.lower(msg), string.lower(destinyData.destiny)) then local items = {} for item, data in pairs(destinyData.data.items) do if (getPlayerItemCount(cid, item) < data.count) then table.insert(items, { item = item }) end end if (#items <= 0) then removePlayerItems(cid, destinyData.data.items) doTeleportThing(cid, destinyData.data.position) doSendMagicEffect(getThingPos(cid), TELEPORT_EFFECT) selfSay('Ate mais.', cid) return true end selfSay('Voce nao possui todos os itens necessarios para viajar.', cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function checkDestinyExists(destiny) for dest, _ in pairs(config) do if (string.lower(dest) == string.lower(destiny)) then return true end end return false end function getDestinyData(destiny) for dest, data in pairs(config) do if (string.lower(dest) == string.lower(destiny)) then return { destiny = dest, data = data } end end end function removePlayerItems(cid, items) for item, data in pairs(items) do doPlayerRemoveItem(cid, item, data.count) end end  
  4. Curtir
    Strikerzerh deu reputação a MatteusDeli em Alguem ajuda? [ 8.60 ]   
    @Strikerzerh Boa tarde
     
    local config = { item = 8988, -- ID ou ACTIONID que o item do player será usado, exemplo seria uma porta teleport = { position = { x=160, y=54, z=7 }, -- Posição para onde o player será teleportado effect = 10 -- Efeito do teleporte } } function onUse(cid, item, fromPos, itemEx, toPos) if (itemEx.itemid == config.item or itemEx.actionid == config.item) then doTeleportThing(cid, config.teleport.position) doSendMagicEffect(getThingPos(cid), config.teleport.effect) end return true end  
    <action itemid="ID_ITEM" script="ARQUIVO.lua" />  
    ID_ITEM = É o item que o player usara para realizar a ação, exemplo de uma key
     
    Obs: Recomendo usar o item com action_id para diferencia-lo.
     
    <action actionid="ACTIONID_ITEM" script="ARQUIVO.lua" />  
  5. Curtir
    Strikerzerh deu reputação a FeeTads em (Resolvido)Nascer monstro a cada x tempo [ 8.60 ]   
    altera no spawn.xml
  6. Curtir
    Strikerzerh deu reputação a FeeTads em (Resolvido)Sd dando dano igual em monstro e player   
    faltou o "then" kkkkkk nessa eu sempre falou
    bota assim:
    if isMonster(getCreatureTarget(cid)) then
  7. Gostei
    Strikerzerh deu reputação a FeeTads em (Resolvido)Sd dando dano igual em monstro e player   
    você esqueceu do resto do script kkkkkkk vou deixar ele 100%

     
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) function onGetFormulaValues(cid, level, maglevel) if isMonster(getCreatureTarget(cid)) then -- se for monster min = -(level * 3 + maglevel * 4) * 10 max = -(level * 3 + maglevel * 5) * 10.5 else --se for qualquer outra coisa min = -(level * 3 + maglevel * 4) * 5 max = -(level * 3 + maglevel * 5) * 5.5 end return min, max end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end  
  8. Obrigado
    Não posso dar suporte de scripts postados aki, fora do TibiaKing manin

    segue o código arrumado:
    caso tenha algum bug, manda print do erro do console.

    data > npc > scripts > NPCtroca.lua
    -- make by FeeTads //assistente TibiaKing 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:lower()) end function onThink() npcHandler:onThink() end local talkState = {} -- function de tempo //NÃO MEXER local function getTimeString(self) local format = { {'dia', self / 60 / 60 / 24}, {'hora', self / 60 / 60 % 24}, {'minuto', self / 60 % 60}, {'segundo', self % 60} } local out = {} for k, t in ipairs(format) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find('segundo') then local a, b = ret:find(' e ') ret = ret:sub(b+1) end return ret end local itemid = { -- id dos items necessários pra troca [1] = {item = 7775, count = 1}, -- item = ID do item // count = quantidade de items } local save_items = 0 -- variavel apenas pra salvar a quantidade de items //nao mexer local tempo_de_espera = 1 -- em minutos local storage = 58458711 -- storage //se não souber, não mexer local storageAceitar = 58458712 -- storage //se não souber, não mexer local item_trocado = 7775 -- id do item que vira após a troca local trocar_mais_de_uma_vez = true -- o player pode trocar varias vezes esse 4 items por 1? //true pode trocar mais de 1x //false só troca uma vez 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 msg = string.lower(msg) if isInArray({"items", "items", "lista"}, msg) then -- se o player disser "lista" local lista = '' -- string pra salvar a lista de items for i=1, #itemid do lista = lista..itemid[i].count..' - '..getItemNameById(itemid[i].item) -- salva a quantidade e o nome dos items if i+1 <= #itemid then lista = lista..', ' -- caso ainda tenha items, coloca uma virgula pra separar //n mexer end end selfSay("A lista de items são: {"..lista.."}", cid) -- mostra a lista de items selfSay("Você {aceita} pegar esses items?", cid) talkState[talkUser] = 10 elseif isInArray({"no", "não", "nop", "not"}, msg) and talkState[talkUser] == 10 then -- caso o player n aceite, só da BYE selfSay("OK, Bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"yes", "aceito", "sim"}, msg) and talkState[talkUser] == 10 then -- se o player aceitar selfSay("OK! estarei a espera!", cid) setPlayerStorageValue(cid, storageAceitar, 1) -- seta a storage pra1 talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"trocar","troca","trocar item"}, msg) then -- mensagem do player if getPlayerStorageValue(cid, storageAceitar) == 1 then -- se o player ja tiver aceitado a missão local lista = '' for i=1, #itemid do lista = lista..itemid[i].count..' - '..getItemNameById(itemid[i].item) if i+1 <= #itemid then lista = lista..', ' end end selfSay("Você deseja trocar {"..lista.."} pelo supremo item?", cid) -- msg do NPC mostrando a lista talkState[talkUser] = 2 else selfSay("Primeiro gostaria de ver a {lista} de items?", cid) -- se o player não tiver aceitado, pede pra ele ver a lista talkState[talkUser] = 11 end elseif isInArray({"no","não","bye","not"}, msg) and talkState[talkUser] == 11 then selfSay("OK, Bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"sim","quero","yes","yeah"}, msg) and talkState[talkUser] == 11 then local lista = '' for i=1, #itemid do lista = lista..itemid[i].count..' - '..getItemNameById(itemid[i].item) if i+1 <= #itemid then lista = lista..', ' end end selfSay("A lista de items são: {"..lista.."}", cid) selfSay("Você {aceita} pegar esses items?", cid) talkState[talkUser] = 10 -- basicamente mostra a lista... elseif isInArray({"sim","quero","yes","yeah"}, msg) and talkState[talkUser] == 2 then if trocar_mais_de_uma_vez == false and getPlayerStorageValue(cid, storage) ~= -1 then -- se puder trocar apenas 1x deixar false selfSay("Desculpe, você já fez sua troca!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) return true end for i=1, #itemid do -- for pra fazer a contagem dos items if getPlayerItemCount(cid, itemid[i].item) >= itemid[i].count then -- caso o player tenha o item save_items = save_items + 1 -- salva na variavel end end if save_items >= #itemid then -- se tiver todos os items necessários selfSay("Parabéns! agora vou craftar seu item, ele irá demorar "..getTimeString(tempo_de_espera*60).." pra ficar pronto.", cid) -- manda a mensagem setPlayerStorageValue(cid, storage, os.time() + (tempo_de_espera*60)) -- seta a storage pra 60 minutos for i=1, #itemid do doPlayerRemoveItem(cid, itemid[i].item, itemid[i].count) -- remove os items do player end else selfSay("Desculpe, você não tem os items necessários!", cid) -- mensagem caso não tenha os items necessários talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end elseif isInArray({"no","não","nao","not"}, msg) and talkState[talkUser] == 2 then -- caso o player não queira trocar, só da tchau selfSay("Tudo bem então, Bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"receber","receber item"}, msg) then -- caso o player digite "receber" if (getPlayerStorageValue(cid, storage) - os.time() <= 0 and getPlayerStorageValue(cid, storage) ~= 0) then -- checa se já passou [tempo de espera], e não é 0 local new_item = doCreateItemEx(item_trocado, 1) local receive = doPlayerAddItemEx(cid, new_item) if receive == RETURNVALUE_NOERROR then -- caso o player tenha slot na bp, etc.. selfSay("Parabéns! seu item está entregue, bom jogo!", cid) -- msg do NPC setPlayerStorageValue(cid, storage, 0) -- seta a storage do player pra 0 talkState[talkUser] = 0 npcHandler:releaseFocus(cid) else selfSay("Seu item está pronto, deixe espaço em sua BP!", cid) -- caso não consiga entregar o item só pede pra deixar espaço talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end elseif getPlayerStorageValue(cid, storage) - os.time() > 0 then selfSay("Seu item {não está pronto}, volte em "..getTimeString((getPlayerStorageValue(cid, storage)-os.time()))..".", cid) -- caso ainda não esteja pronto o item talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif getPlayerStorageValue(cid, storage) == 0 then selfSay("Você não me entregou nenhum item ainda!", cid) -- caso ainda não esteja pronto o item talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
    e o XML do NPC, troca pra esse:

    data > npc > NPCtroca.xml
    <?xml version="1.0" encoding="UTF-8"?> <npc name="[NPC] Troca" script="data/npc/scripts/NPCtroca.lua" walkinterval="0" floorchange="0" emblem="3"> <health now="100" max="100"/> <look type="133" head="21" body="1" legs="76" feet="25" addons="3"/> <parameters> <parameter key="message_greet" value="Ola, voce gostaria de saber a {lista}, {trocar} seus items pelo item supremo, ou {receber}?" /> </parameters> </npc>  
  9. Curtir
    Strikerzerh deu reputação a FeeTads em (Resolvido)ERRO DISTRO SISTEMA VIP [ 8.60 ]   
    existe 4 funções pra checar alguma creature no tibia
    isCreature(cid) > se é alguma creature, ou seja, se é algo passando ali.
    isPlayer(cid) > se é um player, qualquer outra coisa q não seja player, não se encaixa.
    isMonster(cid) > se é monster, qualquer coisa que não seja monster não se encaixa.
    isSummons(creature) > se é summon tanto de bixo como de player

    o seu script pra ignorar NPC's e monsters deve ficar assim:

     
    -- Script Vip Sytem 1.0 -- function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then -- se não for player return true -- retorna true end local config = { msgDenied = "Está área é exclusiva para jogadores VIP. Para adquirir sua VIP basta usar o comando: !comprarvip10 ou !comprarvip30.", msgWelcome = "Bem Vindo a Área VIP!" } if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then doTeleportThing(cid, fromPosition, true) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied) doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome) return TRUE end  

Informação Importante

Confirmação de Termo