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

[LF] Transform system tfs 0.4 / 8.6

try it and let me know is it working well

in talkactions.xml
Code:
<talkaction words="transform" script="transform.lua" />
<talkaction words="revert" script="revert.lua" />

and in data/talkactions/script

transform.lua
PHP:
local voce = {
    -- [preTransformVoce] = [postTransformVoce,Outfit,Level,HP,KI,MagicEffect]
    [1] = {2,21,50,1000,1200,4},
    [2] = {3,22,60,2000,2200,8},
    [3] = {4,23,80,3000,3200,21},
    [4] = {5,24,100,5000,5200,6}
}

function onSay(cid, words, param, channel)
    local playerVoce = voce[getPlayerVocation(cid)]
    if playerVoce and getPlayerLevel(cid) >= playerVoce[3] then
        doPlayerSetVocation(cid, playerVoce[1])

        local condition = createConditionObject(CONDITION_ATTRIBUTES)
        setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, playerVoce[4])
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANA, playerVoce[5])
        setConditionParam(condition, CONDITION_PARAM_SUBID, 45)
        doAddCondition(cid, condition)
        doSendMagicEffect(getThingPosition(cid), playerVoce[6])
        doCreatureChangeOutfit(cid, {lookType=playerVoce[2]})
        return true
    elseif playerVoce then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't transform. You need [" .. playerVoce[3] .. "] LvL")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't transform.")
    end
end

revert.lua
PHP:
local voce = {
    -- [preRevertVoce] = [postRevertVoce,Outfit,Level,HP,KI,MagicEffect]

    [2] = {1,20,0,0,0,8},
    [3] = {2,21,0,1000,1200,21},
    [4] = {3,23,0,2000,2200,6},
    [5] = {4,24,0,3000,3200,6}
}

function onSay(cid, words, param, channel)
    local playerVoce = voce[getPlayerVocation(cid)]
    if playerVoce and getPlayerLevel(cid) >= playerVoce[3] then
        doPlayerSetVocation(cid, playerVoce[1])

        local condition = createConditionObject(CONDITION_ATTRIBUTES)
        setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, playerVoce[4])
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANA, playerVoce[5])
        setConditionParam(condition, CONDITION_PARAM_SUBID, 45)
        doAddCondition(cid, condition)
        doSendMagicEffect(getThingPosition(cid), playerVoce[6])
        doCreatureChangeOutfit(cid, {lookType=playerVoce[2]})
        return true
    elseif playerVoce then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't revert.")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't revert.")
    end
end
 
Last edited:
try it and let me know is it working well

in talkactions.xml
Code:
<talkaction words="transform" script="transform.lua" />
<talkaction words="revert" script="revert.lua" />

and in data/talkactions/script

transform.lua
PHP:
local voce = {
    -- [preTransformVoce] = [postTransformVoce,Outfit,Level,HP,KI,MagicEffect]
    [1] = {2,21,50,1000,1200,4},
    [2] = {3,22,60,2000,2200,8},
    [3] = {4,23,80,3000,3200,21},
    [4] = {5,24,100,5000,5200,6}
}

function onSay(cid, words, param, channel)
    local playerVoce = voce[getPlayerVocation(cid)]
    if playerVoce and getPlayerLevel(cid) >= playerVoce[3] then
        doPlayerSetVocation(cid, playerVoce[1])

        local condition = createConditionObject(CONDITION_ATTRIBUTES)
        setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, playerVoce[4])
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANA, playerVoce[5])
        setConditionParam(condition, CONDITION_PARAM_SUBID, 45)
        doAddCondition(cid, condition)
        doSendMagicEffect(getThingPosition(cid), playerVoce[6])
        doCreatureChangeOutfit(cid, {lookType=playerVoce[2]})
        return true
    elseif playerVoce then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't transform. You need [" .. playerVoce[3] .. "] LvL")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't transform.")
    end
end

revert.lua
PHP:
local voce = {
    -- [preRevertVoce] = [postRevertVoce,Outfit,Level,HP,KI,MagicEffect]

    [2] = {1,20,0,0,0,8},
    [3] = {2,21,0,1000,1200,21},
    [4] = {3,23,0,2000,2200,6},
    [5] = {4,24,0,3000,3200,6}
}

function onSay(cid, words, param, channel)
    local playerVoce = voce[getPlayerVocation(cid)]
    if playerVoce and getPlayerLevel(cid) >= playerVoce[3] then
        doPlayerSetVocation(cid, playerVoce[1])

        local condition = createConditionObject(CONDITION_ATTRIBUTES)
        setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, playerVoce[4])
        setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANA, playerVoce[5])
        setConditionParam(condition, CONDITION_PARAM_SUBID, 45)
        doAddCondition(cid, condition)
        doSendMagicEffect(getThingPosition(cid), playerVoce[6])
        doCreatureChangeOutfit(cid, {lookType=playerVoce[2]})
        return true
    elseif playerVoce then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't revert.")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You can't revert.")
    end
end

Ye, it works but after relog it didn't back to first outfit
 
Back
Top