• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Chameleon rune error TFS 1.5 downgrade 8.6

Azerty

Member
Joined
Apr 15, 2022
Messages
57
Solutions
2
Reaction score
5
Good morning. When I use chameleon rune and logout and login (CTRL+G), the time of the spell performed by the rune does not end, forcing the player to change their outfit to stop the bug. Can anybody help me?

Chameleon.lua:
Lua:
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(200000)

function onCastSpell(creature, variant, isHotkey)
    local position, item = variant:getPosition()
    if position.x == CONTAINER_POSITION then
        local container = creature:getContainerById(position.y - 64)
        if container then
            item = container:getItem(position.z)
        else
            item = creature:getSlotItem(position.y)
        end
    else
        item = Tile(position):getTopDownItem()
    end

    if not item or item.itemid == 0 or not isMoveable(item.uid) then
        creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    condition:setOutfit({lookTypeEx = item.itemid})
    creature:addCondition(condition)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
end
 
Solution
In the normal tfs 1.5 works and in the downgrade no?
I redownloaded TFS 1.5 downgrade 8.6 and it worked, however on my server it doesn't. So the problem is in some file inside the data folder
Post automatically merged:

In the normal tfs 1.5 works and in the downgrade no?
I found the error! How angry I am!!! In my login.lua there is a line like this:
Lua:
player:setOutfit(player:getOutfit())
I don't know what this is for =/

abdala ragab

Banned User
Joined
Aug 18, 2018
Messages
308
Solutions
10
Reaction score
272
Good morning. When I use chameleon rune and logout and login (CTRL+G), the time of the spell performed by the rune does not end, forcing the player to change their outfit to stop the bug. Can anybody help me?

Chameleon.lua:
Lua:
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(200000)

function onCastSpell(creature, variant, isHotkey)
    local position, item = variant:getPosition()
    if position.x == CONTAINER_POSITION then
        local container = creature:getContainerById(position.y - 64)
        if container then
            item = container:getItem(position.z)
        else
            item = creature:getSlotItem(position.y)
        end
    else
        item = Tile(position):getTopDownItem()
    end

    if not item or item.itemid == 0 or not isMoveable(item.uid) then
        creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    condition:setOutfit({lookTypeEx = item.itemid})
    creature:addCondition(condition)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
end
Lua:
<rune name="Chameleon" id="2291" charges="1" maglv="4" exhaustion="1000" enabled="1" function="chameleon"></rune>
put it in spells xml
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
57
Solutions
2
Reaction score
5
Working on 7.72, have you changed anything about this rune?
I didn't change anything
Post automatically merged:

Working on 7.72, have you changed anything about this rune?

I tested here 7.72 and it didn't really work. The error is in the source! Does anyone know where I can locate this function in the source?
 
Last edited:

mano368

Well-Known Member
Joined
Sep 2, 2011
Messages
210
Solutions
25
Reaction score
84
Location
Brazil
I didn't change anything
Post automatically merged:



I tested here 7.72 and it didn't really work. The error is in the source! Does anyone know where I can locate this function in the source?
What? In what item are you using the rune ?
 

mano368

Well-Known Member
Joined
Sep 2, 2011
Messages
210
Solutions
25
Reaction score
84
Location
Brazil
I tried using it on various items, Dwarven Shield, Spear, SD rune, Gold... I believe it doesn't matter
the problem is when using the rune in your inventory, it returns the rune as an outfit, and there is also a bug related to using it on backpack items, and items that are on the map there is no problem, I'll see what I solve and if successful, post the solution in case no one does it before
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
57
Solutions
2
Reaction score
5
the problem is when using the rune in your inventory, it returns the rune as an outfit, and there is also a bug related to using it on backpack items, and items that are on the map there is no problem, I'll see what I solve and if successful, post the solution in case no one does it before
Well, testing again here, I downloaded TFS 1.5 again and it worked, but I tested it again on my server and it didn't work. Now I believe the problem is in some file inside the data folder, but I can't find which one =/
 

mano368

Well-Known Member
Joined
Sep 2, 2011
Messages
210
Solutions
25
Reaction score
84
Location
Brazil
Well, testing again here, I downloaded TFS 1.5 again and it worked, but I tested it again on my server and it didn't work. Now I believe the problem is in some file inside the data folder, but I can't find which one =/
In the normal tfs 1.5 works and in the downgrade no?
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
57
Solutions
2
Reaction score
5
In the normal tfs 1.5 works and in the downgrade no?
I redownloaded TFS 1.5 downgrade 8.6 and it worked, however on my server it doesn't. So the problem is in some file inside the data folder
Post automatically merged:

In the normal tfs 1.5 works and in the downgrade no?
I found the error! How angry I am!!! In my login.lua there is a line like this:
Lua:
player:setOutfit(player:getOutfit())
I don't know what this is for =/
 
Last edited:
Solution

mano368

Well-Known Member
Joined
Sep 2, 2011
Messages
210
Solutions
25
Reaction score
84
Location
Brazil
I redownloaded TFS 1.5 downgrade 8.6 and it worked, however on my server it doesn't. So the problem is in some file inside the data folder
Post automatically merged:


I found the error! How angry I am!!! In my login.lua there is a line like this:
Lua:
player:setOutfit(player:getOutfit())
I don't know what this is for =/
Wait, they use the same script(7.72 and 8.6), in downgrade 8.6 you can use rune in your inventory and in items inside your backpack without problem? Here i cant use the rune in the inventory when the backpack is open, if i try to use, the spell return the first item in the backpack as outfit and not for exemple my sword, armor, legs...

Lua:
local container = creature:getContainerById(position.y - 64)
  if container then
   print(container)
   item = container:getItem(position.z)
  else
   item = creature:getSlotItem(position.y)
  end

"If container then" from the script is returning "if the backpack" is open, I don't know if it should work like this or return "if the item is inside the backpack" anyway, whenever you use the rune in your inventory with the backpack open (whether you equip it or not, the important thing is to be open) it will always return the first result of the script [item = container:getItem(position.z)] and apply the outfit of the first item inside the backpack instead of returning the item you used the rune on (example: your sword, a katana)

And if you use the rune in your inventory with all backpacks closed, then the script will return [item = creature:getSlotItem(position.y)] and apply the outfit correctly
 
Last edited:
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
57
Solutions
2
Reaction score
5
Wait, they use the same script(7.72 and 8.6), in downgrade 8.6 you can use rune in your inventory and in items inside your backpack without problem? Here i cant use the rune in the inventory when the backpack is open, if i try to use, the spell return the first item in the backpack as outfit and not for exemple my sword, armor, legs...

Lua:
local container = creature:getContainerById(position.y - 64)
  if container then
   print(container)
   item = container:getItem(position.z)
  else
   item = creature:getSlotItem(position.y)
  end

"If container then" from the script is returning "if the backpack" is open, I don't know if it should work like this or return "if the item is inside the backpack" anyway, whenever you use the rune in your inventory with the backpack open (whether you equip it or not, the important thing is to be open) it will always return the first result of the script [item = container:getItem(position.z)] and apply the outfit of the first item inside the backpack instead of returning the item you used the rune on (example: your sword, a katana)

And if you use the rune in your inventory with all backpacks closed, then the script will return [item = creature:getSlotItem(position.y)] and apply the outfit correctly
Well, in that regard it is working correctly. The problem was the line I found in my login.lua that I don't know what it's for. I have now commented out the line and will wait for an error regarding this. Thank you so much for the help, it encouraged me not to give up. Thank you bro!
 
Top