Yo, thanks for response. I need transform/revert system with adding hp/mana per transform (Transform system [table included])what do you mean by good? what do you need in transform script?
<talkaction words="transform" script="transform.lua" />
<talkaction words="revert" script="revert.lua" />
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
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 outfittry it and let me know is it working well
in talkactions.xml
and in data/talkactions/scriptCode:<talkaction words="transform" script="transform.lua" /> <talkaction words="revert" script="revert.lua" />
transform.lua
revert.luaPHP: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
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