local function changeStats(cid, outfit, currVoc)
local newVoc = currVoc + 1
local vocInfo = getVocationInfo(newVoc)
doPlayerSetVocation(cid, newVoc)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + vocInfo.healthGain)
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + vocInfo.manaGain)
doCreatureChangeOutfit(cid, outfit)
end
local function checkEq(cid, pos)
for i = 1, 10 do
if getPlayerSlotItem(cid, i) then
doPlayerSendCancel(cid, 'You must take off all equipment before transforming.')
doSendMagicEffect(pos, CONST_ME_POFF)
return false
break
end
end
return true
end
local voc = {
--// Goku
[228] = {level = 30, outfit = 149},
[2] = {level = 50, outfit = 150},
[3] = {level = 100, outfit = 151},
[4] = {level = 150, outfit = 152},
[5] = {level = 200, outfit = 153},
[7] = {level = 50, outfit = 155},
[8] = {level = 100, outfit = 156},
[9] = {level = 150, outfit = 157}
}
function onSay(cid, words, param)
local pos = getCreaturePosition(cid)
local currVoc = getPlayerVocation(cid)
local tmp = voc[currVoc]
if not exhaustion.get(cid, 103) then
if checkEq(cid, pos) then
if tmp then
if getPlayerLevel(cid) >= tmp.level then
changeStats(cid, tmp.outfit, currVoc)
else
doPlayerSendCancel(cid, 'You need level '.. tmp.level ..' to transform.')
doSendMagicEffect(pos, CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, 'Sorry.')
doSendMagicEffect(pos, CONST_ME_POFF)
end
end
else
doPlayerSendCancel(cid, 'Slow down.')
end
exhaustion.set(cid, 103, 0)
return true
end
yes, all you have to do is add all the vocation ids, levels, and outfits to the new tableIs that for new transform system script ?
@Xeraphus
[Error - LuaScriptInterface::loadFile] data/talkactions/scripts/transformation.lua:331: 'end' expected (to close 'if' at line 326) near 'break'
[Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/transformation.lua)
data/talkactions/scripts/transformation.lua:331: 'end' expected (to close 'if' at line 326) near 'break'
Help please? @Xeraphus
local function checkEq(cid, pos)
for i = 1, 10 do
if getPlayerSlotItem(cid, i) then
doPlayerSendCancel(cid, 'You must take off all equipment before transforming.')
doSendMagicEffect(pos, CONST_ME_POFF)
return false
end
end
return true
end
that's the point.No error in console but, I cant transform now It says " You must take off all equipment before transforming"
Sorry Im new to coding.
function onSay(cid, words, param)
local pos = getCreaturePosition(cid)
local currVoc = getPlayerVocation(cid)
local tmp = voc[currVoc]
if not exhaustion.get(cid, 103) then
if checkEq(cid, pos) then
print(1)
if tmp then
print(2)
if getPlayerLevel(cid) >= tmp.level then
print('2-1')
changeStats(cid, tmp.outfit, currVoc)
else
print('2-2')
doPlayerSendCancel(cid, 'You need level '.. tmp.level ..' to transform.')
doSendMagicEffect(pos, CONST_ME_POFF)
end
else
print(3)
doPlayerSendCancel(cid, 'Sorry.')
doSendMagicEffect(pos, CONST_ME_POFF)
end
end
else
print(4)
doPlayerSendCancel(cid, 'Slow down.')
end
exhaustion.set(cid, 103, 0)
return true
end
upload the script to pastebin or somethingI guess I did something wrong or thats the result you wanted ?
[Error - TalkAction Interface]
data/talkactions/scripts/transformation.lua; onSay
Description: data/talkactions/scripts/transformation.lua:92: attempt to index global 'voc' (a nil value)
stack traceback:
data/talkactions/scripts/transformation.lua:92: in function <data/talkactions/scripts/transformation.lua:89>
you removed my table, my stats function and added in pointless locals at the topI probably did something stupid that made no sense that why wont work :/
https://ghostbin.com/paste/d3xys