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

TFS 1.2 Transform System

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
870
Solutions
2
Reaction score
49
Hi i was searching around google and i found this transform system
Transform system [table included]
But i stuck with first part, he didn't included where should i create that lua
Code:
{["voc"] = 1, ["newVoc"] = 2, ["looktype"] = 5, ["revertLooktype"] = 4, ["level"] = 50, ["rage"] = 3, ["kiToTrans"] = 10, ["addHp"] = 200, ["addKi"] = 150, ["effectOn"] = 236, ["aura"] = 0, ["constant"] = false},
 
Solution
Global
Lua:
exhaust_transform = {}

transform = {
[1] = {voc = 1, newVoc = 5, from_looktype = 55, looktype = 99, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = CONST_ME_SMOKE, aura = nil, constant = false}
}

Tranform
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()]

    if not TRANS then return player:sendCancelMessage("You cannot transform.") end
    if player:getLevel() < TRANS.level then return player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.") end
    if player:getSoul() < TRANS.rage then return...
Okay, so I tested this and the only problem I had was the outfit wasn't changed correctly.View attachment 31399
NtSlf
So why it doesn't work with mine? Maybe i create new vocation wrong because i created only in vocations.xml?
 
What's your problem again?
If you still have that "You cannot transform." message, i would guess that you didn't edit your transform table. This part:
Lua:
exhaust_transform = {}
transform = {
[1] = {voc = 1, newVoc = 5, looktype = 99, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = CONST_ME_SMOKE, aura = nil, constant = false}
}

or
If it's problem with invisible outfit, then i'll suggest to read what @Static_ wrote earlier.
 
What's your problem again?
If you still have that "You cannot transform." message, i would guess that you didn't edit your transform table. This part:
Lua:
exhaust_transform = {}
transform = {
[1] = {voc = 1, newVoc = 5, looktype = 99, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = CONST_ME_SMOKE, aura = nil, constant = false}
}

or
If it's problem with invisible outfit, then i'll suggest to read what @Static_ wrote earlier.
It always says "You cannot transform" but i added in global
[C++] dofile('data/lib/lib.lua') STORAGEVALUE_PROMOTION = 30018 ropeSpots = {384 - Pastebin.com
 
Yeah, it's set up only for players with vocation id = 1. You gotta add more lines:
Lua:
[vocation id] = {voc = voc id, newVoc = voc id to transform, looktype = 99, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = CONST_ME_SMOKE, aura = nil, constant = false},
Yea i know i go to game with right vocation
Untitled.png

But it's still same
 
Replace talkactions with this.

Tranform
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()]

    if not TRANS then return player:sendCancelMessage("You cannot transform.") end
    if player:getLevel() < TRANS.level then return player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.") end
    if player:getSoul() < TRANS.rage then return player:sendCancelMessage("You need "..TRANS.rage.." to transform.") end
    if player:getMana() < TRANS.mana then return player:sendCancelMessage("You need "..TRANS.mana.." to transform.") end

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

    if TRANS.constant then
        player:setOutfit(outfit)
    else
        player:setOutfit(outfit, false)
    end
   
    exhaust_transform[pid] = 1
    player:addSoul(-TRANS.rage)
    player:setMaxHealth(TRANS.addHealth)
    player:setMaxMana(TRANS.mana)
    player:addHealth(TRANS.addHealth)
    player:addMana(TRANS.addMana)
    player:getPosition():sendMagicEffect(TRANS.effect)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have transformed!")
    player:setVocation(TRANS.newVoc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return true
end

function removeExhaust(pid)
    exhaust_transform[pid] = nil
end


revert
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() - 1]

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

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

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

    exhaust_transform[pid] = 1
    player:setMaxHealth(TRANS.addHealth)
    player:setMaxMana(TRANS.mana)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have reverted!")
    player:setVocation(TRANS.voc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return true
end

function removeExhaust(pid)
    exhaust_transform[pid] = nil
end
 
Replace talkactions with this.

Tranform
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()]

    if not TRANS then return player:sendCancelMessage("You cannot transform.") end
    if player:getLevel() < TRANS.level then return player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.") end
    if player:getSoul() < TRANS.rage then return player:sendCancelMessage("You need "..TRANS.rage.." to transform.") end
    if player:getMana() < TRANS.mana then return player:sendCancelMessage("You need "..TRANS.mana.." to transform.") end

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

    if TRANS.constant then
        player:setOutfit(outfit)
    else
        player:setOutfit(outfit, false)
    end
  
    exhaust_transform[pid] = 1
    player:addSoul(-TRANS.rage)
    player:setMaxHealth(TRANS.addHealth)
    player:setMaxMana(TRANS.mana)
    player:addHealth(TRANS.addHealth)
    player:addMana(TRANS.addMana)
    player:getPosition():sendMagicEffect(TRANS.effect)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have transformed!")
    player:setVocation(TRANS.newVoc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return true
end

function removeExhaust(pid)
    exhaust_transform[pid] = nil
end


revert
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() - 1]

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

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

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

    exhaust_transform[pid] = 1
    player:setMaxHealth(TRANS.addHealth)
    player:setMaxMana(TRANS.mana)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have reverted!")
    player:setVocation(TRANS.voc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return true
end

function removeExhaust(pid)
    exhaust_transform[pid] = nil
end
Yey transform now works fine, but revert don't it's says you cannot revert
 
How many vocations are in your server? is it like normal vocations: 1, 5, 9 ///// 2, 6, 10 ///// 3, 7, 11 ///// 4, 8, 12

I already deleted your server files
 
How many vocations are in your server? is it like normal vocations: 1, 5, 9 ///// 2, 6, 10 ///// 3, 7, 11 ///// 4, 8, 12

I already deleted your server files
Normal vocations are only 4// and one is transform so if we count transform as vocation there is 5.
 
Okay, assuming you set the vocation promotions up like this: 1, 5, 9 // 2, 6, 10 // 3, 7, 11 // 4, 8, 12 then this will work:

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 return player:sendCancelMessage("You cannot revert.") end

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

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

    exhaust_transform[pid] = 1
    player:setMaxHealth(TRANS.addHealth)
    player:setMaxMana(TRANS.mana)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have reverted!")
    player:setVocation(TRANS.voc)
    player:save()
    addEvent(removeExhaust, 5 * 1000, pid)
return true
end
 
Back
Top