21 horas atrás, zipter98 disse:Ah, eu programei apenas para Castforms de jogadores.
Vou editar para os selvagens também.
Pronto, editado para Castforms selvagens.
aqui esta o script
elseif spell == "Transform" then
local config = {
forms = {"Castform", "Fire Castform", "Water Castform", "Ice Castform"}, --Formas, na ordem de transformação.
effects = {
["water"] = 18, --["elemento_primário_da_nova_forma"] = efeito_na_transformação,
["ice"] = 18,
["fire"] = 18,
}
}
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..".")
doSendMagicEffect(getThingPos(cid), config.effects[pokes[newPoke].type] or 18)
doTransformItem(pokeball, icons[getItemAttribute(pokeball, "poke")].use)
doTransformItem(getPlayerSlotItem(owner, 7).uid, fotos[newPoke])
local oldpos, oldlod, health_percent_lost = getThingPos(cid), getCreatureLookDir(cid), (getCreatureMaxHealth(cid) - getCreatureHealth(cid)) * 100 / getCreatureMaxHealth(cid)
doRemoveCreature(cid)
doSummonMonster(owner, newPoke)
local pk = getCreatureSummons(owner)[1]
doTeleportThing(pk, oldpos, false)
doCreatureSetLookDir(pk, oldlod)
adjustStatus(pk, pokeball, true, false)
doCreatureAddHealth(pk, -(health_percent_lost * getCreatureMaxHealth(pk) / 100))
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
if not isSummon(cid) then
local pos, dir, health_percent_lost = getThingPos(cid), getCreatureLookDir(cid), (getCreatureMaxHealth(cid) - getCreatureHealth(cid)) * 100 / getCreatureMaxHealth(cid)
doRemoveCreature(cid)
local newMonster = doCreateMonster(next_form, pos)
adjustWildPoke(newMonster)
doCreatureSetLookDir(newMonster, dir)
doCreatureAddHealth(newMonster, -(health_percent_lost * getCreatureMaxHealth(newMonster) / 100))
else
local p = getPlayerSlotItem(getCreatureMaster(cid), ![]()
if not p then return true
end ------- coloquei este end
fakeEvolution(cid, next_form, p.uid)
end
bom agora deu 2 erros mas nenhum na distro
PRIMEIRO se meu pokemon tiver com 95% da vida total quando eu tranformar ele perde + 5% da vida ficando com 90% e se eu transformar novamente ele perde mais 10%
ou seja transformar esta tendo um custo de vida e esse custo é a % de vida ja perdida ou seja se meu pokemon tiver com 50% de vida ou menos e eu transformar ele morre.
SEGUNDO os pokemons selvagens quando se transforma recupera 100% de sua vida
EDIT: consegui arrumar o primeiro bug trocando ISSO >> doCreatureAddHealth(pk, -(health_percent_lost * getCreatureMaxHealth(pk) / 100))
POR ISSO >> doCreatureAddHealth(pk, health_percent_lost)
AGORA FALTA ARRUMAR O SEGUNDO BUG ONDE OS POKES SELVAGENS RESTALRA 100% DA VIDA





info
Grupo: Herói
Registrado: 20/09/12
Posts: 2.6k
Reputação: +1.1k
Gênero: Masculino
Ah, eu programei apenas para Castforms de jogadores.
Vou editar para os selvagens também.
Pronto, editado para Castforms selvagens.
Editado Dezembro 9 por zipter98