• 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?
 
Alot of unecessary calls in the 1st two scripts. Still have no idea what your asking help with.
I dont know how to explain it more detailed. Basically revert is function that goes back to first form. As example, lets say from
Code:
[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},
to vocation 1. So from 38 to 1 so this is what revert is. So my goal is to make some transforms that cant be reverted they always stays at the same form. Example: lets say there is 4 transforms like in my situation 50.100.150.200lvl so 50lv- can be revert, 100-cant be revert, 150-can be revert, 200-can be revert. So lets say you are 50lvl you can transform and revert at this point. So now lets say you are 200lvl you can revert but when you revert you go to 100lvl form. Well i dont know how to explain it more detailed its already obvious what i'm saying. Probably its pretty hard to understand when you never played in servers that have transform system.
 
Back
Top