[LF] Transform system tfs 0.4 / 8.6

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Reaction score
27
what do you mean by good? what do you need in transform script?
 
OP
Untitleed

Untitleed

Member
Joined
Aug 1, 2017
Messages
36
Reaction score
0
what do you mean by good? what do you need in transform script?
Yo, thanks for response. I need transform/revert system with adding hp/mana per transform (Transform system [table included])
this system looks nice but i have problem with saving hp/mana after logout it can be stacked, so i wrote here maybe someone have good system or can help me
 

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Reaction score
27
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:
OP
Untitleed

Untitleed

Member
Joined
Aug 1, 2017
Messages
36
Reaction score
0
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
Reaction score
27
Outfit and vocation so you must transform again
 
Top