Yeah can you explain what this function is supposed to do? Are you using it on a player? Or a monster or what?
if (getPlayerVocation(cid) == 1) and (getPlayerLevel(cid) >= 50) then
doPlayerSetVocation(cid,2)
doSetCreatureOutfit(cid, {lookType=31}, -1)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+200)
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+100)
doSendMagicEffect(getCreaturePosition(cid), 14)
end



If I add 1 health and then remove it I will get battle condition which I don't want.Just add 1 health and then remove it?
after changesdoRemoveCondition(cid, CONDITION_INFIGHT)
I just do it for fun while trying to learn how to create spells etcand stop doing anime-based otservers, their sprites are flat and terrible
What if player is already in battle?
(...)
local state = getCreatureCondition(cid, CONDITION_INFIGHT)
-- do your transform stuff
-- set max health / mana
-- add 1 health / mana then remove it, if full health / mana remove 1 health / mana then add it
if not state then
doRemoveCondition(cid, CONDITION_INFIGHT)
end
as Defeater said
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
this will update the hp just like a spell would
but I'm not clear if your screen shots are posted correctly? but basically if you use the spell to transform it transforms and what not but does not give the player the extra hp visably in client?
like it's supposed to turn 1000 into 1200? but it doesn't? unless you use the spell, then when you use the spell it makes your mana 90 lower?
looks like a bug to me...
LUA:local state = getCreatureCondition(cid, CONDITION_INFIGHT) -- do your transform stuff -- set max health / mana -- add 1 health / mana then remove it, if full health / mana remove 1 health / mana then add it if not state then doRemoveCondition(cid, CONDITION_INFIGHT) end
--Transform
function onCastSpell(cid, var)
if (getPlayerVocation(cid) == 1) and (getPlayerLevel(cid) >= 50) then
local state = getCreatureCondition(cid, CONDITION_INFIGHT)
doPlayerSetVocation(cid,2)
doSetCreatureOutfit(cid, {lookType=31}, -1)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+200)
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+100)
doCreatureAddHealth(cid, 1)
doCreatureAddMana(cid, 1)
doCreatureAddHealth(cid, -1, false)
doCreatureAddMana(cid, -1, false)
if not state then
doRemoveCondition(cid, CONDITION_INFIGHT)
end
elseif getPlayerLevel(cid) < 50 then
doSendMagicEffect(getCreaturePosition(cid), 3)
doPlayerSendCancel(cid, "You need 50 level to transform!")
elseif getPlayerVocation(cid) == 2 then
doPlayerSendCancel(cid, "It's your last transform.")
end
return true
end