[LF] Transform system tfs 0.4 / 8.6

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Best answers
6
Likes
27
#5
what do you mean by good? what do you need in transform script?
 

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Best answers
6
Likes
27
#7
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:
Joined
Aug 1, 2017
Messages
35
Best answers
0
Likes
0
#8
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
 

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Best answers
6
Likes
27
#9
Outfit and vocation so you must transform again
 
Top