Ir para conteúdo

Fakezim

Campones
  • Total de itens

    4
  • Registro em

  • Última visita

  • Dias Ganhos

    1

Fakezim venceu a última vez em Junho 26 2022

Fakezim had the most liked content!

Sobre Fakezim

Perfil

  • Gênero
    Masculino

Informações

  • Forma que conheci o xTibia
    Otservs
  • Sou
    Programador

Últimos Visitantes

O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.

Fakezim's Achievements

  1. Olá xtibianos, Faz muito, muito tempo que eu não mexo com programação de scripts, porém, nessa semana bateu uma saudade, e tentei fazer algo de diferente pra passar o tempo, e acabei me empolgando, e fiz um sistema de auras, que é como uma bolha de luz que te rodeia (no meu caso é uma bolha de cura, porém você pode colocar o efeito de distância que quiser), e te cura continuamente enviando clones do efeito, ela só envia bolhas de cura se seu hp não estiver cheio. Você pode conferir como funciona, superficialmente, assistindo o vídeo a seguir : Para ativar a aura basta escrever "!aura on", e para desligar "!aura off". Bom, vamos aos códigos. na pasta data\talkactions\scripts, crie um arquivo chamado aura.lua, e cole o seguinte código nele : (é necessário dois storages disponíveis distintos) -- CONFIGURAÇÕES aurastr = 25950 -- storage da aura estr = 25951 -- storage para o exhaust porcentagem = 40 -- chance de curar em cada volta da aura, em porcentagem quantheal = 10 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura) tempo = 1180 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar) tipoaura = 30 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo) efeitocura = 49 -- número do efeito quando a cura chega ao player (efeito de posição fixa, pode ser identificado com /z no jogo) -- Função que chama a aura function efeitosAura(i,tm,cid) if(isCreature(cid)) then local atual = getCreaturePosition(cid) local posaura = { {x=(atual.x)-1, y=(atual.y)-1, z=atual.z}, {x=atual.x, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=atual.y, z=atual.z}, {x=(atual.x)+1, y=(atual.y)+1, z=atual.z}, {x=atual.x, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=atual.y, z=atual.z}, } local chances = math.random(100) if(chances<=porcentagem/8 and getCreatureHealth(cid)<getCreatureMaxHealth(cid)) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/quantheal) if(i<=8 and i>1) then doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, atual, tipoaura) else doSendDistanceShoot({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, atual, tipoaura) end doSendMagicEffect(atual, efeitocura) end if(i==8) then doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, {x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, tipoaura) elseif(i<8) then doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, {x=posaura[i+1].x, y=posaura[i+1].y, z=posaura[i+1].z}, tipoaura) end if(i<=8 and getPlayerStorageValue(cid, aurastr)==2) then i = i+1 tm = tempo/8 return addEvent(efeitosAura,tm,i,tm,cid) elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then return efeitosAura(1,0,cid) else return TRUE end else return TRUE end end -- Função principal function onSay(cid, words, param, channel) if(param=="on") then if getPlayerStorageValue(cid, estr) > os.time() then doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura novamente.") else if(getPlayerStorageValue(cid, aurastr)==2) then doPlayerSendCancel(cid,"Sua aura já está habilitada.") elseif(getPlayerStorageValue(cid, aurastr)==-1) then doPlayerSendCancel(cid,"Aura ligada!") setPlayerStorageValue(cid, aurastr, 2) efeitosAura(1,tempo/8,cid) end end elseif(param=="off") then if(getPlayerStorageValue(cid, aurastr)==2) then setPlayerStorageValue(cid, estr, os.time()+2) setPlayerStorageValue(cid, aurastr, -1) doPlayerSendCancel(cid,"Aura desligada!") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligá-la.") end return TRUE end Logo após vá na em talkactions.xml, e cole o seguinte trecho : <talkaction words="!aura" event="script" value="aura.lua"/> E também, dentro do arquivo login.lua, localizado na pasta creatureevents\scripts, logo abaixo de "function onLogin(cid)", cole o seguinte trecho : aurastr = 25950 -- storage da aura setPlayerStorageValue(cid, aurastr, -1) As configurações estão comentadas, então agora é só colocar suas preferências, aproveitar e usar. Lembrando que você pode mudar os efeitos da aura, o tempo de cada volta da aura(que é recomendável não mexer, se deixar o efeito padrão do script, que no caso é o efeito de luz), a quantidade de hp que o jogador irá restaurar e a porcentagem de chance que o jogador tem de recuperar hp em cada volta (pode recuperar hp mais de uma vez em uma mesma volta da aura). Fica ao seu dispor se deseja colocar se apenas vips usam a aura no script ou não, eu não incrementei pois estou meio sem tempo, mas não é algo difícil de se fazer. Obrigado, e bom proveito! OBS : Tomem bastante cuidado ao dar reload no talkactions no server enquanto há auras em ação, elas serão desativadas, e todos os players terão que desligá-las, e ligá-las novamente. (!aura off, e em seguida !aura on)
  2. Olá pessoal \o/. Hoje vim trazer um script que fiz atoa, porém, bastante útil. O script funciona assim : você dá um item diretamente a um player pré-determinado, ao invés de ter que ir ao player, jogar no chão e ele ter que pegar. Pode-se usar o script através da seguinte maneira : "/presente player,itemid ou itemname,quantidade". Por exemplo : /presente Player,crystal coin,100 ou /presente Player,2160,100. Então, sem mais enrolação, vamos ao script : Crie um arquivo chamando senditemtoplayer.lua e coloque isto dentro dele : function onSay(cid, words, param) if (param == "") then doPlayerSendCancel(cid, "É necessário escrever o nome de um player, e um item") return TRUE end p = string.explode(param, ",") local player = getPlayerByName(p[1]) local ret = RETURNVALUE_NOERROR local tmp = getCreaturePosition(player) if player then else doPlayerSendCancel(cid, "Este player não existe.") return TRUE end local create = tonumber(p[2]) if not create then create = getItemIdByName(p[2], FALSE) if(create == LUA_ERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item não existe.") return TRUE end end local countitem = 100 if (p[3]) then countitem = p[3] end local item = doCreateItemEx(create, countitem) if(p[4] and getBooleanFromString(p[4]) == TRUE) then if(p[5] and getBooleanFromString(p[5]) == TRUE) then tmp = getPlayerLookPos(player) end ret = doTileAddItemEx(tmp, item) else ret = doPlayerAddItemEx(player, item, TRUE) end if(ret ~= RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O ID: " .. p[2].." não existe.") else doSendMagicEffect(getCreaturePosition(player), 13) doSendMagicEffect(getCreaturePosition(cid), 12) doCreatureSay(player, "Você recebeu um presente do ".. getCreatureName(cid) .. " ", TALKTYPE_ORANGE_1) -- Aqui é a mensagem que o player receberá ao receber o item. return TRUE end return true end Vá em talkactions.xml e cole esta tag : <talkaction log="yes" access="5" words="/presente" event="script" value="senditemtoplayer.lua"/> Você pode livremente editar o acess mínimo, ou o que vai aparecer quando você der um item ao player. Então, é isso pessoal, muito obrigado pela atenção a vocês que leram até aqui.
  3. Fakezim

    Car

    Errado. O ID "9742" não é um unique/actionID é o ID do item, ou seja, o MoveEvent é aplicado diretamente no item, e só funciona nele, que tem ID 9742. ----------------------------- JuninhoSimao, esse script não é seu, colocar os créditos do autor sempre é bom.
  4. Olá xtibianos, Gostaria de uma script de uma talkaction que forneceria uma second promotion ao player, e que ao mesmo tempo, retornava o player para um certo level. Lembrando que teria que ter um level mínimo para adquirir a second promotion. Espero que consigam me ajudar. Grato :] --------------EDIT--------------- Não precisa mais, peguei um script de talkaction de second promotion e consegui adicionar pro player voltar de level , obrigado a todos que pelo menos leram kk.
  5. Digaao Ah sim, muito obrigado. Agora vou ter que ter paciência pra configurar todos scripts e configurações tuuuuudo denovo , kkkk, só faltava esse script pra eu começar a abrir meu OT, mas obrigado, vou baixar outro distro.
  6. Demoonbholder Ao executar o server aparece alguma coisa como : "attemp call global 'getCreatureHealth' ", aí mostra o script e a linha que dá erro ------------------------------------------ Digaao Por acaso era o Slayer Yurots 8.6?
  7. O script é meio complexo, é uma parte de um sistema de pets, vou postar apenas o script que está dando o erro : PETS = { VERSION = "1.72", PREFIX = "PET_", CHANNELID = 1, IDENTIFICATION = { [1] = { name = "Cat", price = 100, health = 100, evolve = { to = 3, at = 10, }, check = true, }, [2] = { name = "Dog", price = 100, health = 100, evolve = { to = 4, at = 10, }, check = true, }, [3] = { name = "Tiger", price = false, health = 300, check = false, info = "Evolves from Cat." }, [4] = { name = "Lion", price = false, health = 300, check = false, info = "Evolves from Dog." }, [5] = { name = "Husky", price = 150, health = 150, check = function(cid) return isPremium(cid) end, info = "Requires a premium account." }, [6] = { name = "Wolf", price = 300, health = 200, evolve = { to = 7, at = 28, }, check = function(cid) return getPlayerLevel(cid) >= 10 end, info = "Requires level 10." }, [7] = { name = "War Wolf", price = false, health = 500, evolve = { to = 8, at = 55, }, check = false, info = "Evolves from Wolf." }, [8] = { name = "Werewolf", price = false, health = 1000, check = false, info = "Evolves from War Wolf." }, [9] = { name = "Bear", price = 200, health = 300, check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end, info = "Only available to druids above level 10." }, [10] = { name = "Panda", price = 200, health = 300, check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end, info = "Only available to druids above level 10." }, [11] = { name = "Chicken", price = 50, health = 50, check = true, }, [12] = { name = "Sheep", price = 50, health = 50, check = true, }, [13] = { name = "Seagull", price = 100, health = 100, check = function(cid) return isPremium(cid) end, info = "Requires a premium account." }, [14] = { name = "Parrot", price = 100, health = 100, check = function(cid) return isPremium(cid) end, info = "Requires a premium account." }, [15] = { name = "Penguin", price = 100, health = 100, check = function(cid) return isPremium(cid) end, info = "Requires a premium account." }, [16] = { name = "Elephant", price = 300, health = 300, check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 10 end, info = "Only available to Premium accounts above level 10." }, [17] = { name = "Dragon Hatchling", price = 1000, health = 300, evolve = { to = 18, at = 20, }, check = function(cid) return isPremium(cid) and isSorcerer(cid) and getPlayerLevel(cid) >= 25 end, info = "Only available to Premium Sorcerers above level 25." }, [18] = { name = "Dragon", price = false, health = 1000, check = false, info = "Evolves from Dragon Hatchling." }, [19] = { name = "Monster Killer", price = 1000000, health = 3000000, check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 15000 end, info = "Only avaible to Premium accounts above level 15000" }, } } STORAGE = { PETTYPE = 10000, PETUID = 10001, LOSTHEALTH = 10002, MAXHEALTH = 10003, EXPERIENCE = 10004, LEVEL = 10005, } function getExpNeeded(level) return (50 * (level - 1)^3 - 150 * (level - 1)^2 + 400 * (level - 1)) / 3 end petNames = {} for i, v in ipairs(PETS.IDENTIFICATION) do petNames[v.name:lower()] = i end function sendMessage(cid, message) return doPlayerSendChannelMessage(cid, "", message, TALKTYPE_CHANNEL_O, PETS.CHANNELID) end function resetPlayerPet(cid) setPlayerStorageValue(cid, STORAGE.PETTYPE, -1) setPlayerStorageValue(cid, STORAGE.PETUID, -1) setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0) setPlayerStorageValue(cid, STORAGE.MAXHEALTH, 0) setPlayerStorageValue(cid, STORAGE.EXPERIENCE, 0) setPlayerStorageValue(cid, STORAGE.LEVEL, 1) end function getPlayerPet(cid) return getPlayerStorageValue(cid, STORAGE.PETUID) end function setPlayerPet(cid, pet) return setPlayerStorageValue(cid, STORAGE.PETUID, pet) end function getPlayerPetType(cid) return getPlayerStorageValue(cid, STORAGE.TYPE) end function setPlayerPetType(cid, type) return setPlayerStorageValue(cid, STORAGE.TYPE, type) end function evolvePet(cid) local pet = PETS.IDENTIFICATION[getPlayerPetType(cid)] if pet.evolve then local petcid = getPlayerPet(cid) local pos if isCreature(petcid) then pos = getCreaturePosition(petcid) doRemoveCreature(petcid) end setPlayerPet(cid, 0) setPlayerPetType(cid, pet.evolve.to) setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[pet.evolve.to].health) setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0) if pos then summonPet(cid, pos) end return true end return false end function addPetExp(cid, amount) local totalExp = getPlayerStorageValue(cid, STORAGE.EXPERIENCE) + amount setPlayerStorageValue(cid, STORAGE.EXPERIENCE, totalExp) local level = getPlayerStorageValue(cid, STORAGE.LEVEL) local leveled = false while totalExp >= getExpNeeded(level + 1) do level = level + 1 leveled = true end if leveled then local petType = getPlayerPetType(cid) setPlayerStorageValue(cid, STORAGE.LEVEL, level) sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has leveled up to level "..level..".") if PETS.IDENTIFICATION[petType].evolve then if level >= PETS.IDENTIFICATION[petType].evolve.at then local position = getCreaturePosition(cid) evolvePet(cid) sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has evolved into a "..PETS.IDENTIFICATION[PETS.IDENTIFICATION[petType].evolve.to].name..".") end end end end function addPet(cid, type) if isCreature(getPlayerPet(cid)) then return false end resetPlayerPet(cid) setPlayerPet(cid, 0) setPlayerPetType(cid, type) setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[type].health) return true end function summonPet(cid, pos) if isCreature(getPlayerPet(cid)) then return false end if getTilePzInfo(getCreaturePosition(cid)) or getTilePzInfo(pos) or doTileQueryAdd(cid, pos) ~= 1 then return false end local pet = doSummonCreature(PETS.PREFIX..PETS.IDENTIFICATION[getPlayerPetType(cid)].name, pos) if isCreature(pet) then doSendMagicEffect(pos, CONST_ME_TELEPORT) doConvinceCreature(cid, pet) local maxHealth = getPlayerStorageValue(cid, STORAGE.MAXHEALTH) setCreatureMaxHealth(pet, maxHealth) doCreatureAddHealth(pet, maxHealth - getCreatureHealth(pet) - getPlayerStorageValue(cid, STORAGE.LOSTHEALTH)) setPlayerPet(cid, pet) doCreatureSetSkullType(pet, SKULL_YELLOW) registerCreatureEvent(pet, "PetDeath") registerCreatureEvent(pet, "PetKill") registerCreatureEvent(pet, "PetAttack") return pet end return false end function canBuyPet(cid, id) if getPlayerAccess(cid) >= 3 then return true end if not PETS.IDENTIFICATION[id].price then return false end if type(PETS.IDENTIFICATION[id].check) == "function" then return PETS.IDENTIFICATION[id].check(cid) end return PETS.IDENTIFICATION[id].check end Detalhe : Quando tiro a parte 'getCreatureHealth' o script funciona normalmente, porém, fica incompleto, e não executa parte do sistema. E isso é a parte base do sistema, existe outro script do sistema que também usa getCreatureHealth, mas essa é indispensável.
  8. Eremyth, Realmente, não achei 'getCreatureHealth', então terei que pegar a function.lua de outro Otserv da mesma versão que o meu? ------------------ SkyDangerous, Sim, tenho certeza. Porque outros scripts que estavam prontos, e funcionavam perfeitamente em meu antigo server, dava erro apenas nessa função. Eu até fiz outros scripts básicos pra testar se realmente era a função que estava dando erro, e confirmei que é sim a função.
  9. Bom, minha dúvida é a seguinte : Em qualquer script que eu use a função 'getCreatureHealth' ela não funciona, dá erro. E não é erro de escrita na função, e sim a própria função não funciona. Será que existe alguma solução para isso? Nunca vi algo assim, a própria função parar de funcionar. Eu tinha um Otserv 8.5, bem antiguinho, e atualmente resolvi abrir novamente um Otserv, mas 8.6. Consegui arrumar quase tudo, porém, eu uso a função 'getCreatureHealth' em muitos scripts, e todos eles dão falha. Então, se alguém souber a solução, aguardo respostas.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...