• 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 system [table included]

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
741
Solutions
5
Reaction score
193
Location
Pr0land
GitHub
Erexo
Hello,
I would like to present my very own `transform system`, useful for OTS like Naruto/DB or other.
Its not very advanced, but Ive made it handy and simple to edit.

First of all, put a table in libs, contains all info about transforms.

Lua:
Trans = {
-- Goku Transforms
{["voc"] = 1, ["newVoc"] = 2, ["looktype"] = 5, ["revertLooktype"] = 4, ["level"] = 50, ["rage"] = 3, ["kiToTrans"] = 10, ["addHp"] = 200, ["addKi"] = 150, ["effectOn"] = 236, ["aura"] = 0, ["constant"] = false},
{["voc"] = 2, ["newVoc"] = 3, ["looktype"] = 6, ["revertLooktype"] = 5, ["level"] = 130, ["rage"] = 5, ["kiToTrans"] = 50, ["addHp"] = 450, ["addKi"] = 300, ["effectOn"] = 236, ["aura"] = 0, ["constant"] = false},
{["voc"] = 3, ["newVoc"] = 4, ["looktype"] = 7, ["revertLooktype"] = 6, ["level"] = 180, ["rage"] = 8, ["kiToTrans"] = 100, ["addHp"] = 1600, ["addKi"] = 900, ["effectOn"] = 236, ["aura"] = 104, ["constant"] = false},
{["voc"] = 4, ["newVoc"] = 5, ["looktype"] = 8, ["revertLooktype"] = 7, ["level"] = 270, ["rage"] = 12, ["kiToTrans"] = 150, ["addHp"] = 2900, ["addKi"] = 2700, ["effectOn"] = 236, ["aura"] = 104, ["constant"] = false},
{["voc"] = 5, ["newVoc"] = 6, ["looktype"] = 10, ["revertLooktype"] = 8, ["level"] = 350, ["rage"] = 15, ["kiToTrans"] = 200, ["addHp"] = 4000, ["addKi"] = 4000, ["effectOn"] = 236, ["aura"] = 105, ["constant"] = false}
}
So, as you can see it seems to be messy.

Lua:
voc = from vocation
newVoc = to vocation
looktype = new outfit
revertLooktype = current outfit
level = lvl needed to transform
rage = soul needed to transform (you can disable it, just type 0)
kiToTrans = mana to transform
addHp = maxHp added when you transform
addKi = maxMana added
effectOn = magic effect when you use transform
aura = magic effect when you have current transform (can be disabled, just type 0)
constant = if transform is constant (when it is, player dont lose transform/outfit and maxHp/Mana, and cannot use revert)


Lets check code now:

spells.xml
XML:
<instant name="Transform" words="transform" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" exhaustionType="2" event="script" value="Transform.lua"/>
<instant name="Revert" words="revert" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" exhaustionType="2" event="script" value="Revert.lua"/>

transform.lua
Lua:
function onCastSpell(cid, var)

        for i = 1, #Trans do
            if getPlayerVocation(cid) == Trans[i].voc then
                if getPlayerLevel(cid) >= Trans[i].level then
                    if getPlayerSoul(cid) >= Trans[i].rage then
                        if getPlayerMana(cid) >= Trans[i].kiToTrans then
                            if(Trans[i].constant) then
                                doCreatureChangeOutfit(cid, {lookType=Trans[i].looktype})
                            else
                                doSetCreatureOutfit(cid, {lookType=Trans[i].looktype}, -1)
                            end
                                --doPlayerAddSoul(cid, -Trans[i].rage)
                                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + Trans[i].addHp)
                                setCreatureMaxMana(cid, getCreatureMaxMana(cid) + Trans[i].addKi)
                                doCreatureAddHealth(cid, Trans[i].addHp)
                                doCreatureAddMana(cid, Trans[i].addKi)
                         
                                doSendMagicEffect(getCreaturePosition(cid), Trans[i].effectOn)
                                doPlayerSendCancel(cid,"You have transformed.")
                                doPlayerSetVocation(cid,Trans[i].newVoc)
                         
                                return true
                        else
                            doPlayerSendCancel(cid, "You need " .. Trans[i].kiToTrans .. " KI to transform!")
                            doSendMagicEffect(getCreaturePosition(cid), 2)
                            return true
                        end     
                    else
                        doPlayerSendCancel(cid, "You need " .. Trans[i].rage .. " rage to transform!")
                        doSendMagicEffect(getCreaturePosition(cid), 2)
                        return true
                    end
                else
                    doPlayerSendCancel(cid, "You need " .. Trans[i].level .. " level to transform!")
                    doSendMagicEffect(getCreaturePosition(cid), 2)
                    return true
                end
            end
        end 

    doPlayerSendCancel(cid, "You cannot transform.")
    doSendMagicEffect(getCreaturePosition(cid), 2)
    return true
end


revert.lua
Lua:
function onCastSpell(cid, var)

        for i = 1, #Trans do
            if getPlayerVocation(cid) == Trans[i].newVoc then
                if not Trans[i].constant then
                    if (getCreatureHealth(cid) > Trans[i].addHp) and (getCreatureMana(cid) > Trans[i].addKi) then

                        doPlayerSetVocation(cid,Trans[i].voc)
                        doCreatureChangeOutfit(cid, {lookType=Trans[i].revertLooktype})
                        doSendMagicEffect(getCreaturePosition(cid), 6)
                        doPlayerSendCancel(cid,"You have reverted.")
                 
                        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - Trans[i].addHp)
                        setCreatureMaxMana(cid, getCreatureMaxMana(cid) - Trans[i].addKi)
                        doCreatureAddHealth(cid, -Trans[i].addHp, false)
                        doCreatureAddMana(cid, -Trans[i].addKi, false)
                        return true
                    else
                        doPlayerSendCancel(cid, "You do not have enough health or ki.")
                        doSendMagicEffect(getCreaturePosition(cid), 2)
                        return true
                    end
                else
                    --doPlayerSendCancel(cid, "You cannot revert.")
                    --doSendMagicEffect(getCreaturePosition(cid), 2)
                    return true
                end
            end
        end

    doPlayerSendCancel(cid, "You cannot revert.")
    doSendMagicEffect(getCreaturePosition(cid), 2)
    return true
end



globalevents.xml
XML:
<globalevent name="TransformEffects" interval="2" event="script" value="TransformEffects.lua"/>

TransformEffects.lua
Lua:
function onThink(interval, lastExecution, thinkInterval)
local players = {}
for _, i in pairs(getPlayersOnline()) do
    table.insert(players, i)
end
-------------

    for k, v in pairs(players) do
        for i = 1, #Trans do
            if (Trans[i].newVoc == getPlayerVocation(v)) then
                    if Trans[i].aura > 0 then
                        doSendMagicEffect(getCreaturePosition(v), Trans[i].aura)
                    end
             
                    doPlayerAddMana(v, -20, false)
            end
        end
 
    end
return true
end
Also you can use this modification instead of mine globalevent.
Script is not very advanced, wrote it some time ago.
That `if/if/if/if/if` ladder looks really bad ^^

Thats all, you dont have to modify anything in code, but if you want to...
Tested on TFS 0.3.6pl1

Post any bugs/suggestions :)

Greetings,
Erexo.
 
isnt work on tfs 3.5.0 ;( transform work but when i logout health dont delete
 
I suggest to make 1.x version of this script because this may be one of most useful scripts. Every db/naruto server is based on transform script!
 
Code:
 Trans = {
- Goku przekształca się
{[„Voc”] = 1, [„newVoc”] = 2, [looktype ”] = 5, [„ revertLooktype ”] = 4, [„ level ”] = 50, [„ rage ”] = 3, [ „KiToTrans”] = 10, [„addHp”] = 200, [„addKi”] = 150, [„effectOn”] = 236, [„aura”] = 0, [„stały”] = false},
{[„Voc”] = 2, [„newVoc”] = 3, [looktype ”] = 6, [„ revertLooktype ”] = 5, [„ level ”] = 130, [„ rage ”] = 5, [ „KiToTrans”] = 50, [„addHp”] = 450, [„addKi”] = 300, [„effectOn”] = 236, [„aura”] = 0, [„stały”] = false},
{[„Voc”] = 3, [„newVoc”] = 4, [looktype ”] = 7, [„ revertLooktype ”] = 6, [„ level ”] = 180, [„ rage ”] = 8, [ „KiToTrans”] = 100, [„addHp”] = 1600, [„addKi”] = 900, [„effectOn”] = 236, [„aura”] = 104, [„stały”] = false},
{[„Voc”] = 4, [„newVoc”] = 5, [looktype ”] = 8, [„ revertLooktype ”] = 7, [„ level ”] = 270, [„ rage ”] = 12, [ „KiToTrans”] = 150, [„addHp”] = 2900, [„addKi”] = 2700, [„effectOn”] = 236, [„aura”] = 104, [„stały”] = false},
{[„Voc”] = 5, [„newVoc”] = 6, [„looktype”] = 10, [„revertLooktype”] = 8, [„level”] = 350, [„rage”] = 15, [ „KiToTrans”] = 200, [„addHp”] = 4000, [„addKi”] = 4000, [„effectOn”] = 236, [„aura”] = 105, [„stały”] = false}
} \
 [/ CODE]

gdzie to wkleić czy utworzyć nowy plik w lib? where to paste or create a new file in lib?
 
Last edited:
Love that one, but i got a problem with looktype. When my char transform from voc1 looktype 1 (for example) to voc5 looktype5 and relog, then voc is still 5, but looktype back to 1
 
Back
Top