• 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 problem (TFS 1.2)

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
914
Solutions
2
Reaction score
50
Hi so this is system is made by "Itutorial" all credits for him. But this system have one big problem so. When you transform and revert, then quickly log out and log in again, you are the transformed version but with reduced health and mana, so you can't transform, you can only revert but since you already have reduced health reverting again will kill you.

Systems
global
LUA:
exhaust_transform = {}

transform = {
[1] = {voc = 1, newVoc = 5, from_looktype = 2, looktype = 3, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = 79, aura = nil, constant = false}
}
transform.lua
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("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
    if player:getMana() < TRANS.mana then
        player:sendCancelMessage("You need "..TRANS.mana.." to transform.")
        return false
    end

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

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

    player:addSoul(-TRANS.rage)
    player:setMaxHealth(player:getMaxHealth() + TRANS.addHealth)
    player:setMaxMana(player:getMaxMana() + TRANS.addMana)
    kurwa_gdzie_jest_efekt:sendMagicEffect(TRANS.effect)
    player:setVocation(TRANS.newVoc)
    player:save()
    return false
end
revert.lua
LUA:
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() - 4]

    if not TRANS then
    player:sendCancelMessage("You cannot revert.")
    return false
    end

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

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

    exhaust_transform[pid] = 1
    player:setMaxHealth(player:getMaxHealth() - TRANS.addHealth)
    player:setMaxMana(player:getMaxMana() - TRANS.addMana)
    player:setVocation(TRANS.voc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return false
end
function removeExhaust(pid)
    exhaust_transform[pid] = nil
end
effect lua
LUA:
function onThink(interval)
    local players = Game.getPlayers()
    for i, v in ipairs(players) do
        player = Player(v)
        if player then
            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
 
Last edited by a moderator:
It's necessary to create transform item and add to movement some lines.

movements/movements.xml

<movevent event="Equip" itemid="1" slot="hand" level="1" function="onEquipItem" />
<movevent event="DeEquip" itemid="1" slot="hand" function="onDeEquipItem" />

______

revert.lua
on line 29 minimalize exhausted 1*100 v 1*1000
 
It's necessary to create transform item and add to movement some lines.

movements/movements.xml

<movevent event="Equip" itemid="1" slot="hand" level="1" function="onEquipItem" />
<movevent event="DeEquip" itemid="1" slot="hand" function="onDeEquipItem" />

______

revert.lua
on line 29 minimalize exhausted 1*100 v 1*1000
its necessary to create transform item? Wait what? so why Itutorial didn't told me that?
 
He simply forgot. About theme, what version of client?

You got to new , you use to to new version.


I check on some engine thats sys
 
Ended offtop.

one solution: try on another distro.

"Systems
global" -to trash sentences. Zero localization
I'm not sure what are u talking about. "try on another distro" "global is trash" what? Or my English is really bad so i cant understand u, or it's opposite. So i think you cant help me with this problem.
 

Similar threads

Back
Top