Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 06/14/22 em todas áreas

  1. elseif spell == "Transform" then local config = { forms = {"Castform", "Fire Castform", "Water Castform", "Ice Castform"}, --Formas, na ordem de transformação. effects = { ["water"] = xxx, --["elemento_primário_da_nova_forma"] = efeito_na_transformação, ["ice"] = xxx, ["fire"] = xxx, } } local function fakeEvolution(cid, newPoke, pokeball) local owner = getCreatureMaster(cid) if not owner then return true end local description = "Contains a "..newPoke.."." local pct = getCreatureHealth(cid) / getCreatureMaxHealth(cid) doItemSetAttribute(pokeball, "hp", pct) doItemSetAttribute(pokeball, "poke", newPoke) doItemSetAttribute(pokeball, "morta", "no") doItemSetAttribute(pokeball, "Icone", "yes") doItemSetAttribute(pokeball, "description", "Contains a "..newPoke..".") doTransformItem(pokeball, icons[getItemAttribute(pokeball, "poke")].use) doTransformItem(getPlayerSlotItem(owner, 7).uid, fotos[newPoke]) local oldpos, oldlod = getThingPos(cid), getCreatureLookDir(cid) doRemoveCreature(cid) doSummonMonster(owner, newPoke) local pk = getCreatureSummons(owner)[1] doTeleportThing(pk, oldpos, false) doCreatureSetLookDir(pk, oldlod) adjustStatus(pk, pokeball, true, false) if useKpdoDlls then doUpdateMoves(owner) end end table.find = function (table, value) for i, v in pairs(table) do if(v == value) then return i end end return nil end if not isInArray(config.forms, getCreatureName(cid)) then return true end local next_form = config.forms[table.find(config.forms, getCreatureName(cid)) + 1] if not next_form then next_form = config.forms[1] end doSendMagicEffect(getThingPos(cid), config.effects[pokes[next_form].type] or 18) if not isSummon(cid) then local pos, dir, health_lost = getThingPos(cid), getCreatureLookDir(cid), getCreatureHealth(cid) / getCreatureMaxHealth(cid) doRemoveCreature(cid) local newMonster = doCreateMonster(next_form, pos) setPlayerStorageValue(newMonster, 94831, health_lost) doCreatureSetLookDir(newMonster, dir) else local p = getPlayerSlotItem(getCreatureMaster(cid), 8) if not p then return true end fakeEvolution(cid, next_form, p.uid) end Depois, em data/lib/level system.lua, no código da função adjustWildPoke: Abaixo de: doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) coloque: if tonumber(getPlayerStorageValue(cid, 94831)) > -1 then local ratio = 1 - tonumber(getPlayerStorageValue(cid, 94831)) doCreatureAddHealth(cid, -(getCreatureMaxHealth(cid) * ratio))end
    1 ponto
  2. Supondo que, de fato, todas as funções tenham sido copiadas exatamente iguais (o código de box que você postou está incompleto, então me baseei no do PDA): local pokemon = { ["nome_do_pokémon"] = {price = xxx, boost = xxx}, --etc}function doCorrectString(str) --Slicer local name = str:explode(" ") local final = {} for _, s in ipairs(name) do table.insert(final, s:sub(1, 1):upper()..s:sub(2, #s):lower()) end return table.concat(final, (name[2] and " " or ""))endfunction onSay(cid, words, param) local p = param:lower() if p == "list" then local str = "******** You can buy: ********" for p_name, info in pairs(pokemon) do str = str.."\n-"..p_name.." [+"..info.boost.."] for "..info.price.." premium point(s)." end doPlayerPopupFYI(cid, str) elseif pokemon[doCorrectString(p)] then local poke = pokemon[doCorrectString(p)] if getAccountPoints(cid) < poke.price then doPlayerSendCancel(cid, "Sorry, you do not have enough points. ["..poke.price.." premium points]") return true end doPlayerSendTextMessage(cid, 27, "You successfully bought a "..doCorrectString(p).." [+"..poke.boost.."] for "..poke.price.." premium point(s).") doAccountRemovePoints(cid, poke.price) addPokeToPlayer(cid, doCorrectString(p), poke.boost, nil, "normal") else doPlayerSendCancel(cid, "Invalid parameter. Type 'list' to see a list of pokemon you can buy, or type the name of the wished pokemon.") end return trueend Algumas observações: Optei por deixar o código mais configurável. Você pode escolher os pokémon que podem ser comprados, junto com boost e preço específico. Essas informações são mostradas num parâmetro que incluí (/comando list). Logo, as opções de fala são: /comando nome_do_pokémon --Para comprar um pokémon./comando list --Para mostrar uma lista com os pokémon compráveis. Também, devo informar que os premium points não são compartilhados por outros personagens da conta. Para que isso aconteça, recomendaria instalar a função setAccountStorageValue, encontrada por aí na internet (acho que aqui no XTibia tem).
    1 ponto
  3. Abaixo de: if getPlayerStorageValue(cid, 17000) >= 1 then coloque: local fly_areas, canFly = { --{fromPos = {posição_superior_esquerda_da_área}, toPos = {posição_inferior_direita_da_área}}, {fromPos = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z}}, {fromPos = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z}}, --etc } for _, coordinates in pairs(fly_areas) do if isInRange(getThingPos(cid), coordinates.fromPos, coordinates.toPos) then canFly = true break end end if not canFly then doPlayerSendCancel(cid, "You can't fly here.") doTeleportThing(cid, frompos) return true end
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...