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

Lua transform on advance problem

dami1310

◄ Unidentified ►
Joined
Jan 27, 2013
Messages
732
Solutions
12
Reaction score
664
Location
Poland
I just started learning lua so I don't know a lot of things and I tried to write script basing on created one, but something goes wrong and it isn't working.
Code:
function onAdvance(cid)
local voc = getPlayerVocation(cid)
local transform = transforms[voc]
local text1 = "..."
if(not transform) then
doPlayerSendCancel(cid, text1)
return true
end
transforms =
{
[1] = {outfit = {lookType = 7, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, text = "Moete kita zo!", textSayType = TALKTYPE_MONSTER, level = 10, gainMana = 1000, gainHealth = 1000, newVocation = 5, effect = 69},
}

if getPlayerLevel(cid) >= transform.level then
doPlayerSetVocation(cid, transform.newVocation)
doCreatureChangeOutfit(cid, transform.outfit)
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + transform.gainMana)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.gainHealth)
doSendMagicEffect(cid, transform.effect)
doCreatureSay(cid, transform.text, transform.textSayType)
end

return true
end

Here's error screen:
kkkkkpng_enhesnx.png


I hope you can do something with it ; /
 
Code:
local transform = transforms[voc]
Table 'transforms' doesn't exist here, it's declared below, so it can't work.

Also for transform system I recommend you this one. After few changes it works really well and it's easy to understand in my opinion.
BTW I hope you'r using 0.3.6, that's the version for which this script have beed written and I'm also using this one.
 
Last edited:
Back
Top