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

Transform - Logging out Issue

Koncu

New Member
Joined
May 25, 2010
Messages
28
Reaction score
0
Hi,

There's a little problem with the script I have been working on recently and I was wondering whether someone could actually help me with this as I would be really grateful.

So, the problem:

- When the character types in 'transform', they get X amount of HP/MANA, the outfit changes and there are some special effects, all of this require certain level. The problem is, when the character logs out with TRANSFORM ON and logs back in, the HP/MANA remains the same but it reverted to previous vocation which means it is a bug for infinite HP and MANA
- When the character logs back in with TRANSFORM ON, the character has the outfit from the last time but the vocation has changed so I'd like to have my outfit reverted as well if that's possible.

So, here comes the script:

Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108},
[15] = { 75, 16, 5, 108},
[16] = { 100, 17, 7, 108},
[17] = { 125, 18, 94, 108},
[18] = { 150, 19, 59, 108},
[19] = { 175, 20, 8, 108},
[20] = { 200, 21, 178, 108},
[21] = { 225, 22, 95, 110},
[22] = { 250, 23, 54, 110},
[23] = { 275, 24, 37, 110},
[25] = { 1, 26, 80, 87},
[26] = { 50, 27, 190, 87},
[27] = { 75, 28, 83, 87},
[28] = { 100, 29, 191, 87},
[29] = { 150, 30, 192, 87},
[30] = { 175, 31, 109, 87},
[31] = { 225, 32, 81, 87},
[32] = { 250, 33, 111, 87},
[34] = { 1, 35, 194, 5},
[35] = { 50, 36, 175, 5},
[36] = { 75, 37, 169, 5},
[37] = { 100, 38, 173, 5},
[38] = { 150, 39, 172, 5},
[39] = { 175, 40, 171, 5},
[40] = { 225, 41, 174, 5},
[41] = { 250, 42, 170, 5},
[50] = { 1, 51, 67, 205},
[51] = { 50, 52, 72, 205},
[52] = { 75, 53, 273, 205},
[53] = { 100, 54, 65, 205},
[54] = { 125, 55, 329, 205},
[55] = { 150, 56, 188, 205},
[56] = { 175, 57, 62, 205},
[57] = { 200, 58, 189, 205},
[58] = { 225, 59, 335, 205},
[59] = { 250, 60, 57, 205},
[70] = { 1, 71, 102, 124},
[71] = { 50, 72, 103, 124},
[72] = { 75, 73, 105, 124},
[73] = { 100, 74, 107, 124},
[74] = { 150, 75, 108, 124},
[75] = { 175, 76, 314, 124},
[76] = { 225, 77, 315, 124},
[77] = { 250, 78, 333, 124},
[90] = { 1, 91, 331, 209},
[91] = { 50, 92, 69, 209},
[92] = { 75, 93, 70, 209},
[93] = { 100, 94, 199, 209},
[94] = { 150, 95, 196, 209},
[95] = { 175, 96, 197, 209},
[96] = { 225, 97, 198, 209},
[97] = { 250, 98, 198, 209},
[97] = { 250, 98, 198, 209},
[110] = { 1, 111, 88, 187},
[111] = { 75, 112, 341, 187},
[112] = { 100, 113, 343, 187},
[113] = { 150, 114, 342, 187},
[114] = { 200, 115, 344, 187},
[115] = { 250, 116, 345, 187},
[130] = { 1, 131, 296, 124},
[131] = { 75, 132, 297, 124},
[132] = { 150, 133, 298, 124},
[133] = { 200, 134, 299, 124},
[134] = { 250, 135, 300, 124},
[150] = { 1, 151, 384, 126},
[151] = { 75, 152, 385, 126},
[152] = { 150, 153, 386, 126},
[153] = { 200, 154, 396, 126},
[170] = { 1, 171, 97, 108},
[171] = { 50, 172, 285, 108},
[172] = { 75, 173, 282, 108},
[173] = { 100, 174, 98, 108},
[174] = { 125, 175, 99, 109},
[175] = { 150, 176, 100, 109},
[176] = { 200, 177, 211, 109},
[190] = { 1, 191, 373, 4},
[191] = { 75, 192, 374, 4},
[192] = { 125, 193, 537, 4},
[193] = { 150, 194, 376, 4},
[194] = { 200, 195, 318, 4},
[195] = { 250, 196, 377, 4},
[200] = { 1, 201, 11, 10},
[201] = { 50, 202, 287, 10},
[202] = { 75, 203, 12, 10},
[203] = { 125, 204, 10, 10},
[204] = { 150, 205, 289, 10},
[205] = { 175, 206, 13, 10},
[206] = { 200, 207, 14, 10},
[207] = { 250, 208, 203, 10},
[209] = { 1, 210, 244, 10},
[210] = { 50, 211, 368, 10},
[211] = { 100, 212, 391, 10},
[212] = { 150, 213, 242, 10},
[213] = { 200, 214, 286, 10},
[214] = { 350, 215, 290, 10},
[216] = { 1, 217, 404, 175},
[217] = { 100, 218, 405, 175},
[223] = { 25, 224, 309, 10},
[224] = { 100, 225, 312, 10},
[225] = { 150, 226, 326, 10},
[226] = { 250, 227, 328, 10},
[227] = { 300, 228, 364, 10},
[300] = { 1, 301, 406, 10},
[301] = { 50, 302, 407, 10},
[302] = { 100, 303, 408, 10},
[303] = { 200, 304, 213, 10},
[305] = { 1, 306, 19, 10},
[306] = { 150, 307, 339, 10},
[307] = { 150, 308, 518, 10},
[308] = { 150, 309, 544, 10},
[400] = { 1, 401, 35, 10},
[401] = { 100, 402, 75, 10},
[402] = { 200, 403, 264, 10},
[403] = { 250, 404, 389, 10},
[500] = { 1, 501, 411, 90},
[501] = { 50, 502, 412, 90},
[502] = { 100, 503, 414, 90},
[503] = { 200, 504, 415, 90},
[504] = { 300, 505, 416, 90},
[520] = { 1, 521, 491, 13},
[521] = { 100, 522, 492, 13},
[522] = { 150, 523, 493, 13},
[523] = { 200, 524, 494, 13},
[524] = { 250, 525, 401, 13},
[525] = { 300, 526, 402, 13},
[526] = { 350, 527, 403, 13},
[527] = { 400, 528, 495, 13},
[530] = { 1, 531, 356, 13},
[531] = { 100, 532, 139, 13},
[532] = { 150, 533, 223, 13},
[533] = { 200, 534, 236, 13},
[534] = { 250, 534, 133, 13}, 
[536] = { 1, 537, 378, 13},
[537] = { 100, 538, 379, 13},
[538] = { 150, 539, 380, 13},
[539] = { 200, 540, 381, 13},
[540] = { 250, 541, 382, 13},
[541] = { 300, 541, 322, 13},
[620] = { 1, 621, 429, 10},
[621] = { 100, 622, 430, 10},
[622] = { 150, 623, 431, 10},
[623] = { 200, 624, 432, 10},
[624] = { 225, 625, 433, 10},
[625] = { 250, 626, 434, 10},
[626] = { 300, 627, 435, 10},
[627] = { 400, 628, 436, 10},
[631] = { 50, 632, 525, 10},
[632] = { 100, 633, 524, 10},
[633] = { 150, 634, 523, 10},
[637] = { 50, 638, 536, 10},
[638] = { 150, 639, 535, 10},
[639] = { 250, 640, 530, 10},
[640] = { 300, 641, 546, 10},
[645] = { 50, 646, 510, 10},
[646] = { 150, 647, 511, 10},
[647] = { 250, 648, 512, 10},
[648] = { 300, 648, 513, 10},
}
function onSay(cid, words, param, channel)

if exhaustion.get(cid, 103) then
doPlayerSendCancel(cid, 'Slow down.')
return true
end
exhaustion.set(cid, 103, 0)

doPlayerSay(cid, "transform")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
doPlayerSetVocation(cid, voc[2])
local outfit = {lookType = voc[3]}
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
doCreatureAddHealth(cid, 1)

else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You need " .. voc[1] .. " level to transform.")
end
else
doPlayerSendCancel(cid, "You cannot transform.")
end
return true
end
 
Becouse doCreatureChangeOutfit is stored like every unique condition and TFS and many servers aren't storing such information in database.
You have to make another one script in your login.lua which checks is player under transformation's effects or not. Helpful will be storageId.

You have to add doCreatureSetStorageId to your main script.
Set storage 1 if player is transformed, and -1 if not.
Now in your login.lua add the part from your main script.

If you did that script alone, you will solve this problem with my informations very easly.
 
Becouse doCreatureChangeOutfit is stored like every unique condition and TFS and many servers aren't storing such information in database.
You have to make another one script in your login.lua which checks is player under transformation's effects or not. Helpful will be storageId.

You have to add doCreatureSetStorageId to your main script.
Set storage 1 if player is transformed, and -1 if not.
Now in your login.lua add the part from your main script.

If you did that script alone, you will solve this problem with my informations very easly.

It's not my script, I have just edited few bits that were easy to made.

The scripts itself, as I read does not say anything on the status whether it's ON or OFF, it's just a trigger I'm guessing

I have added these bits to login.lua but now I'm stuck:

Code:
    if(storageId(cid,-1)) then
    doCreatureChangeOutfit

and only this to transform.lua

Code:
doCreatureSetStorageId(cid,1)
 
After:
Code:
doPlayerSetVocation(cid, voc[2])
Add:
Code:
doPlayerSetStorageId(cid, 12345, voc[2])


In login.lua add:
Code:
registerCreatureEvent(cid, "TransformEvent")

In creatureScripts.xml add:
Code:
<event type="login" name="TransformEvent" event="script" value="TransformEvent.lua"/>

Make new file data/creaturescripts/scripts/TransformEvent.lua:
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108},
[15] = { 75, 16, 5, 108},
[16] = { 100, 17, 7, 108},
[17] = { 125, 18, 94, 108},
[18] = { 150, 19, 59, 108},
[19] = { 175, 20, 8, 108},
[20] = { 200, 21, 178, 108},
[21] = { 225, 22, 95, 110},
[22] = { 250, 23, 54, 110},
[23] = { 275, 24, 37, 110},
[25] = { 1, 26, 80, 87},
[26] = { 50, 27, 190, 87},
[27] = { 75, 28, 83, 87},
[28] = { 100, 29, 191, 87},
[29] = { 150, 30, 192, 87},
[30] = { 175, 31, 109, 87},
[31] = { 225, 32, 81, 87},
[32] = { 250, 33, 111, 87},
[34] = { 1, 35, 194, 5},
[35] = { 50, 36, 175, 5},
[36] = { 75, 37, 169, 5},
[37] = { 100, 38, 173, 5},
[38] = { 150, 39, 172, 5},
[39] = { 175, 40, 171, 5},
[40] = { 225, 41, 174, 5},
[41] = { 250, 42, 170, 5},
[50] = { 1, 51, 67, 205},
[51] = { 50, 52, 72, 205},
[52] = { 75, 53, 273, 205},
[53] = { 100, 54, 65, 205},
[54] = { 125, 55, 329, 205},
[55] = { 150, 56, 188, 205},
[56] = { 175, 57, 62, 205},
[57] = { 200, 58, 189, 205},
[58] = { 225, 59, 335, 205},
[59] = { 250, 60, 57, 205},
[70] = { 1, 71, 102, 124},
[71] = { 50, 72, 103, 124},
[72] = { 75, 73, 105, 124},
[73] = { 100, 74, 107, 124},
[74] = { 150, 75, 108, 124},
[75] = { 175, 76, 314, 124},
[76] = { 225, 77, 315, 124},
[77] = { 250, 78, 333, 124},
[90] = { 1, 91, 331, 209},
[91] = { 50, 92, 69, 209},
[92] = { 75, 93, 70, 209},
[93] = { 100, 94, 199, 209},
[94] = { 150, 95, 196, 209},
[95] = { 175, 96, 197, 209},
[96] = { 225, 97, 198, 209},
[97] = { 250, 98, 198, 209},
[97] = { 250, 98, 198, 209},
[110] = { 1, 111, 88, 187},
[111] = { 75, 112, 341, 187},
[112] = { 100, 113, 343, 187},
[113] = { 150, 114, 342, 187},
[114] = { 200, 115, 344, 187},
[115] = { 250, 116, 345, 187},
[130] = { 1, 131, 296, 124},
[131] = { 75, 132, 297, 124},
[132] = { 150, 133, 298, 124},
[133] = { 200, 134, 299, 124},
[134] = { 250, 135, 300, 124},
[150] = { 1, 151, 384, 126},
[151] = { 75, 152, 385, 126},
[152] = { 150, 153, 386, 126},
[153] = { 200, 154, 396, 126},
[170] = { 1, 171, 97, 108},
[171] = { 50, 172, 285, 108},
[172] = { 75, 173, 282, 108},
[173] = { 100, 174, 98, 108},
[174] = { 125, 175, 99, 109},
[175] = { 150, 176, 100, 109},
[176] = { 200, 177, 211, 109},
[190] = { 1, 191, 373, 4},
[191] = { 75, 192, 374, 4},
[192] = { 125, 193, 537, 4},
[193] = { 150, 194, 376, 4},
[194] = { 200, 195, 318, 4},
[195] = { 250, 196, 377, 4},
[200] = { 1, 201, 11, 10},
[201] = { 50, 202, 287, 10},
[202] = { 75, 203, 12, 10},
[203] = { 125, 204, 10, 10},
[204] = { 150, 205, 289, 10},
[205] = { 175, 206, 13, 10},
[206] = { 200, 207, 14, 10},
[207] = { 250, 208, 203, 10},
[209] = { 1, 210, 244, 10},
[210] = { 50, 211, 368, 10},
[211] = { 100, 212, 391, 10},
[212] = { 150, 213, 242, 10},
[213] = { 200, 214, 286, 10},
[214] = { 350, 215, 290, 10},
[216] = { 1, 217, 404, 175},
[217] = { 100, 218, 405, 175},
[223] = { 25, 224, 309, 10},
[224] = { 100, 225, 312, 10},
[225] = { 150, 226, 326, 10},
[226] = { 250, 227, 328, 10},
[227] = { 300, 228, 364, 10},
[300] = { 1, 301, 406, 10},
[301] = { 50, 302, 407, 10},
[302] = { 100, 303, 408, 10},
[303] = { 200, 304, 213, 10},
[305] = { 1, 306, 19, 10},
[306] = { 150, 307, 339, 10},
[307] = { 150, 308, 518, 10},
[308] = { 150, 309, 544, 10},
[400] = { 1, 401, 35, 10},
[401] = { 100, 402, 75, 10},
[402] = { 200, 403, 264, 10},
[403] = { 250, 404, 389, 10},
[500] = { 1, 501, 411, 90},
[501] = { 50, 502, 412, 90},
[502] = { 100, 503, 414, 90},
[503] = { 200, 504, 415, 90},
[504] = { 300, 505, 416, 90},
[520] = { 1, 521, 491, 13},
[521] = { 100, 522, 492, 13},
[522] = { 150, 523, 493, 13},
[523] = { 200, 524, 494, 13},
[524] = { 250, 525, 401, 13},
[525] = { 300, 526, 402, 13},
[526] = { 350, 527, 403, 13},
[527] = { 400, 528, 495, 13},
[530] = { 1, 531, 356, 13},
[531] = { 100, 532, 139, 13},
[532] = { 150, 533, 223, 13},
[533] = { 200, 534, 236, 13},
[534] = { 250, 534, 133, 13},
[536] = { 1, 537, 378, 13},
[537] = { 100, 538, 379, 13},
[538] = { 150, 539, 380, 13},
[539] = { 200, 540, 381, 13},
[540] = { 250, 541, 382, 13},
[541] = { 300, 541, 322, 13},
[620] = { 1, 621, 429, 10},
[621] = { 100, 622, 430, 10},
[622] = { 150, 623, 431, 10},
[623] = { 200, 624, 432, 10},
[624] = { 225, 625, 433, 10},
[625] = { 250, 626, 434, 10},
[626] = { 300, 627, 435, 10},
[627] = { 400, 628, 436, 10},
[631] = { 50, 632, 525, 10},
[632] = { 100, 633, 524, 10},
[633] = { 150, 634, 523, 10},
[637] = { 50, 638, 536, 10},
[638] = { 150, 639, 535, 10},
[639] = { 250, 640, 530, 10},
[640] = { 300, 641, 546, 10},
[645] = { 50, 646, 510, 10},
[646] = { 150, 647, 511, 10},
[647] = { 250, 648, 512, 10},
[648] = { 300, 648, 513, 10},
}
 
function onLogin(cid)
    local voc = config[getPlayerVocation(cid)] - 1

    if getPlayerStorageValue(cid, voc) ~= nil then
        local outfit = {lookType = voc[3]}
        doCreatureChangeOutfit(cid, outfit)
        doSendMagicEffect(getCreaturePosition(cid), voc[4])
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
        setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
        doCreatureAddHealth(cid, 1)
    end
    return true
end
 
I don't know exactly your needs, but for me your script is a trash. It may cause many bugs.
 
After:
Code:
doPlayerSetVocation(cid, voc[2])
Add:
Code:
doPlayerSetStorageId(cid, 12345, voc[2])


In login.lua add:
Code:
registerCreatureEvent(cid, "TransformEvent")

In creatureScripts.xml add:
Code:
<event type="login" name="TransformEvent" event="script" value="TransformEvent.lua"/>

Make new file data/creaturescripts/scripts/TransformEvent.lua:
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108},
[15] = { 75, 16, 5, 108},
[16] = { 100, 17, 7, 108},
[17] = { 125, 18, 94, 108},
[18] = { 150, 19, 59, 108},
[19] = { 175, 20, 8, 108},
[20] = { 200, 21, 178, 108},
[21] = { 225, 22, 95, 110},
[22] = { 250, 23, 54, 110},
[23] = { 275, 24, 37, 110},
[25] = { 1, 26, 80, 87},
[26] = { 50, 27, 190, 87},
[27] = { 75, 28, 83, 87},
[28] = { 100, 29, 191, 87},
[29] = { 150, 30, 192, 87},
[30] = { 175, 31, 109, 87},
[31] = { 225, 32, 81, 87},
[32] = { 250, 33, 111, 87},
[34] = { 1, 35, 194, 5},
[35] = { 50, 36, 175, 5},
[36] = { 75, 37, 169, 5},
[37] = { 100, 38, 173, 5},
[38] = { 150, 39, 172, 5},
[39] = { 175, 40, 171, 5},
[40] = { 225, 41, 174, 5},
[41] = { 250, 42, 170, 5},
[50] = { 1, 51, 67, 205},
[51] = { 50, 52, 72, 205},
[52] = { 75, 53, 273, 205},
[53] = { 100, 54, 65, 205},
[54] = { 125, 55, 329, 205},
[55] = { 150, 56, 188, 205},
[56] = { 175, 57, 62, 205},
[57] = { 200, 58, 189, 205},
[58] = { 225, 59, 335, 205},
[59] = { 250, 60, 57, 205},
[70] = { 1, 71, 102, 124},
[71] = { 50, 72, 103, 124},
[72] = { 75, 73, 105, 124},
[73] = { 100, 74, 107, 124},
[74] = { 150, 75, 108, 124},
[75] = { 175, 76, 314, 124},
[76] = { 225, 77, 315, 124},
[77] = { 250, 78, 333, 124},
[90] = { 1, 91, 331, 209},
[91] = { 50, 92, 69, 209},
[92] = { 75, 93, 70, 209},
[93] = { 100, 94, 199, 209},
[94] = { 150, 95, 196, 209},
[95] = { 175, 96, 197, 209},
[96] = { 225, 97, 198, 209},
[97] = { 250, 98, 198, 209},
[97] = { 250, 98, 198, 209},
[110] = { 1, 111, 88, 187},
[111] = { 75, 112, 341, 187},
[112] = { 100, 113, 343, 187},
[113] = { 150, 114, 342, 187},
[114] = { 200, 115, 344, 187},
[115] = { 250, 116, 345, 187},
[130] = { 1, 131, 296, 124},
[131] = { 75, 132, 297, 124},
[132] = { 150, 133, 298, 124},
[133] = { 200, 134, 299, 124},
[134] = { 250, 135, 300, 124},
[150] = { 1, 151, 384, 126},
[151] = { 75, 152, 385, 126},
[152] = { 150, 153, 386, 126},
[153] = { 200, 154, 396, 126},
[170] = { 1, 171, 97, 108},
[171] = { 50, 172, 285, 108},
[172] = { 75, 173, 282, 108},
[173] = { 100, 174, 98, 108},
[174] = { 125, 175, 99, 109},
[175] = { 150, 176, 100, 109},
[176] = { 200, 177, 211, 109},
[190] = { 1, 191, 373, 4},
[191] = { 75, 192, 374, 4},
[192] = { 125, 193, 537, 4},
[193] = { 150, 194, 376, 4},
[194] = { 200, 195, 318, 4},
[195] = { 250, 196, 377, 4},
[200] = { 1, 201, 11, 10},
[201] = { 50, 202, 287, 10},
[202] = { 75, 203, 12, 10},
[203] = { 125, 204, 10, 10},
[204] = { 150, 205, 289, 10},
[205] = { 175, 206, 13, 10},
[206] = { 200, 207, 14, 10},
[207] = { 250, 208, 203, 10},
[209] = { 1, 210, 244, 10},
[210] = { 50, 211, 368, 10},
[211] = { 100, 212, 391, 10},
[212] = { 150, 213, 242, 10},
[213] = { 200, 214, 286, 10},
[214] = { 350, 215, 290, 10},
[216] = { 1, 217, 404, 175},
[217] = { 100, 218, 405, 175},
[223] = { 25, 224, 309, 10},
[224] = { 100, 225, 312, 10},
[225] = { 150, 226, 326, 10},
[226] = { 250, 227, 328, 10},
[227] = { 300, 228, 364, 10},
[300] = { 1, 301, 406, 10},
[301] = { 50, 302, 407, 10},
[302] = { 100, 303, 408, 10},
[303] = { 200, 304, 213, 10},
[305] = { 1, 306, 19, 10},
[306] = { 150, 307, 339, 10},
[307] = { 150, 308, 518, 10},
[308] = { 150, 309, 544, 10},
[400] = { 1, 401, 35, 10},
[401] = { 100, 402, 75, 10},
[402] = { 200, 403, 264, 10},
[403] = { 250, 404, 389, 10},
[500] = { 1, 501, 411, 90},
[501] = { 50, 502, 412, 90},
[502] = { 100, 503, 414, 90},
[503] = { 200, 504, 415, 90},
[504] = { 300, 505, 416, 90},
[520] = { 1, 521, 491, 13},
[521] = { 100, 522, 492, 13},
[522] = { 150, 523, 493, 13},
[523] = { 200, 524, 494, 13},
[524] = { 250, 525, 401, 13},
[525] = { 300, 526, 402, 13},
[526] = { 350, 527, 403, 13},
[527] = { 400, 528, 495, 13},
[530] = { 1, 531, 356, 13},
[531] = { 100, 532, 139, 13},
[532] = { 150, 533, 223, 13},
[533] = { 200, 534, 236, 13},
[534] = { 250, 534, 133, 13},
[536] = { 1, 537, 378, 13},
[537] = { 100, 538, 379, 13},
[538] = { 150, 539, 380, 13},
[539] = { 200, 540, 381, 13},
[540] = { 250, 541, 382, 13},
[541] = { 300, 541, 322, 13},
[620] = { 1, 621, 429, 10},
[621] = { 100, 622, 430, 10},
[622] = { 150, 623, 431, 10},
[623] = { 200, 624, 432, 10},
[624] = { 225, 625, 433, 10},
[625] = { 250, 626, 434, 10},
[626] = { 300, 627, 435, 10},
[627] = { 400, 628, 436, 10},
[631] = { 50, 632, 525, 10},
[632] = { 100, 633, 524, 10},
[633] = { 150, 634, 523, 10},
[637] = { 50, 638, 536, 10},
[638] = { 150, 639, 535, 10},
[639] = { 250, 640, 530, 10},
[640] = { 300, 641, 546, 10},
[645] = { 50, 646, 510, 10},
[646] = { 150, 647, 511, 10},
[647] = { 250, 648, 512, 10},
[648] = { 300, 648, 513, 10},
}
 
function onLogin(cid)
    local voc = config[getPlayerVocation(cid)] - 1

    if getPlayerStorageValue(cid, voc) ~= nil then
        local outfit = {lookType = voc[3]}
        doCreatureChangeOutfit(cid, outfit)
        doSendMagicEffect(getCreaturePosition(cid), voc[4])
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
        setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
        doCreatureAddHealth(cid, 1)
    end
    return true
end

All done, but there's some sort of an error which I don't get because the code seems clear to me:

Just after trying to log in, it stucks in client "Connecting to the game world. Please Wait."

Code:
[09/10/2016 21:26:07] [Error - CreatureScript Interface]
[09/10/2016 21:26:07] data/creaturescripts/scripts/TransformEvent.lua:onLogin
[09/10/2016 21:26:07] Description:
[09/10/2016 21:26:07] data/creaturescripts/scripts/TransformEvent.lua:176: attempt to perform arithmetic on field '?' (a table value)
[09/10/2016 21:26:07] stack traceback:
[09/10/2016 21:26:07]     data/creaturescripts/scripts/TransformEvent.lua:176: in function <data/creaturescripts/scripts/TransformEvent.lua:175>
 
All done, but there's some sort of an error which I don't get because the code seems clear to me:

Just after trying to log in, it stucks in client "Connecting to the game world. Please Wait."

Code:
[09/10/2016 21:26:07] [Error - CreatureScript Interface]
[09/10/2016 21:26:07] data/creaturescripts/scripts/TransformEvent.lua:onLogin
[09/10/2016 21:26:07] Description:
[09/10/2016 21:26:07] data/creaturescripts/scripts/TransformEvent.lua:176: attempt to perform arithmetic on field '?' (a table value)
[09/10/2016 21:26:07] stack traceback:
[09/10/2016 21:26:07]     data/creaturescripts/scripts/TransformEvent.lua:176: in function <data/creaturescripts/scripts/TransformEvent.lua:175>
your script needs to be rewritten
some table values have index 5 and some that do not (getCreatureMaxHealth(cid)+voc[5])) <- voc[5]
if it does not have index 5 it will throw an error, which you are getting because the vocation table it's returning doesn't have the value for the index it's trying to get and add
 
your script needs to be rewritten
some table values have index 5 and some that do not (getCreatureMaxHealth(cid)+voc[5])) <- voc[5]
if it does not have index 5 it will throw an error, which you are getting because the vocation table it's returning doesn't have the value for the index it's trying to get and add

I was planning to add this later but if you say so, I will try to edit that right now

edit:
unfortunately, it did not help.

something must be wrong with TransformEvent.lua

with this code I think but it's all good, if you ask me
Code:
function onLogin(cid)
    local voc = config[getPlayerVocation(cid)] - 1
    getPlayerStorageValue(cid, voc)
 
Refresh page, I just copied it wrong and edited after few seconds.

The same error with new code. Just so you know, I removed my edits from post 3, not sure if that was necessary

Code:
[09/10/2016 21:51:09] [Error - CreatureScript Interface]
[09/10/2016 21:51:09] data/creaturescripts/scripts/TransformEvent.lua:onLogin
[09/10/2016 21:51:09] Description:
[09/10/2016 21:51:09] data/creaturescripts/scripts/TransformEvent.lua:176: attempt to perform arithmetic on field '?' (a table value)
[09/10/2016 21:51:09] stack traceback:
[09/10/2016 21:51:09]     data/creaturescripts/scripts/TransformEvent.lua:176: in function <data/creaturescripts/scripts/TransformEvent.lua:175>

latest

transform.lua
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108, 400, 400},
[15] = { 75, 16, 5, 108, 400, 400},
[16] = { 100, 17, 7, 108, 400, 400},
[17] = { 125, 18, 94, 108, 400, 400},
[18] = { 150, 19, 59, 108, 400, 400},
[19] = { 175, 20, 8, 108, 400, 400},
[20] = { 200, 21, 178, 108, 400, 400},
[21] = { 225, 22, 95, 110, 400, 400},
[22] = { 250, 23, 54, 110, 400, 400},
[23] = { 275, 24, 37, 110, 400, 400},
[25] = { 1, 26, 80, 87, 400, 400},
[26] = { 50, 27, 190, 87, 400, 400},
[27] = { 75, 28, 83, 87, 400, 400},
[28] = { 100, 29, 191, 87, 400, 400},
[29] = { 150, 30, 192, 87, 400, 400},
[30] = { 175, 31, 109, 87, 400, 400},
[31] = { 225, 32, 81, 87, 400, 400},
[32] = { 250, 33, 111, 87, 400, 400},
[34] = { 1, 35, 194, 5, 400, 400},
[35] = { 50, 36, 175, 5, 400, 400},
[36] = { 75, 37, 169, 5, 400, 400},
[37] = { 100, 38, 173, 5, 400, 400},
[38] = { 150, 39, 172, 5, 400, 400},
[39] = { 175, 40, 171, 5, 400, 400},
[40] = { 225, 41, 174, 5, 400, 400},
[41] = { 250, 42, 170, 5, 400, 400},
[50] = { 1, 51, 67, 205, 400, 400},
[51] = { 50, 52, 72, 205, 400, 400},
[52] = { 75, 53, 273, 205, 400, 400},
[53] = { 100, 54, 65, 205, 400, 400},
[54] = { 125, 55, 329, 205, 400, 400},
[55] = { 150, 56, 188, 205, 400, 400},
[56] = { 175, 57, 62, 205, 400, 400},
[57] = { 200, 58, 189, 205, 400, 400},
[58] = { 225, 59, 335, 205, 400, 400},
[59] = { 250, 60, 57, 205, 400, 400},
[70] = { 1, 71, 102, 124, 400, 400},
[71] = { 50, 72, 103, 124, 400, 400},
[72] = { 75, 73, 105, 124, 400, 400},
[73] = { 100, 74, 107, 124, 400, 400},
[74] = { 150, 75, 108, 124, 400, 400},
[75] = { 175, 76, 314, 124, 400, 400},
[76] = { 225, 77, 315, 124, 400, 400},
[77] = { 250, 78, 333, 124, 400, 400},
[90] = { 1, 91, 331, 209, 400, 400},
[91] = { 50, 92, 69, 209, 400, 400},
[92] = { 75, 93, 70, 209, 400, 400},
[93] = { 100, 94, 199, 209, 400, 400},
[94] = { 150, 95, 196, 209, 400, 400},
[95] = { 175, 96, 197, 209, 400, 400},
[96] = { 225, 97, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[110] = { 1, 111, 88, 187, 400, 400},
[111] = { 75, 112, 341, 187, 400, 400},
[112] = { 100, 113, 343, 187, 400, 400},
[113] = { 150, 114, 342, 187, 400, 400},
[114] = { 200, 115, 344, 187, 400, 400},
[115] = { 250, 116, 345, 187, 400, 400},
[130] = { 1, 131, 296, 124, 400, 400},
[131] = { 75, 132, 297, 124, 400, 400},
[132] = { 150, 133, 298, 124, 400, 400},
[133] = { 200, 134, 299, 124, 400, 400},
[134] = { 250, 135, 300, 124, 400, 400},
[150] = { 1, 151, 384, 126, 400, 400},
[151] = { 75, 152, 385, 126, 400, 400},
[152] = { 150, 153, 386, 126, 400, 400},
[153] = { 200, 154, 396, 126, 400, 400},
[170] = { 1, 171, 97, 108, 400, 400},
[171] = { 50, 172, 285, 108, 400, 400},
[172] = { 75, 173, 282, 108, 400, 400},
[173] = { 100, 174, 98, 108, 400, 400},
[174] = { 125, 175, 99, 109, 400, 400},
[175] = { 150, 176, 100, 109, 400, 400},
[176] = { 200, 177, 211, 109, 400, 400},
[190] = { 1, 191, 373, 4, 400, 400},
[191] = { 75, 192, 374, 4, 400, 400},
[192] = { 125, 193, 537, 4, 400, 400},
[193] = { 150, 194, 376, 4, 400, 400},
[194] = { 200, 195, 318, 4, 400, 400},
[195] = { 250, 196, 377, 4, 400, 400},
[200] = { 1, 201, 11, 10, 400, 400},
[201] = { 50, 202, 287, 10, 400, 400},
[202] = { 75, 203, 12, 10, 400, 400},
[203] = { 125, 204, 10, 10, 400, 400},
[204] = { 150, 205, 289, 10, 400, 400},
[205] = { 175, 206, 13, 10, 400, 400},
[206] = { 200, 207, 14, 10, 400, 400},
[207] = { 250, 208, 203, 10, 400, 400},
[209] = { 1, 210, 244, 10, 400, 400},
[210] = { 50, 211, 368, 10, 400, 400},
[211] = { 100, 212, 391, 10, 400, 400},
[212] = { 150, 213, 242, 10, 400, 400},
[213] = { 200, 214, 286, 10, 400, 400},
[214] = { 350, 215, 290, 10, 400, 400},
[216] = { 1, 217, 404, 175, 400, 400},
[217] = { 100, 218, 405, 175, 400, 400},
[223] = { 25, 224, 309, 10, 400, 400},
[224] = { 100, 225, 312, 10, 400, 400},
[225] = { 150, 226, 326, 10, 400, 400},
[226] = { 250, 227, 328, 10, 400, 400},
[227] = { 300, 228, 364, 10, 400, 400},
[300] = { 1, 301, 406, 10, 400, 400},
[301] = { 50, 302, 407, 10, 400, 400},
[302] = { 100, 303, 408, 10, 400, 400},
[303] = { 200, 304, 213, 10, 400, 400},
[305] = { 1, 306, 19, 10, 400, 400},
[306] = { 150, 307, 339, 10, 400, 400},
[307] = { 150, 308, 518, 10, 400, 400},
[308] = { 150, 309, 544, 10, 400, 400},
[400] = { 1, 401, 35, 10, 400, 400},
[401] = { 100, 402, 75, 10, 400, 400},
[402] = { 200, 403, 264, 10, 400, 400},
[403] = { 250, 404, 389, 10, 400, 400},
[500] = { 1, 501, 411, 90, 400, 400},
[501] = { 50, 502, 412, 90, 400, 400},
[502] = { 100, 503, 414, 90, 400, 400},
[503] = { 200, 504, 415, 90, 400, 400},
[504] = { 300, 505, 416, 90, 400, 400},
[520] = { 1, 521, 491, 13, 400, 400},
[521] = { 100, 522, 492, 13, 400, 400},
[522] = { 150, 523, 493, 13, 400, 400},
[523] = { 200, 524, 494, 13, 400, 400},
[524] = { 250, 525, 401, 13, 400, 400},
[525] = { 300, 526, 402, 13, 400, 400},
[526] = { 350, 527, 403, 13, 400, 400},
[527] = { 400, 528, 495, 13, 400, 400},
[530] = { 1, 531, 356, 13, 400, 400},
[531] = { 100, 532, 139, 13, 400, 400},
[532] = { 150, 533, 223, 13, 400, 400},
[533] = { 200, 534, 236, 13, 400, 400},
[534] = { 250, 534, 133, 13, 400, 400}, 
[536] = { 1, 537, 378, 13, 400, 400},
[537] = { 100, 538, 379, 13, 400, 400},
[538] = { 150, 539, 380, 13, 400, 400},
[539] = { 200, 540, 381, 13, 400, 400},
[540] = { 250, 541, 382, 13, 400, 400},
[541] = { 300, 541, 322, 13, 400, 400},
[620] = { 1, 621, 429, 10, 400, 400},
[621] = { 100, 622, 430, 10, 400, 400},
[622] = { 150, 623, 431, 10, 400, 400},
[623] = { 200, 624, 432, 10, 400, 400},
[624] = { 225, 625, 433, 10, 400, 400},
[625] = { 250, 626, 434, 10, 400, 400},
[626] = { 300, 627, 435, 10, 400, 400},
[627] = { 400, 628, 436, 10, 400, 400},
[631] = { 50, 632, 525, 10, 400, 400},
[632] = { 100, 633, 524, 10, 400, 400},
[633] = { 150, 634, 523, 10, 400, 400},
[637] = { 50, 638, 536, 10, 400, 400},
[638] = { 150, 639, 535, 10, 400, 400},
[639] = { 250, 640, 530, 10, 400, 400},
[640] = { 300, 641, 546, 10, 400, 400},
[645] = { 50, 646, 510, 10, 400, 400},
[646] = { 150, 647, 511, 10, 400, 400},
[647] = { 250, 648, 512, 10, 400, 400},
[648] = { 300, 648, 513, 10, 400, 400},
}
function onSay(cid, words, param, channel)

if exhaustion.get(cid, 103) then
doPlayerSendCancel(cid, 'Slow down.')
return true
end
exhaustion.set(cid, 103, 0)

doPlayerSay(cid, "transform")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
doPlayerSetVocation(cid, voc[2])
doPlayerSetStorageId(cid, 12345, voc[2])
local outfit = {lookType = voc[3]}
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
doCreatureAddHealth(cid, 1)


else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You need " .. voc[1] .. " level to transform.")
end
else
doPlayerSendCancel(cid, "You cannot transform.")
end
return true
end



TransformEvent.lua
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108, 400, 400},
[15] = { 75, 16, 5, 108, 400, 400},
[16] = { 100, 17, 7, 108, 400, 400},
[17] = { 125, 18, 94, 108, 400, 400},
[18] = { 150, 19, 59, 108, 400, 400},
[19] = { 175, 20, 8, 108, 400, 400},
[20] = { 200, 21, 178, 108, 400, 400},
[21] = { 225, 22, 95, 110, 400, 400},
[22] = { 250, 23, 54, 110, 400, 400},
[23] = { 275, 24, 37, 110, 400, 400},
[25] = { 1, 26, 80, 87, 400, 400},
[26] = { 50, 27, 190, 87, 400, 400},
[27] = { 75, 28, 83, 87, 400, 400},
[28] = { 100, 29, 191, 87, 400, 400},
[29] = { 150, 30, 192, 87, 400, 400},
[30] = { 175, 31, 109, 87, 400, 400},
[31] = { 225, 32, 81, 87, 400, 400},
[32] = { 250, 33, 111, 87, 400, 400},
[34] = { 1, 35, 194, 5, 400, 400},
[35] = { 50, 36, 175, 5, 400, 400},
[36] = { 75, 37, 169, 5, 400, 400},
[37] = { 100, 38, 173, 5, 400, 400},
[38] = { 150, 39, 172, 5, 400, 400},
[39] = { 175, 40, 171, 5, 400, 400},
[40] = { 225, 41, 174, 5, 400, 400},
[41] = { 250, 42, 170, 5, 400, 400},
[50] = { 1, 51, 67, 205, 400, 400},
[51] = { 50, 52, 72, 205, 400, 400},
[52] = { 75, 53, 273, 205, 400, 400},
[53] = { 100, 54, 65, 205, 400, 400},
[54] = { 125, 55, 329, 205, 400, 400},
[55] = { 150, 56, 188, 205, 400, 400},
[56] = { 175, 57, 62, 205, 400, 400},
[57] = { 200, 58, 189, 205, 400, 400},
[58] = { 225, 59, 335, 205, 400, 400},
[59] = { 250, 60, 57, 205, 400, 400},
[70] = { 1, 71, 102, 124, 400, 400},
[71] = { 50, 72, 103, 124, 400, 400},
[72] = { 75, 73, 105, 124, 400, 400},
[73] = { 100, 74, 107, 124, 400, 400},
[74] = { 150, 75, 108, 124, 400, 400},
[75] = { 175, 76, 314, 124, 400, 400},
[76] = { 225, 77, 315, 124, 400, 400},
[77] = { 250, 78, 333, 124, 400, 400},
[90] = { 1, 91, 331, 209, 400, 400},
[91] = { 50, 92, 69, 209, 400, 400},
[92] = { 75, 93, 70, 209, 400, 400},
[93] = { 100, 94, 199, 209, 400, 400},
[94] = { 150, 95, 196, 209, 400, 400},
[95] = { 175, 96, 197, 209, 400, 400},
[96] = { 225, 97, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[110] = { 1, 111, 88, 187, 400, 400},
[111] = { 75, 112, 341, 187, 400, 400},
[112] = { 100, 113, 343, 187, 400, 400},
[113] = { 150, 114, 342, 187, 400, 400},
[114] = { 200, 115, 344, 187, 400, 400},
[115] = { 250, 116, 345, 187, 400, 400},
[130] = { 1, 131, 296, 124, 400, 400},
[131] = { 75, 132, 297, 124, 400, 400},
[132] = { 150, 133, 298, 124, 400, 400},
[133] = { 200, 134, 299, 124, 400, 400},
[134] = { 250, 135, 300, 124, 400, 400},
[150] = { 1, 151, 384, 126, 400, 400},
[151] = { 75, 152, 385, 126, 400, 400},
[152] = { 150, 153, 386, 126, 400, 400},
[153] = { 200, 154, 396, 126, 400, 400},
[170] = { 1, 171, 97, 108, 400, 400},
[171] = { 50, 172, 285, 108, 400, 400},
[172] = { 75, 173, 282, 108, 400, 400},
[173] = { 100, 174, 98, 108, 400, 400},
[174] = { 125, 175, 99, 109, 400, 400},
[175] = { 150, 176, 100, 109, 400, 400},
[176] = { 200, 177, 211, 109, 400, 400},
[190] = { 1, 191, 373, 4, 400, 400},
[191] = { 75, 192, 374, 4, 400, 400},
[192] = { 125, 193, 537, 4, 400, 400},
[193] = { 150, 194, 376, 4, 400, 400},
[194] = { 200, 195, 318, 4, 400, 400},
[195] = { 250, 196, 377, 4, 400, 400},
[200] = { 1, 201, 11, 10, 400, 400},
[201] = { 50, 202, 287, 10, 400, 400},
[202] = { 75, 203, 12, 10, 400, 400},
[203] = { 125, 204, 10, 10, 400, 400},
[204] = { 150, 205, 289, 10, 400, 400},
[205] = { 175, 206, 13, 10, 400, 400},
[206] = { 200, 207, 14, 10, 400, 400},
[207] = { 250, 208, 203, 10, 400, 400},
[209] = { 1, 210, 244, 10, 400, 400},
[210] = { 50, 211, 368, 10, 400, 400},
[211] = { 100, 212, 391, 10, 400, 400},
[212] = { 150, 213, 242, 10, 400, 400},
[213] = { 200, 214, 286, 10, 400, 400},
[214] = { 350, 215, 290, 10, 400, 400},
[216] = { 1, 217, 404, 175, 400, 400},
[217] = { 100, 218, 405, 175, 400, 400},
[223] = { 25, 224, 309, 10, 400, 400},
[224] = { 100, 225, 312, 10, 400, 400},
[225] = { 150, 226, 326, 10, 400, 400},
[226] = { 250, 227, 328, 10, 400, 400},
[227] = { 300, 228, 364, 10, 400, 400},
[300] = { 1, 301, 406, 10, 400, 400},
[301] = { 50, 302, 407, 10, 400, 400},
[302] = { 100, 303, 408, 10, 400, 400},
[303] = { 200, 304, 213, 10, 400, 400},
[305] = { 1, 306, 19, 10, 400, 400},
[306] = { 150, 307, 339, 10, 400, 400},
[307] = { 150, 308, 518, 10, 400, 400},
[308] = { 150, 309, 544, 10, 400, 400},
[400] = { 1, 401, 35, 10, 400, 400},
[401] = { 100, 402, 75, 10, 400, 400},
[402] = { 200, 403, 264, 10, 400, 400},
[403] = { 250, 404, 389, 10, 400, 400},
[500] = { 1, 501, 411, 90, 400, 400},
[501] = { 50, 502, 412, 90, 400, 400},
[502] = { 100, 503, 414, 90, 400, 400},
[503] = { 200, 504, 415, 90, 400, 400},
[504] = { 300, 505, 416, 90, 400, 400},
[520] = { 1, 521, 491, 13, 400, 400},
[521] = { 100, 522, 492, 13, 400, 400},
[522] = { 150, 523, 493, 13, 400, 400},
[523] = { 200, 524, 494, 13, 400, 400},
[524] = { 250, 525, 401, 13, 400, 400},
[525] = { 300, 526, 402, 13, 400, 400},
[526] = { 350, 527, 403, 13, 400, 400},
[527] = { 400, 528, 495, 13, 400, 400},
[530] = { 1, 531, 356, 13, 400, 400},
[531] = { 100, 532, 139, 13, 400, 400},
[532] = { 150, 533, 223, 13, 400, 400},
[533] = { 200, 534, 236, 13, 400, 400},
[534] = { 250, 534, 133, 13, 400, 400},
[536] = { 1, 537, 378, 13, 400, 400},
[537] = { 100, 538, 379, 13, 400, 400},
[538] = { 150, 539, 380, 13, 400, 400},
[539] = { 200, 540, 381, 13, 400, 400},
[540] = { 250, 541, 382, 13, 400, 400},
[541] = { 300, 541, 322, 13, 400, 400},
[620] = { 1, 621, 429, 10, 400, 400},
[621] = { 100, 622, 430, 10, 400, 400},
[622] = { 150, 623, 431, 10, 400, 400},
[623] = { 200, 624, 432, 10, 400, 400},
[624] = { 225, 625, 433, 10, 400, 400},
[625] = { 250, 626, 434, 10, 400, 400},
[626] = { 300, 627, 435, 10, 400, 400},
[627] = { 400, 628, 436, 10, 400, 400},
[631] = { 50, 632, 525, 10, 400, 400},
[632] = { 100, 633, 524, 10, 400, 400},
[633] = { 150, 634, 523, 10, 400, 400},
[637] = { 50, 638, 536, 10, 400, 400},
[638] = { 150, 639, 535, 10, 400, 400},
[639] = { 250, 640, 530, 10, 400, 400},
[640] = { 300, 641, 546, 10, 400, 400},
[645] = { 50, 646, 510, 10, 400, 400},
[646] = { 150, 647, 511, 10, 400, 400},
[647] = { 250, 648, 512, 10, 400, 400},
[648] = { 300, 648, 513, 10, 400, 400},
}

function onLogin(cid)
    local voc = config[getPlayerVocation(cid)] - 1

    if getPlayerStorageValue(cid, voc) ~= nil then
        local outfit = {lookType = voc[3]}
        doCreatureChangeOutfit(cid, outfit)
        doSendMagicEffect(getCreaturePosition(cid), voc[4])
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
        setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
        doCreatureAddHealth(cid, 1)
    end
    return true
end

login.lua

Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")

    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
           registerCreatureEvent(cid, "ProtDeath")
           registerCreatureEvent(cid, "Biohazard")
           registerCreatureEvent(cid, "ZombieAttack")
           registerCreatureEvent(cid, "WeaponMana")
           registerCreatureEvent(cid, "showVoc")       
           registerCreatureEvent(cid, "ReportBug")
           registerCreatureEvent(cid, "AdvanceSave")
           registerCreatureEvent(cid, "MaxLevel")
           registerCreatureEvent(cid, "Evento")
           registerCreatureEvent(cid, "Recompensa")
           registerCreatureEvent(cid, "Evento")
           registerCreatureEvent(cid, "Evento")
          
    registerCreatureEvent(cid, "TransformEvent")
    return true
end

creaturescripts.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="kill" name="Recompensa" event="script" value="bingobook.lua"/>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>   
    <event type="death" name="questakatsukium" event="script" value="questakatsukium.lua"/>
    <event type="death" name="questakatsukidois" event="script" value="questakatsukidois.lua"/>
    <event type="death" name="questakatsukitres" event="script" value="questakatsukitres.lua"/>
    <event type="death" name="questakatsukiquatro" event="script" value="questakatsukiquatro.lua"/>
    <event type="death" name="questakatsukicinco" event="script" value="questakatsukicinco.lua"/>
    <event type="death" name="questakatsukiseis" event="script" value="questakatsukiseis.lua"/>
    <event type="death" name="questakatsukisete" event="script" value="questakatsukisete.lua"/>
    <event type="death" name="questcovil" event="script" value="questcovil.lua"/>
    <event type="death" name="questjounin" event="script" value="questjounin.lua"/>
    <event type="death" name="questmizuki" event="script" value="questmizuki.lua"/>
    <event type="death" name="questnidaime" event="script" value="questnidaime.lua"/>
    <event type="death" name="questmadara" event="script" value="questmadara.lua"/>   
    <event type="statschange" name="Biohazard" event="script" value="statschange.lua"/>
    <event type="death" name="exameanbuum" event="script" value="exameanbuum.lua"/>
    <event type="death" name="exameanbudois" event="script" value="exameanbudois.lua"/>
    <event type="death" name="exameanbutres" event="script" value="exameanbutres.lua"/>
    <event type="death" name="exameanbuquatro" event="script" value="exameanbuquatro.lua"/>
    <event type="logout" name="CTFLogout" event="script" value="CTFMax.lua"/>
    <event type="combat" name="CTFCombat" event="script" value="CTFMax.lua"/>     
    <event type="attack" name="CTFAttack" event="script" value="CTFMax.lua"/>     
    <event type="statschange" name="CTFDeath" event="script" value="CTFMax.lua"/>
    <event type="death" name="teamum" event="script" value="teamum.lua"/>
    <event type="death" name="teamdois" event="script" value="teamdois.lua"/>
    <event type="death" name="teamtres" event="script" value="teamtres.lua"/>
    <event type="death" name="teamquatro" event="script" value="teamquatro.lua"/>
    <event type="look" name="showVoc" event="script" value="showvoc.lua"/>
    <event type="think" name="ZombieThink" event="script" value="zombie/onthink.lua"/>
    <event type="statschange" name="ZombieAttack" event="script" value="zombie/onattack.lua"/>
    <event type="death" name="ZombieDeath" event="script" value="zombie/ondeath.lua"/>
    <event type="kill" name="Recompensa" event="script" value="oinin.lua"/>
    <event type="login" name="BattleLogin" event="script" value="BattleCreatureScript.lua"/>
    <event type="PrepareDeath" name="BattleDeath" event="script" value="BattleCreatureScript.lua"/>
    <event type="combat" name="BattleTeam" event="script" value="BattleCreatureScript.lua"/>
    <event type="advance" name="MaxLevel" event="script" value="maxlevel.lua"/>
    <event type="login" name="TransformEvent" event="script" value="TransformEvent.lua"/>
</creaturescripts>
 
Last edited:
The same error with new code. Just so you know, I removed my edits from post 3, not sure if that was necessary

Code:
[09/10/2016 21:51:09] [Error - CreatureScript Interface]
[09/10/2016 21:51:09] data/creaturescripts/scripts/TransformEvent.lua:onLogin
[09/10/2016 21:51:09] Description:
[09/10/2016 21:51:09] data/creaturescripts/scripts/TransformEvent.lua:176: attempt to perform arithmetic on field '?' (a table value)
[09/10/2016 21:51:09] stack traceback:
[09/10/2016 21:51:09]     data/creaturescripts/scripts/TransformEvent.lua:176: in function <data/creaturescripts/scripts/TransformEvent.lua:175>

latest

transform.lua
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108, 400, 400},
[15] = { 75, 16, 5, 108, 400, 400},
[16] = { 100, 17, 7, 108, 400, 400},
[17] = { 125, 18, 94, 108, 400, 400},
[18] = { 150, 19, 59, 108, 400, 400},
[19] = { 175, 20, 8, 108, 400, 400},
[20] = { 200, 21, 178, 108, 400, 400},
[21] = { 225, 22, 95, 110, 400, 400},
[22] = { 250, 23, 54, 110, 400, 400},
[23] = { 275, 24, 37, 110, 400, 400},
[25] = { 1, 26, 80, 87, 400, 400},
[26] = { 50, 27, 190, 87, 400, 400},
[27] = { 75, 28, 83, 87, 400, 400},
[28] = { 100, 29, 191, 87, 400, 400},
[29] = { 150, 30, 192, 87, 400, 400},
[30] = { 175, 31, 109, 87, 400, 400},
[31] = { 225, 32, 81, 87, 400, 400},
[32] = { 250, 33, 111, 87, 400, 400},
[34] = { 1, 35, 194, 5, 400, 400},
[35] = { 50, 36, 175, 5, 400, 400},
[36] = { 75, 37, 169, 5, 400, 400},
[37] = { 100, 38, 173, 5, 400, 400},
[38] = { 150, 39, 172, 5, 400, 400},
[39] = { 175, 40, 171, 5, 400, 400},
[40] = { 225, 41, 174, 5, 400, 400},
[41] = { 250, 42, 170, 5, 400, 400},
[50] = { 1, 51, 67, 205, 400, 400},
[51] = { 50, 52, 72, 205, 400, 400},
[52] = { 75, 53, 273, 205, 400, 400},
[53] = { 100, 54, 65, 205, 400, 400},
[54] = { 125, 55, 329, 205, 400, 400},
[55] = { 150, 56, 188, 205, 400, 400},
[56] = { 175, 57, 62, 205, 400, 400},
[57] = { 200, 58, 189, 205, 400, 400},
[58] = { 225, 59, 335, 205, 400, 400},
[59] = { 250, 60, 57, 205, 400, 400},
[70] = { 1, 71, 102, 124, 400, 400},
[71] = { 50, 72, 103, 124, 400, 400},
[72] = { 75, 73, 105, 124, 400, 400},
[73] = { 100, 74, 107, 124, 400, 400},
[74] = { 150, 75, 108, 124, 400, 400},
[75] = { 175, 76, 314, 124, 400, 400},
[76] = { 225, 77, 315, 124, 400, 400},
[77] = { 250, 78, 333, 124, 400, 400},
[90] = { 1, 91, 331, 209, 400, 400},
[91] = { 50, 92, 69, 209, 400, 400},
[92] = { 75, 93, 70, 209, 400, 400},
[93] = { 100, 94, 199, 209, 400, 400},
[94] = { 150, 95, 196, 209, 400, 400},
[95] = { 175, 96, 197, 209, 400, 400},
[96] = { 225, 97, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[110] = { 1, 111, 88, 187, 400, 400},
[111] = { 75, 112, 341, 187, 400, 400},
[112] = { 100, 113, 343, 187, 400, 400},
[113] = { 150, 114, 342, 187, 400, 400},
[114] = { 200, 115, 344, 187, 400, 400},
[115] = { 250, 116, 345, 187, 400, 400},
[130] = { 1, 131, 296, 124, 400, 400},
[131] = { 75, 132, 297, 124, 400, 400},
[132] = { 150, 133, 298, 124, 400, 400},
[133] = { 200, 134, 299, 124, 400, 400},
[134] = { 250, 135, 300, 124, 400, 400},
[150] = { 1, 151, 384, 126, 400, 400},
[151] = { 75, 152, 385, 126, 400, 400},
[152] = { 150, 153, 386, 126, 400, 400},
[153] = { 200, 154, 396, 126, 400, 400},
[170] = { 1, 171, 97, 108, 400, 400},
[171] = { 50, 172, 285, 108, 400, 400},
[172] = { 75, 173, 282, 108, 400, 400},
[173] = { 100, 174, 98, 108, 400, 400},
[174] = { 125, 175, 99, 109, 400, 400},
[175] = { 150, 176, 100, 109, 400, 400},
[176] = { 200, 177, 211, 109, 400, 400},
[190] = { 1, 191, 373, 4, 400, 400},
[191] = { 75, 192, 374, 4, 400, 400},
[192] = { 125, 193, 537, 4, 400, 400},
[193] = { 150, 194, 376, 4, 400, 400},
[194] = { 200, 195, 318, 4, 400, 400},
[195] = { 250, 196, 377, 4, 400, 400},
[200] = { 1, 201, 11, 10, 400, 400},
[201] = { 50, 202, 287, 10, 400, 400},
[202] = { 75, 203, 12, 10, 400, 400},
[203] = { 125, 204, 10, 10, 400, 400},
[204] = { 150, 205, 289, 10, 400, 400},
[205] = { 175, 206, 13, 10, 400, 400},
[206] = { 200, 207, 14, 10, 400, 400},
[207] = { 250, 208, 203, 10, 400, 400},
[209] = { 1, 210, 244, 10, 400, 400},
[210] = { 50, 211, 368, 10, 400, 400},
[211] = { 100, 212, 391, 10, 400, 400},
[212] = { 150, 213, 242, 10, 400, 400},
[213] = { 200, 214, 286, 10, 400, 400},
[214] = { 350, 215, 290, 10, 400, 400},
[216] = { 1, 217, 404, 175, 400, 400},
[217] = { 100, 218, 405, 175, 400, 400},
[223] = { 25, 224, 309, 10, 400, 400},
[224] = { 100, 225, 312, 10, 400, 400},
[225] = { 150, 226, 326, 10, 400, 400},
[226] = { 250, 227, 328, 10, 400, 400},
[227] = { 300, 228, 364, 10, 400, 400},
[300] = { 1, 301, 406, 10, 400, 400},
[301] = { 50, 302, 407, 10, 400, 400},
[302] = { 100, 303, 408, 10, 400, 400},
[303] = { 200, 304, 213, 10, 400, 400},
[305] = { 1, 306, 19, 10, 400, 400},
[306] = { 150, 307, 339, 10, 400, 400},
[307] = { 150, 308, 518, 10, 400, 400},
[308] = { 150, 309, 544, 10, 400, 400},
[400] = { 1, 401, 35, 10, 400, 400},
[401] = { 100, 402, 75, 10, 400, 400},
[402] = { 200, 403, 264, 10, 400, 400},
[403] = { 250, 404, 389, 10, 400, 400},
[500] = { 1, 501, 411, 90, 400, 400},
[501] = { 50, 502, 412, 90, 400, 400},
[502] = { 100, 503, 414, 90, 400, 400},
[503] = { 200, 504, 415, 90, 400, 400},
[504] = { 300, 505, 416, 90, 400, 400},
[520] = { 1, 521, 491, 13, 400, 400},
[521] = { 100, 522, 492, 13, 400, 400},
[522] = { 150, 523, 493, 13, 400, 400},
[523] = { 200, 524, 494, 13, 400, 400},
[524] = { 250, 525, 401, 13, 400, 400},
[525] = { 300, 526, 402, 13, 400, 400},
[526] = { 350, 527, 403, 13, 400, 400},
[527] = { 400, 528, 495, 13, 400, 400},
[530] = { 1, 531, 356, 13, 400, 400},
[531] = { 100, 532, 139, 13, 400, 400},
[532] = { 150, 533, 223, 13, 400, 400},
[533] = { 200, 534, 236, 13, 400, 400},
[534] = { 250, 534, 133, 13, 400, 400},
[536] = { 1, 537, 378, 13, 400, 400},
[537] = { 100, 538, 379, 13, 400, 400},
[538] = { 150, 539, 380, 13, 400, 400},
[539] = { 200, 540, 381, 13, 400, 400},
[540] = { 250, 541, 382, 13, 400, 400},
[541] = { 300, 541, 322, 13, 400, 400},
[620] = { 1, 621, 429, 10, 400, 400},
[621] = { 100, 622, 430, 10, 400, 400},
[622] = { 150, 623, 431, 10, 400, 400},
[623] = { 200, 624, 432, 10, 400, 400},
[624] = { 225, 625, 433, 10, 400, 400},
[625] = { 250, 626, 434, 10, 400, 400},
[626] = { 300, 627, 435, 10, 400, 400},
[627] = { 400, 628, 436, 10, 400, 400},
[631] = { 50, 632, 525, 10, 400, 400},
[632] = { 100, 633, 524, 10, 400, 400},
[633] = { 150, 634, 523, 10, 400, 400},
[637] = { 50, 638, 536, 10, 400, 400},
[638] = { 150, 639, 535, 10, 400, 400},
[639] = { 250, 640, 530, 10, 400, 400},
[640] = { 300, 641, 546, 10, 400, 400},
[645] = { 50, 646, 510, 10, 400, 400},
[646] = { 150, 647, 511, 10, 400, 400},
[647] = { 250, 648, 512, 10, 400, 400},
[648] = { 300, 648, 513, 10, 400, 400},
}
function onSay(cid, words, param, channel)

if exhaustion.get(cid, 103) then
doPlayerSendCancel(cid, 'Slow down.')
return true
end
exhaustion.set(cid, 103, 0)

doPlayerSay(cid, "transform")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
doPlayerSetVocation(cid, voc[2])
doPlayerSetStorageId(cid, 12345, voc[2])
local outfit = {lookType = voc[3]}
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
doCreatureAddHealth(cid, 1)


else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You need " .. voc[1] .. " level to transform.")
end
else
doPlayerSendCancel(cid, "You cannot transform.")
end
return true
end



TransformEvent.lua
Code:
local config = {
--[vocation id] = {required level, new vocation, looktype, effect, hp, mana}
[1] = { 25, 2, 556, 83, 400, 400},
[2] = { 50, 3, 557, 83, 400, 400},
[3] = { 75, 4, 558, 83, 400, 400},
[4] = { 100, 5, 548, 66, 400, 400},
[5] = { 125, 6, 559, 10, 400, 400},
[6] = { 175, 7, 320, 10, 400, 400},
[7] = { 200, 8, 563, 66, 400, 400},
[8] = { 225, 9, 559, 10, 400, 400},
[9] = { 275, 10, 554, 135, 400, 400},
[10] = { 300, 11, 555, 135, 400, 400},
[11] = { 325, 12, 550, 135, 400, 400},
[12] = { 350, 13, 564, 135, 400, 400},

[14] = { 50, 15, 6, 108, 400, 400},
[15] = { 75, 16, 5, 108, 400, 400},
[16] = { 100, 17, 7, 108, 400, 400},
[17] = { 125, 18, 94, 108, 400, 400},
[18] = { 150, 19, 59, 108, 400, 400},
[19] = { 175, 20, 8, 108, 400, 400},
[20] = { 200, 21, 178, 108, 400, 400},
[21] = { 225, 22, 95, 110, 400, 400},
[22] = { 250, 23, 54, 110, 400, 400},
[23] = { 275, 24, 37, 110, 400, 400},
[25] = { 1, 26, 80, 87, 400, 400},
[26] = { 50, 27, 190, 87, 400, 400},
[27] = { 75, 28, 83, 87, 400, 400},
[28] = { 100, 29, 191, 87, 400, 400},
[29] = { 150, 30, 192, 87, 400, 400},
[30] = { 175, 31, 109, 87, 400, 400},
[31] = { 225, 32, 81, 87, 400, 400},
[32] = { 250, 33, 111, 87, 400, 400},
[34] = { 1, 35, 194, 5, 400, 400},
[35] = { 50, 36, 175, 5, 400, 400},
[36] = { 75, 37, 169, 5, 400, 400},
[37] = { 100, 38, 173, 5, 400, 400},
[38] = { 150, 39, 172, 5, 400, 400},
[39] = { 175, 40, 171, 5, 400, 400},
[40] = { 225, 41, 174, 5, 400, 400},
[41] = { 250, 42, 170, 5, 400, 400},
[50] = { 1, 51, 67, 205, 400, 400},
[51] = { 50, 52, 72, 205, 400, 400},
[52] = { 75, 53, 273, 205, 400, 400},
[53] = { 100, 54, 65, 205, 400, 400},
[54] = { 125, 55, 329, 205, 400, 400},
[55] = { 150, 56, 188, 205, 400, 400},
[56] = { 175, 57, 62, 205, 400, 400},
[57] = { 200, 58, 189, 205, 400, 400},
[58] = { 225, 59, 335, 205, 400, 400},
[59] = { 250, 60, 57, 205, 400, 400},
[70] = { 1, 71, 102, 124, 400, 400},
[71] = { 50, 72, 103, 124, 400, 400},
[72] = { 75, 73, 105, 124, 400, 400},
[73] = { 100, 74, 107, 124, 400, 400},
[74] = { 150, 75, 108, 124, 400, 400},
[75] = { 175, 76, 314, 124, 400, 400},
[76] = { 225, 77, 315, 124, 400, 400},
[77] = { 250, 78, 333, 124, 400, 400},
[90] = { 1, 91, 331, 209, 400, 400},
[91] = { 50, 92, 69, 209, 400, 400},
[92] = { 75, 93, 70, 209, 400, 400},
[93] = { 100, 94, 199, 209, 400, 400},
[94] = { 150, 95, 196, 209, 400, 400},
[95] = { 175, 96, 197, 209, 400, 400},
[96] = { 225, 97, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[97] = { 250, 98, 198, 209, 400, 400},
[110] = { 1, 111, 88, 187, 400, 400},
[111] = { 75, 112, 341, 187, 400, 400},
[112] = { 100, 113, 343, 187, 400, 400},
[113] = { 150, 114, 342, 187, 400, 400},
[114] = { 200, 115, 344, 187, 400, 400},
[115] = { 250, 116, 345, 187, 400, 400},
[130] = { 1, 131, 296, 124, 400, 400},
[131] = { 75, 132, 297, 124, 400, 400},
[132] = { 150, 133, 298, 124, 400, 400},
[133] = { 200, 134, 299, 124, 400, 400},
[134] = { 250, 135, 300, 124, 400, 400},
[150] = { 1, 151, 384, 126, 400, 400},
[151] = { 75, 152, 385, 126, 400, 400},
[152] = { 150, 153, 386, 126, 400, 400},
[153] = { 200, 154, 396, 126, 400, 400},
[170] = { 1, 171, 97, 108, 400, 400},
[171] = { 50, 172, 285, 108, 400, 400},
[172] = { 75, 173, 282, 108, 400, 400},
[173] = { 100, 174, 98, 108, 400, 400},
[174] = { 125, 175, 99, 109, 400, 400},
[175] = { 150, 176, 100, 109, 400, 400},
[176] = { 200, 177, 211, 109, 400, 400},
[190] = { 1, 191, 373, 4, 400, 400},
[191] = { 75, 192, 374, 4, 400, 400},
[192] = { 125, 193, 537, 4, 400, 400},
[193] = { 150, 194, 376, 4, 400, 400},
[194] = { 200, 195, 318, 4, 400, 400},
[195] = { 250, 196, 377, 4, 400, 400},
[200] = { 1, 201, 11, 10, 400, 400},
[201] = { 50, 202, 287, 10, 400, 400},
[202] = { 75, 203, 12, 10, 400, 400},
[203] = { 125, 204, 10, 10, 400, 400},
[204] = { 150, 205, 289, 10, 400, 400},
[205] = { 175, 206, 13, 10, 400, 400},
[206] = { 200, 207, 14, 10, 400, 400},
[207] = { 250, 208, 203, 10, 400, 400},
[209] = { 1, 210, 244, 10, 400, 400},
[210] = { 50, 211, 368, 10, 400, 400},
[211] = { 100, 212, 391, 10, 400, 400},
[212] = { 150, 213, 242, 10, 400, 400},
[213] = { 200, 214, 286, 10, 400, 400},
[214] = { 350, 215, 290, 10, 400, 400},
[216] = { 1, 217, 404, 175, 400, 400},
[217] = { 100, 218, 405, 175, 400, 400},
[223] = { 25, 224, 309, 10, 400, 400},
[224] = { 100, 225, 312, 10, 400, 400},
[225] = { 150, 226, 326, 10, 400, 400},
[226] = { 250, 227, 328, 10, 400, 400},
[227] = { 300, 228, 364, 10, 400, 400},
[300] = { 1, 301, 406, 10, 400, 400},
[301] = { 50, 302, 407, 10, 400, 400},
[302] = { 100, 303, 408, 10, 400, 400},
[303] = { 200, 304, 213, 10, 400, 400},
[305] = { 1, 306, 19, 10, 400, 400},
[306] = { 150, 307, 339, 10, 400, 400},
[307] = { 150, 308, 518, 10, 400, 400},
[308] = { 150, 309, 544, 10, 400, 400},
[400] = { 1, 401, 35, 10, 400, 400},
[401] = { 100, 402, 75, 10, 400, 400},
[402] = { 200, 403, 264, 10, 400, 400},
[403] = { 250, 404, 389, 10, 400, 400},
[500] = { 1, 501, 411, 90, 400, 400},
[501] = { 50, 502, 412, 90, 400, 400},
[502] = { 100, 503, 414, 90, 400, 400},
[503] = { 200, 504, 415, 90, 400, 400},
[504] = { 300, 505, 416, 90, 400, 400},
[520] = { 1, 521, 491, 13, 400, 400},
[521] = { 100, 522, 492, 13, 400, 400},
[522] = { 150, 523, 493, 13, 400, 400},
[523] = { 200, 524, 494, 13, 400, 400},
[524] = { 250, 525, 401, 13, 400, 400},
[525] = { 300, 526, 402, 13, 400, 400},
[526] = { 350, 527, 403, 13, 400, 400},
[527] = { 400, 528, 495, 13, 400, 400},
[530] = { 1, 531, 356, 13, 400, 400},
[531] = { 100, 532, 139, 13, 400, 400},
[532] = { 150, 533, 223, 13, 400, 400},
[533] = { 200, 534, 236, 13, 400, 400},
[534] = { 250, 534, 133, 13, 400, 400},
[536] = { 1, 537, 378, 13, 400, 400},
[537] = { 100, 538, 379, 13, 400, 400},
[538] = { 150, 539, 380, 13, 400, 400},
[539] = { 200, 540, 381, 13, 400, 400},
[540] = { 250, 541, 382, 13, 400, 400},
[541] = { 300, 541, 322, 13, 400, 400},
[620] = { 1, 621, 429, 10, 400, 400},
[621] = { 100, 622, 430, 10, 400, 400},
[622] = { 150, 623, 431, 10, 400, 400},
[623] = { 200, 624, 432, 10, 400, 400},
[624] = { 225, 625, 433, 10, 400, 400},
[625] = { 250, 626, 434, 10, 400, 400},
[626] = { 300, 627, 435, 10, 400, 400},
[627] = { 400, 628, 436, 10, 400, 400},
[631] = { 50, 632, 525, 10, 400, 400},
[632] = { 100, 633, 524, 10, 400, 400},
[633] = { 150, 634, 523, 10, 400, 400},
[637] = { 50, 638, 536, 10, 400, 400},
[638] = { 150, 639, 535, 10, 400, 400},
[639] = { 250, 640, 530, 10, 400, 400},
[640] = { 300, 641, 546, 10, 400, 400},
[645] = { 50, 646, 510, 10, 400, 400},
[646] = { 150, 647, 511, 10, 400, 400},
[647] = { 250, 648, 512, 10, 400, 400},
[648] = { 300, 648, 513, 10, 400, 400},
}

function onLogin(cid)
    local voc = config[getPlayerVocation(cid)] - 1

    if getPlayerStorageValue(cid, voc) ~= nil then
        local outfit = {lookType = voc[3]}
        doCreatureChangeOutfit(cid, outfit)
        doSendMagicEffect(getCreaturePosition(cid), voc[4])
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+voc[5])
        setCreatureMaxMana(cid, getCreatureMaxMana(cid)+voc[6])
        doCreatureAddHealth(cid, 1)
    end
    return true
end

login.lua

Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")

    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
           registerCreatureEvent(cid, "ProtDeath")
           registerCreatureEvent(cid, "Biohazard")
           registerCreatureEvent(cid, "ZombieAttack")
           registerCreatureEvent(cid, "WeaponMana")
           registerCreatureEvent(cid, "showVoc")      
           registerCreatureEvent(cid, "ReportBug")
           registerCreatureEvent(cid, "AdvanceSave")
           registerCreatureEvent(cid, "MaxLevel")
           registerCreatureEvent(cid, "Evento")
           registerCreatureEvent(cid, "Recompensa")
           registerCreatureEvent(cid, "Evento")
           registerCreatureEvent(cid, "Evento")
         
    registerCreatureEvent(cid, "TransformEvent")
    return true
end

creaturescripts.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="kill" name="Recompensa" event="script" value="bingobook.lua"/>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>  
    <event type="death" name="questakatsukium" event="script" value="questakatsukium.lua"/>
    <event type="death" name="questakatsukidois" event="script" value="questakatsukidois.lua"/>
    <event type="death" name="questakatsukitres" event="script" value="questakatsukitres.lua"/>
    <event type="death" name="questakatsukiquatro" event="script" value="questakatsukiquatro.lua"/>
    <event type="death" name="questakatsukicinco" event="script" value="questakatsukicinco.lua"/>
    <event type="death" name="questakatsukiseis" event="script" value="questakatsukiseis.lua"/>
    <event type="death" name="questakatsukisete" event="script" value="questakatsukisete.lua"/>
    <event type="death" name="questcovil" event="script" value="questcovil.lua"/>
    <event type="death" name="questjounin" event="script" value="questjounin.lua"/>
    <event type="death" name="questmizuki" event="script" value="questmizuki.lua"/>
    <event type="death" name="questnidaime" event="script" value="questnidaime.lua"/>
    <event type="death" name="questmadara" event="script" value="questmadara.lua"/>  
    <event type="statschange" name="Biohazard" event="script" value="statschange.lua"/>
    <event type="death" name="exameanbuum" event="script" value="exameanbuum.lua"/>
    <event type="death" name="exameanbudois" event="script" value="exameanbudois.lua"/>
    <event type="death" name="exameanbutres" event="script" value="exameanbutres.lua"/>
    <event type="death" name="exameanbuquatro" event="script" value="exameanbuquatro.lua"/>
    <event type="logout" name="CTFLogout" event="script" value="CTFMax.lua"/>
    <event type="combat" name="CTFCombat" event="script" value="CTFMax.lua"/>    
    <event type="attack" name="CTFAttack" event="script" value="CTFMax.lua"/>    
    <event type="statschange" name="CTFDeath" event="script" value="CTFMax.lua"/>
    <event type="death" name="teamum" event="script" value="teamum.lua"/>
    <event type="death" name="teamdois" event="script" value="teamdois.lua"/>
    <event type="death" name="teamtres" event="script" value="teamtres.lua"/>
    <event type="death" name="teamquatro" event="script" value="teamquatro.lua"/>
    <event type="look" name="showVoc" event="script" value="showvoc.lua"/>
    <event type="think" name="ZombieThink" event="script" value="zombie/onthink.lua"/>
    <event type="statschange" name="ZombieAttack" event="script" value="zombie/onattack.lua"/>
    <event type="death" name="ZombieDeath" event="script" value="zombie/ondeath.lua"/>
    <event type="kill" name="Recompensa" event="script" value="oinin.lua"/>
    <event type="login" name="BattleLogin" event="script" value="BattleCreatureScript.lua"/>
    <event type="PrepareDeath" name="BattleDeath" event="script" value="BattleCreatureScript.lua"/>
    <event type="combat" name="BattleTeam" event="script" value="BattleCreatureScript.lua"/>
    <event type="advance" name="MaxLevel" event="script" value="maxlevel.lua"/>
    <event type="login" name="TransformEvent" event="script" value="TransformEvent.lua"/>
</creaturescripts>
your problem is this
Code:
local voc = config[getPlayerVocation(cid)] - 1
when you get a value from a table using key like config[10], it will return the table ( { 300, 11, 555, 135, 400, 400} )
you cant perform an arithmetic on { 300, 11, 555, 135, 400, 400} because it's a table, not a number
so if you wanted to get the previous vocation config you would have to do config[getPlayerVocation(cid) - 1]
since getPlayerVocation(cid) returns an integer, and you can subtract from it
another problem in this code, is this:
Code:
if getPlayerStorageValue(cid, voc) ~= nil then
a storage value cannot be nil, since all storage values by default are -1, so it will always pass through this statement, you would replace nil with -1 if you want to check if the player's storage is anything but -1
 
Code:
doPlayerSetStorageId(cid, 12345, voc[2])

in transform.lua seems to be causing some trouble since when I type 'transform' in game, the character says it twice and does not react at all, meaning: no outfit changes or effects but the vocation has changed once.

+ there were some other issues. Fortunately I have solved the mystery.
---------------
I had to create logout.lua and this little script

Code:
function onLogout(cid)

        if (getPlayerVocation(cid) == 2) then
    doPlayerSetVocation(cid,1)
    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-400)
    doCreatureAddHealth(cid, 1)
    setCreatureMaxMana(cid, getCreatureMaxMana(cid)-400)
   doCreatureChangeOutfit(cid, {lookType=549})

   return 1
   end

The only drawback is that I have to re-write this script for each individual character.
 
Refresh page, I just copied it wrong and edited after few seconds.
your problem is this
Code:
local voc = config[getPlayerVocation(cid)] - 1
when you get a value from a table using key like config[10], it will return the table ( { 300, 11, 555, 135, 400, 400} )
you cant perform an arithmetic on { 300, 11, 555, 135, 400, 400} because it's a table, not a number
so if you wanted to get the previous vocation config you would have to do config[getPlayerVocation(cid) - 1]
since getPlayerVocation(cid) returns an integer, and you can subtract from it
another problem in this code, is this:
Code:
if getPlayerStorageValue(cid, voc) ~= nil then
a storage value cannot be nil, since all storage values by default are -1, so it will always pass through this statement, you would replace nil with -1 if you want to check if the player's storage is anything but -1

Thanks for all your help guys.

I have one more question with regards to vocations.xml. Whenever I log off, my character seems to be going -1 with vocation so for instance, if I have transform4, it will revert back to transform 3 after logging out and logging back in. Is there anything I can do to make it stay on transform 4 even after logging off?

@Xeraphus, nice avatar :D
 
Thanks for all your help guys.

I have one more question with regards to vocations.xml. Whenever I log off, my character seems to be going -1 with vocation so for instance, if I have transform4, it will revert back to transform 3 after logging out and logging back in. Is there anything I can do to make it stay on transform 4 even after logging off?

@Xeraphus, nice avatar :D
post vocations xml
i believe it can be due to the fromVoc="x", once you log out your vocation will revert back to the fromVoc but if that's not it, i don't know
 
@Xeraphus @andu

thaanks guys, solved/ had to change the vocation from to the same from the beginning (ID)

dyXyGEB.gif
 
Last edited:
Back
Top