• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [creaturescripts] Level UP = HEALTH FULL AND MANA FULL?

samuel157

Intermediate OT User
Joined
Mar 19, 2010
Messages
618
Solutions
4
Reaction score
122
Location
São Paulo, Brazil
GitHub
Samuel10M
help please using server 8.60 No up health no mana

QsyX2Ak.png

ZAfUzX6.png


Code:
local config = {
savePlayersOnAdvance = true 
}

function onAdvance(cid, skill, oldLevel, newLevel)
if(config.savePlayersOnAdvance) then
doPlayerSave(cid, true)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid)) 
doCreatureAddMana(cid, getPlayerMaxMana(cid)-getPlayerMana(cid)) 
end

local pos = getPlayerPosition(cid) 
local effectPositions = { 
{x = pos.x, y = pos.y - 1, z = pos.z}, 
{x = pos.x, y = pos.y + 1, z = pos.z}, 
{x = pos.x - 1, y = pos.y, z = pos.z}, 
{x = pos.x + 1, y = pos.y, z = pos.z}
}
for _, ePos in ipairs(effectPositions) do 
doSendMagicEffect(ePos, CONST_ME_HOLYAREA) 
doSendAnimatedText(getThingPos(cid), "Gratz!" , 70) 
end 
return true
end
 
Please reference the stickied posting rules.
We require the Server version and any Errors In console.

We ask for this information so we can help you.
Without all available information we are simply guessing what the problem is and it's frustrating for both you and us if we guess wrong.

Please edit your post with updated information or reply with it.

Thank you.

Xikini
 
Code:
local config = {
savePlayersOnAdvance = true
}

function onAdvance(cid, skill, oldLevel, newLevel)
if(config.savePlayersOnAdvance) then
doPlayerSave(cid, true)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getPlayerMaxMana(cid))
end

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 1, z = pos.z},
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y, z = pos.z},
{x = pos.x + 1, y = pos.y, z = pos.z}
}
for _, ePos in ipairs(effectPositions) do
doSendMagicEffect(ePos, CONST_ME_HOLYAREA)
doSendAnimatedText(getThingPos(cid), "Gratz!" , 70)
end
return true
end
 
Code:
local config = {
    savePlayersOnAdvance = true
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill ~= SKILL__LEVEL then return true end
    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
    doCreatureAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))

    local pos = getPlayerPosition(cid)
    local effectPositions = {
        {x = pos.x, y = pos.y - 1, z = pos.z},
        {x = pos.x, y = pos.y + 1, z = pos.z},
        {x = pos.x - 1, y = pos.y, z = pos.z},
        {x = pos.x + 1, y = pos.y, z = pos.z}
    }
    for _, ePos in ipairs(effectPositions)do
        doSendMagicEffect(ePos, CONST_ME_HOLYAREA)
        doSendAnimatedText(getThingPos(cid), "Gratz!" , 70)
    end
    return true
end
?
 
Please show us your files:
data/creaturescripts/creaturescripts.xml
data/creaturescripts/scripts/login.lua
data/creaturescripts/scripts/YOUR_SCRIPT_TO_ADD_HP_MANA.lua (write name of this script example: addhpmana.lua)

then i can help you.

sure he have registered it because the script work
level up [315] and effects
I think you are wrong. Why so sure?
doSendAnimatedText(getThingPos(cid), "Gratz!" , 70)

Im pretty sure it's not registered.
 
Last edited:
Code:
local config = {
    savePlayersOnAdvance = true
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill ~= SKILL__LEVEL then return true end
    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
    doCreatureAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))

    local pos = getPlayerPosition(cid)
    local effectPositions = {
        {x = pos.x, y = pos.y - 1, z = pos.z},
        {x = pos.x, y = pos.y + 1, z = pos.z},
        {x = pos.x - 1, y = pos.y, z = pos.z},
        {x = pos.x + 1, y = pos.y, z = pos.z}
    }
    for _, ePos in ipairs(effectPositions)do
        doSendMagicEffect(ePos, CONST_ME_HOLYAREA)
        doSendAnimatedText(getThingPos(cid), "Gratz!" , 70)
    end
    return true
end
?

Good except that the save function should be loaded at the end, atleast after the health and mana code.
Also good that you tabbed it unlike the post above xD.

Topic:
You are using 2 advance scripts, the animated text string does not match your picture.
Merge them and take the health and mana code StreamSide posted.
 
Good except that the save function should be loaded at the end, atleast after the health and mana code.
Also good that you tabbed it unlike the post above xD.
lmao my bad

not function :(
and as wibbenz says, u are using another onadvance script, check it please
 
Back
Top