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

Need help to make transform system revertible and not revertible

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Hi
so i have full functioning transform system without any problems but it dont really have such think as not revertible transform now all transforms can be reverted to previous form. Technically this transform system is made by this system but updated to tfs 1.2 Transform system [table included]

So this is mine system
Lua:
exhaust_transform = {}

transform = {

[1] =  {transform = 0, fromVoc = 0, newVoc = 5,  from_looktype = 2, looktype = 3, level = 50,  rage = 3, addHealth = 200, addMana = 150, effect = 81, aura = nil, constant = false}, 
[5] =  {transform = 1, fromVoc = 1, newVoc = 36, from_looktype = 2, looktype = 5, level = 100, rage = 3, addHealth = 200, addMana = 150, effect = 79, aura = nil, constant = false}, 
[36] = {transform = 2, fromVoc = 5, newVoc = 37, from_looktype = 2, looktype = 4, level = 150, rage = 3, addHealth = 200, addMana = 150, effect = 80, aura = nil, constant = false},
[37] = {transform = 3, fromVoc = 36, newVoc = 38, from_looktype = 2, looktype = 7, level = 200, rage = 3, addHealth = 200, addMana = 150, effect = 78, aura = 107, constant = false},
[38] = {transform = 4, fromVoc = 37, newVoc = 0, from_looktype = 2, looktype = 5, level = 0,   rage = 0, addHealth = 0,   addMana = 0,   effect = 0,  aura = nil,  constant = false}, 

[2] =  {transform = 0, fromVoc = 0, newVoc = 39,  from_looktype = 22, looktype = 24, level = 50,  rage = 3, addHealth = 200, addMana = 150, effect = 79, aura = nil, constant = false},
[39] =  {transform = 1, fromVoc = 2, newVoc = 40,  from_looktype = 22, looktype = 20, level = 100,  rage = 3, addHealth = 200, addMana = 150, effect = 122, aura = nil, constant = false},
[40] =  {transform = 2, fromVoc = 39, newVoc = 41,  from_looktype = 22, looktype = 21, level = 150,  rage = 3, addHealth = 200, addMana = 150, effect = 80, aura = nil, constant = false},
[41] =  {transform = 3, fromVoc = 40, newVoc = 42,  from_looktype = 22, looktype = 19, level = 200,  rage = 3, addHealth = 200, addMana = 150, effect = 78, aura = 107, constant = false},
[42] = {transform = 4, fromVoc = 41, newVoc = 0, from_looktype = 2, looktype = 20, level = 0,   rage = 0, addHealth = 0,   addMana = 0,   effect = 0,  aura = nil,  constant = false}
}
So constant = false or true is what i'm talking about if its true you cant be reverted if its false you can revert. But in my situation is not even functioning it doesnt exist in my case but as you can see i still use it for no reason :D
Lua:
function onSay(player, words, param)
    local kurwa_gdzie_jest_efekt = Position(player:getPosition().x + 1, player:getPosition().y, player:getPosition().z)
    local pid = player:getId()

    local TRANS = transform[player:getVocation():getId()]
   
    if not TRANS then
        player:sendCancelMessage("TRANSFORM ERROR 11. Vocation = " .. player:getVocation():getId() .. "") -- VOCATION NOT IN GLOBAL TABLE
        return false
    end
   
    if TRANS.newVoc == 0 then
        player:sendCancelMessage("You cannot transform.")
        return false
    end
   
    if player:getLevel() < TRANS.level then
        player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.")
        return false
    end
    if player:getSoul() < TRANS.rage then
        player:sendCancelMessage("You need "..TRANS.rage.." to transform.")
        return false
    end

    local outfit = player:getOutfit()
    outfit.lookType = TRANS.looktype

    if TRANS.constant then
        player:setOutfit(outfit)
    else
        player:setOutfit(outfit, true)
    end

    player:addSoul(-TRANS.rage)
    player:setMaxHealth(player:getBaseMaxHealth() + TRANS.addHealth)
    player:setMaxMana(player:getBaseMaxMana() + TRANS.addMana)
    kurwa_gdzie_jest_efekt:sendMagicEffect(TRANS.effect)
    player:setVocation(TRANS.newVoc)
    player:save()
    return false
end
Lua:
local function removeExhaust(pid)
    exhaust_transform[pid] = nil
end

function onSay(player, words, param, channel)
    local pid = player:getId()
   
    if exhaust_transform[pid] ~= nil then
        return false
    end
   
    local TRANS = transform[player:getVocation():getId()]
   
    if not TRANS then
        player:sendCancelMessage("TRANSFORM ERROR 11. Vocation = " .. player:getVocation():getId() .. "") -- VOCATION NOT IN GLOBAL TABLE
        return false
    end
   
    if TRANS.fromVoc == 0 then
        player:sendCancelMessage("You cannot revert.")
        return false
    end

    for i = 1, TRANS.transform do
        player:setVocation(TRANS.fromVoc)
        TRANS = transform[player:getVocation():getId()]
        local outfit = player:getOutfit()
        outfit.lookType = TRANS.from_looktype
        if TRANS.constant then
            player:setOutfit(outfit)
        else
            player:setOutfit(outfit, false)
        end
        player:setMaxHealth(player:getBaseMaxHealth() - TRANS.addHealth)
        player:setMaxMana(player:getBaseMaxMana() - TRANS.addMana)
    end
    player:save()
   
    exhaust_transform[pid] = 1   
    addEvent(removeExhaust, 5 * 1000, pid)
    return false
end
this is transform effects
Lua:
function onThink(interval)
    local players = Game.getPlayers()
    for i, v in ipairs(players) do
        local player = Player(v)
        if player then
            --print(player:getVocation():getId())
            TRANS = transform[player:getVocation():getId()]
            if TRANS then
                if TRANS.aura ~= nil then
                    player:getPosition():sendMagicEffect(TRANS.aura)
                end
            end
        end
    end
    return true
end
So yea maybe someone can help me with this?
 
Fixed everything through TeamViewer :p
I don't know that henkas want to public it or not but MOD's can close thread cuz problem fixed.
 
solutions should always be posted, it's in the board rules
Taking best answer back. Transform/revert system is still not working. And it become even worst then before. But at least he made that you could not revert with transform but it has to much problems that i cant say its fixed. First problem is full of errors
Untitled.png

Second problem now you can bug health just by flooding "transform/revert". Whole table is fucked, especially with effect, even when effect is nil somehow you get effect from different section, then if you spam revert effect disappears but if you try to revert manually everything is fine but if you relog somehow shit starts to happen . If you make all transforms as revertible you just get error or it says you cant transform because you are not voc id 1 but in database it says you are id 1. So basically we still at the start so i can keep bumping this topic again for couple months.
 
post the script
Ok sir.
\data\lib\dragonball_systems\transforms/lua
Lua:
exhaust_transform = {}

transform = {
-- Goku
[1] =  {transform = 0, fromVoc = 0, newVoc = 5,  from_looktype = 2, looktype = 3, level = 50,  rage = 0, addHealth = 200, addMana = 150, effect = 81, aura = nil, constant = false}, --50Ll
[5] =  {transform = 1, fromVoc = 1, newVoc = 36, from_looktype = 2, looktype = 5, level = 100, rage = 0, addHealth = 200, addMana = 150, effect = 79, aura = nil, constant = false},  --100Lvl
[36] = {transform = 2, fromVoc = 5, newVoc = 37, from_looktype = 2, looktype = 4, level = 150, rage = 0, addHealth = 200, addMana = 150, effect = 80, aura = nil, constant = false}, --150Lvl
[37] = {transform = 3, fromVoc = 36, newVoc = 38, from_looktype = 2, looktype = 7, level = 200, rage = 0, addHealth = 200, addMana = 150, effect = 78, aura = 107, constant = false}, --200Lvl
[38] = {transform = 4, fromVoc = 37, newVoc = 0, from_looktype = 2, looktype = 7, level = 0,   rage = 0, addHealth = 0,   addMana = 0,   effect = 0,  aura = nil,  constant = false} --0Lvl
}

function Player.lostTransform(self)
    local TRANS = transform[self:getVocation():getId()]
    if not TRANS.constant then
        local outfit = self:getOutfit()
        outfit.lookType = TRANS.from_looktype
        self:setOutfit(outfit)
        self:setVocation(TRANS.fromVoc)
        self:setMaxHealth(self:getBaseMaxHealth() - TRANS.addHealth)
        self:setMaxMana(self:getBaseMaxHealth() - TRANS.addMana)
    end
end
\data\talkactions\scripts\transform.lua
Lua:
function onSay(player, words, param)
    local effectpos = Position(player:getPosition().x + 1, player:getPosition().y, player:getPosition().z)
    local pid = player:getId()

    local TRANS = transform[player:getVocation():getId()]
 
    if not TRANS then
        player:sendCancelMessage("TRANSFORM ERROR 11. Vocation = " .. player:getVocation():getId() .. "") -- VOCATION NOT IN GLOBAL TABLE
        return false
    end
 
    if TRANS.newVoc == 0 then
        player:sendCancelMessage("You cannot transform.")
        return false
    end
 
    if player:getLevel() < TRANS.level then
        player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.")
        return false
    end
    if player:getSoul() < TRANS.rage then
        player:sendCancelMessage("You need "..TRANS.rage.." to transform.")
        return false
    end

    local outfit = player:getOutfit()
    outfit.lookType = TRANS.looktype

    if TRANS.constant then
        player:setOutfit(outfit)
    else
        player:setOutfit(outfit, true)
    end

    player:addSoul(-TRANS.rage)
    player:setMaxHealth(player:getBaseMaxHealth() + TRANS.addHealth)
    player:setMaxMana(player:getBaseMaxHealth() + TRANS.addMana)
    effectpos:sendMagicEffect(TRANS.effect)
    player:setVocation(TRANS.newVoc)
    player:save()
 
    return false
end
\data\talkactions\scripts\revert.lua
Lua:
local function removeExhaust(pid)
    exhaust_transform[pid] = nil
end

function onSay(player, words, param, channel)
 
    local pid = player:getId()
    local TRANS = transform[player:getVocation():getId()]
 
    if not TRANS then
        player:sendCancelMessage("TRANSFORM ERROR 11. Vocation = " .. player:getVocation():getId() .. "") -- VOCATION NOT IN GLOBAL TABLE
        return false
    end
 
    if exhaust_transform[pid] ~= nil then
        return false
    end
 
    if TRANS.fromVoc == 0 then
        player:sendCancelMessage("You cannot revert.")
        return false
    end
 
    if TRANS.constant then
        player:sendCancelMessage("You cannot revert because you are on constant transform.")
        return false
    end
 
    for i = 1, #transform do
        player:lostTransform()
    end

return false
end
\data\globalevents\scripts\transformeffects.lua
Lua:
function onThink(interval)

    local players = Game.getPlayers()
    for i, v in ipairs(players) do
        local player = Player(v)
        local TRANS = transform[player:getVocation():getId()]
        if player then
            if (TRANS and TRANS.aura ~= nil) then
                    player:getPosition():sendMagicEffect(TRANS.aura)
            end
        end
    end
    return true
end
data\creaturescripts\scripts\login.lua
Lua:
function onLogin(player)
 
    -- Players with voc: 0 (None) have whole login.lua in ass.
    if player:getVocation():getId() == 0 then
    return true
    end
 
    local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ". Have fun!"
    else
        if loginStr ~= "" then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
    player:addHealth(player:getMaxHealth())

    -- Stamina
    nextUseStaminaTime[player.uid] = 0

    -- Transforms Outfit Changer and Revert back while you got logout
    -- Set lookType correctly when character have constant transform onLogin
    local TRANS = transform[player:getVocation():getId()]
    local outfit = player:getOutfit()
    outfit.lookType = TRANS.looktype
    if player:getVocation():getId() == TRANS then
        player:setOutfit(outfit)
    end
    if not TRANS.constant then
        player:lostTransform()
    end

    -- Events
    player:registerEvent("PlayerDeath")
    player:registerEvent("DropLoot")
    player:registerEvent("Tasks")
    player:registerEvent("KarinQuest")
    return true
end
/data/global.lua
Lua:
dofile('data/lib/dragonball_systems/transforms.lua')
I think thats it.
 
Back
Top