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

Fixing transform effect position.

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hi
i have problem with transform effect position, it look like this
Untitled.png

And should look like this
Untitled1.png

Transform.lua
Code:
function onSay(player, words, param)
    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)
    player:getPosition():sendMagicEffect(TRANS.effect)
    player:setVocation(TRANS.newVoc)
    player:save()
    return false
end
I'm pretty sure that i have to edit getPosition, but i'm thinking, what if i in future will want to make transform effect that takes 32x32 so it will be fucked up again because now my effect take x128 i think. So what you think guys?
 
Solution
Code:
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...
I was wondering is it possible to put in transform.lua as suck think as variable chech something like if(somethinghere == there is vocation id)
{
/* there apply sendmagiceffect with correct position
}
and if in future i'll want to make effect with 32x32 i create another variable chech with different correct position. Tell me is it possible and how can i make it :D
 
Last edited:
I dunno which part you need help with, so I'm just going to assume you need the effect position modified still.

in 0.3.7 I'd do it like this. (TFS 1.x should be the same, but with TFS 1.x functions/scripting style)
Code:
local pos = getCreaturePosition(uid)
new_pos = {x = pos.x + 1, y = pos.y, z = pos.z}
 
I dunno which part you need help with, so I'm just going to assume you need the effect position modified still.

in 0.3.7 I'd do it like this. (TFS 1.x should be the same, but with TFS 1.x functions/scripting style)
Code:
local pos = getCreaturePosition(uid)
new_pos = {x = pos.x + 1, y = pos.y, z = pos.z}
Correct part is this one player:getPosition():sendMagicEffect(TRANS.effect)
Probably my tfs do not support your script because console send me errors.
 
¿?
What i mean is: where is that in your script? There is no magic effect in the script
In globalevents
Code:
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
You mean this?
 
In globalevents
Code:
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
You mean this?
I guess...

You should store the position, then add 1 to pos.x, then send the magic Effect (As xikini said)
 
I guess...

You should store the position, then add 1 to pos.x, then send the magic Effect (As xikini said)
Yea i though about this but what if other vocations use different size of effect like example now it take 3 squares and other vocation use effect that take only 1 square, so that mean it will be glitched up again. Or am i wrong?
 
That's really nothing we can help with..
But if you have a way of verifying/knowing the effect size before hand, and know when that effect would be used, you could just do something like below..

Code:
if vocation == 1 then
    send_effect 1
elseif vocation == 2 then
    send_effect 2
end
If it's a massive list.. I guess I'd suggest using a table instead of endless elseif's
 
If it is happening in different vocations, you should only fix the ones which are wrong.
You dont understand me. Look at code
player:getPosition():sendMagicEffect(TRANS.aura)
It's impossible to apply same effect position for different effect resolution. Imagine you have 2 voc one have three square effect other one square effect so lets fix for that three square, everything is okay, but wait now effect with one square is bugged so lets fix this one if i fix this one, three square effect will be bugged. It's same shit like ricochet. So that's why i need vocation check so it would work like this
if voc = 1,2,3,4 (three squares)
send effect with correct position
if voc = 5,6,7 (one square)
send effect with correct position
So tell me is it possible to make stuff like this
 
That's really nothing we can help with..
But if you have a way of verifying/knowing the effect size before hand, and know when that effect would be used, you could just do something like below..

Code:
if vocation == 1 then
    send_effect 1
elseif vocation == 2 then
    send_effect 2
end
If it's a massive list.. I guess I'd suggest using a table instead of endless elseif's
Lets go boys this is what i'm talking about. I'll try this one. P.s how do i need to make that table?
 
Something like this I guess.
Again, I don't know tfs 1.X functions.

Lua:
local effects_table = {
  [{1, 2}] = effect_1,
  [{3, 4}] = effect_2,
  [{5, 6}] = effect_3
--[vocation #'s] = effect
}

local vocation = getPlayerVocation(uid)
if isInArray(effects_table, vocation) then
  -- send effect 
end
 
Back
Top