• 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!

Solved Update to the new version 1.1 tfs

norrow

Member
Joined
Dec 16, 2012
Messages
129
Reaction score
7
Location
Poland
As with so well I do not know the procedure to write on the new lua I decided that it will write to you with a request to rewrite the script for the new version
Code:
Trans = {
{["voc"] = 1, ["newVoc"] = 2, ["level"] = 30, ["mananeed"] = 20, ["looktype"] = 45, ["addHp"] = 50, ["addMp"] = 100},
{["voc"] = 2, ["newVoc"] = 3, ["level"] = 50, ["mananeed"] = 20, ["looktype"] = 25, ["addHp"] = 100, ["addMp"] = 200}
}
function onCastSpell(cid, var)
        for i = 1, #Trans do
            if getPlayerVocation(cid) == Trans[i].voc then
                if getPlayerLevel(cid) >= Trans[i].level then
                      if getPlayerMana(cid) >= Trans[i].mananeed then
                            if(Trans) then
                                doCreatureChangeOutfit(cid, {lookType=Trans[i].looktype})
                            else
                                doSetCreatureOutfit(cid, {lookType=Trans[i].looktype}, -1)
                            end
                                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + Trans[i].addHp)
                                setCreatureMaxMana(cid, getCreatureMaxMana(cid) + Trans[i].addMp)
                                doCreatureAddHealth(cid, Trans[i].addHp)
                                doCreatureAddMana(cid, Trans[i].addMp)
                                doPlayerSetVocation(cid,Trans[i].newVoc)            
                                return true
                        else
                            doPlayerSendCancel(cid, "You need " .. Trans[i].mananeed .. " mana to transform!")
                            doSendMagicEffect(getCreaturePosition(cid), 2)
                            return true
                        end     
                else
                    doPlayerSendCancel(cid, "You need " .. Trans[i].level .. " level to transform!")
                    doSendMagicEffect(getCreaturePosition(cid), 2)
                    return true
                end
            end
        end

    doSendMagicEffect(getCreaturePosition(cid), 2)
    return true
end
@Limos @Printer Are you able to help?
 
Code:
local config = {
    [1] = {newVoc = 2, level = 30, manaNeed = 20, lookType = 45, addHp = 50, addMp = 100},
    [2] = {newVoc = 3, level = 50, manaNeed = 20, lookType = 25, addHp = 100, addMp = 200}
}

function onCastSpell(creature, var)
    creature:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    local targetVocation = config[creature:getVocation():getId()]
    if not targetVocation then
        return false
    end

    if creature:getLevel() < targetVocation.level then
        creature:sendCancelMessage("You need " .. targetVocation.level .. " level to transform!")
        return false
    end

    if creature:getMana() < targetVocation.manaNeed then
        creature:sendCancelMessage("You need " .. targetVocation.manaNeed .. " mana to transform!")
        return false
    end

    creature:setOutfit({lookType = targetVocation.lookType})
    creature:setMaxHealth(creature:getMaxHealth() + targetVocation.addHp)
    creature:setMaxMana(creature:getMaxMana() + targetVocation.addMp)
    creature:addHealth(targetVocation.addHp)
    creature:addMana(targetVocation.addMp)
    creature:setVocation(Vocation(targetVocation.newVoc))
    return true
end
 
Back
Top