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

CreatureEvent [TFS 1.1] Advanced Alchemy System - ModalWindows

yeah, just remove that line. Not sure why that's even in there, that's not supposed to be part of my system xD I'll remove it
 
yeah, just remove that line. Not sure why that's even in there, that's not supposed to be part of my system xD I'll remove it

i did and now.. with print(thing)
Code:
nil

Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onLookInTrade
data/events/scripts/player.lua:112: attempt to index global 'thing' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/events/scripts/player.lua:112: in function <data/events/scripts/player.lua:108>

Code:
112        if thing:getId() == 2006 then
113                local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111}
 
Last edited:
Ugh. I don't know how all this stuff got missed o.o I must have been half asleep when I posted this xD
This is what your onLookInTrade should actually look like.
Code:
local description = "You see " .. item:getDescription(distance)
    local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
    if item:getId() == 2006 then
        local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
        if isInArray(fluidType, item:getFluidType()) then
            local effects = item:getEffects(item)
            if effects[6] == 1 then
                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
            elseif effects[6] == 2 then
                description = "You see a " .. effects[5] .. ".\n" .. item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
            end
        end
    end
    for i = 1, #aingredients do
        if item:getId() == aingredients[i].id then
            description = "You see " .. item:getDescription(distance) .. "\nEffects:\n1: " 
            if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                description = description .. aeffects[aingredients[i].effects[1]].fullname
            else
                description = description .. "Unknown" 
            end
            description = description .. "\n2: "
            if self:getStorageValue(aingredients[i].storages[2]) == 1 then
                description = description .. aeffects[aingredients[i].effects[2]].fullname
            else
                description = description .. "Unknown" 
            end
        end
    end
   self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. description)
I'll update the main post. :p
 
Thanks for making the changes :D mistakes happens :D
More tests made and appear thats 100% bug free now :D

Thanks once again man :D
 
Code:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
        if thing:getId() == 2006 then
                local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
                if isInArray(fluidType, thing:getFluidType()) then
                        local effects = thing:getEffects(thing)
                        if effects[6] == 1 then
                                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        elseif effects[6] == 2 then
                                description = "You see a " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        end
                end
        end
        for i = 1, #aingredients do
                if thing:getId() == aingredients[i].id then
                        description = "You see " .. thing:getDescription(distance) .. "\nEffects:\n1: "
                        if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[1]].fullname
                        else
                                description = description .. "Unknown"
                        end
                        description = description .. "\n2: "
                        if self:getStorageValue(aingredients[i].storages[2]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[2]].fullname
                        else
                                description = description .. "Unknown"
                        end
                end
        end
 
Code:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
        if thing:getId() == 2006 then
                local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
                if isInArray(fluidType, thing:getFluidType()) then
                        local effects = thing:getEffects(thing)
                        if effects[6] == 1 then
                                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        elseif effects[6] == 2 then
                                description = "You see a " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        end
                end
        end
        for i = 1, #aingredients do
                if thing:getId() == aingredients[i].id then
                        description = "You see " .. thing:getDescription(distance) .. "\nEffects:\n1: "
                        if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[1]].fullname
                        else
                                description = description .. "Unknown"
                        end
                        description = description .. "\n2: "
                        if self:getStorageValue(aingredients[i].storages[2]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[2]].fullname
                        else
                                description = description .. "Unknown"
                        end
                end
        end
And what occurs in game when you look at an item, post a pic or something.
 
idk how to post a pic but this is what it does
15:32 You see a Strong Potion of Restore Health.
Potency: 3
Health: 160a vial of unknown.
It weighs 1.80 oz.
Potency: 3
Health: 160
Item ID: 2006.
Position: 32351, 32225, 4
 
Code:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
        if thing:getId() == 2006 then
                local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
                if isInArray(fluidType, thing:getFluidType()) then
                        local effects = thing:getEffects(thing)
                        if effects[6] == 1 then
                                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        elseif effects[6] == 2 then
                                description = "You see a " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        end
                end
        end
        for i = 1, #aingredients do
                if thing:getId() == aingredients[i].id then
                        description = "You see " .. thing:getDescription(distance) .. "\nEffects:\n1: "
                        if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[1]].fullname
                        else
                                description = description .. "Unknown"
                        end
                end
        end
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    else
        description = description .. thing:getDescription(distance)
    end

    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)

            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end

            description = description .. '.'
            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end

        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
    local description = 'You see ' .. creature:getDescription(distance)
    if self:getGroup():getAccess() then
        local str = '%s\nHealth: %d / %d'
        if creature:getMaxMana() > 0 then
            str = string.format('%s, Mana: %d / %d', str, creature:getMana(), creature:getMaxMana())
        end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. '.'

        local position = creature:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if creature:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInTrade(partner, item, distance)
local description = "You see " .. item:getDescription(distance)
    local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
    if item:getId() == 2006 then
        local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
        if isInArray(fluidType, item:getFluidType()) then
            local effects = item:getEffects(item)
            if effects[6] == 1 then
                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
            elseif effects[6] == 2 then
                description = "You see a " .. effects[5] .. ".\n" .. item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
            end
        end
    end
    for i = 1, #aingredients do
        if item:getId() == aingredients[i].id then
            description = "You see " .. item:getDescription(distance) .. "\nEffects:\n1: "
            if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                description = description .. aeffects[aingredients[i].effects[1]].fullname
            else
                description = description .. "Unknown"
            end
            description = description .. "\n2: "
            if self:getStorageValue(aingredients[i].storages[2]) == 1 then
                description = description .. aeffects[aingredients[i].effects[2]].fullname
            else
                description = description .. "Unknown"
            end
        end
    end
   self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. description)
end

function Player:onLookInShop(itemType, count)
    return true
end
 
I'd say it's this part right here.
Code:
if thing:isItem() then
if thing.actionid == 5640 then
description = description .. 'a honeyflower patch.'
elseif thing.actionid == 5641 then
description = description .. 'a banana palm.'
else
description = description .. thing:getDescription(distance)
end
else
description = description .. thing:getDescription(distance)
end
The first else statement is adding the actual item info to the end of the existing one.
change it to

EDIT: change it to this instead, to prevent non-potion vials from breaking
Code:
if thing:isItem() then
    if thing.actionid == 5640 then
        description = description .. 'a honeyflower patch.'
    elseif thing.actionid == 5641 then
        description = description .. 'a banana palm.'
    else
        if thing.itemid ~= 2006 or thing:getSubType() < 36 then
            description = description .. thing:getDescription(distance)
        end
    end
else
    description = description .. thing:getDescription(distance)
end
 
I'd say it's this part right here.
Code:
if thing:isItem() then
if thing.actionid == 5640 then
description = description .. 'a honeyflower patch.'
elseif thing.actionid == 5641 then
description = description .. 'a banana palm.'
else
description = description .. thing:getDescription(distance)
end
else
description = description .. thing:getDescription(distance)
end
The first else statement is adding the actual item info to the end of the existing one.
change it to

EDIT: change it to this instead, to prevent non-potion vials from breaking
Code:
if thing:isItem() then
    if thing.actionid == 5640 then
        description = description .. 'a honeyflower patch.'
    elseif thing.actionid == 5641 then
        description = description .. 'a banana palm.'
    else
        if thing.itemid ~= 2006 or thing:getSubType() < 36 then
            description = description .. thing:getDescription(distance)
        end
    end
else
    description = description .. thing:getDescription(distance)
end
perfect thanks alot
 
How is the part in player.lua ... OnLook ..I'm using orts data pack, have anothers things here
Code:
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    else
        description = description .. thing:getDescription(distance)
    end
Where I put the code to work ?
edit: solved. my bad
Code:
local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            local numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
            if thing:getId() == 2006 then
                local fluidType = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
                if isInArray(fluidType, thing:getFluidType()) then
                        local effects = thing:getEffects(thing)
                        if effects[6] == 1 then
                                description = "You see a " .. apotency[tonumber(effects[4])].prefix .. " " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        elseif effects[6] == 2 then
                                description = "You see a " .. effects[5] .. ".\n" .. thing:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                        end
                end
            end
            for i = 1, #aingredients do
                if thing:getId() == aingredients[i].id then
                        description = "You see " .. thing:getDescription(distance) .. "\nEffects:\n1: "
                        if self:getStorageValue(aingredients[i].storages[1]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[1]].fullname
                        else
                                description = description .. "Unknown"
                        end
                        description = description .. "\n2: "
                        if self:getStorageValue(aingredients[i].storages[2]) == 1 then
                                description = description .. aeffects[aingredients[i].effects[2]].fullname
                        else
                                description = description .. "Unknown"
                        end
                end
            end
        end
    else
        description = description .. thing:getDescription(distance)
    end
 
Last edited:
Alright so the bug I found is:

You may add an ingredient to the bowl, then exit out of the window, drop the item on the ground, go back into the window and then it will still be "in the bowl*" and useable without actually being removed from existence.

* - Upon entering the window again, the quantity will have changed from ( 1), to (-1)
 
Last edited:
Alright so the bug I found is:

You may add an ingredient to the bowl, then exit out of the window, drop the item on the ground, go back into the window and then it will still be "in the bowl*" and useable without actually being removed from existence.

* - Upon entering the window again, the quantity will have changed from ( 1), to (-1)
Any news on that?
 
Back
Top