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

How to change look distance for attribute description?

vexler222

Member
Joined
Apr 22, 2012
Messages
618
Solutions
13
Reaction score
23
How to change look distance for attribute description? Now i can read only from player pos + 1sqm, i want change it to 5sqm, but i don't see anything in srouces
I try change there from 1 to 5, but nothing happend and in events/default_onLook
this - local description = "You see " .. thing:getDescription(distance)
to - local description = "You see " .. thing:getDescription(5)

Code:
    if (lookDistance <= 5) {
        if (item) {
            const uint32_t weight = item->getWeight();
            if (weight != 0 && it.pickupable) {
                s << '\n' << getWeightDescription(it, weight, item->getItemCount());
            }
        } else if (it.weight != 0 && it.pickupable) {
            s << '\n' << getWeightDescription(it, it.weight);
        }
    }

    if (item) {
        const std::string& specialDescription = item->getSpecialDescription();
        if (!specialDescription.empty()) {
            s << '\n' << specialDescription;
        } else if (lookDistance <= 5 && !it.description.empty()) {
            s << '\n' << it.description;
        }
    } else if (lookDistance <= 5 && !it.description.empty()) {
        s << '\n' << it.description;
    }

    if (it.allowDistRead && it.id >= 7369 && it.id <= 7371) {
        if (!text && item) {
            text = &item->getText();
        }

        if (text && !text->empty()) {
            s << '\n' << *text;
        }
    }
    return s.str();
}
 
Solution
refresh
Post automatically merged:

Ok, i found it ;p
If someone needs it too, change to lib / core / item.lua - lookDistance <= 1, change 1 to your distance, from where the player can see the description
Code:
        if lookDistance <= 1 then
            local weight = obj:getWeight()
            local count = item and item:getCount() or 1
            if weight ~= 0 and it:isPickupable() then
                ss:append('\n')
                if it:isStackable() and count > 1 and it:hasShowCount() then
                    ss:append('They weigh ')
                else
                    ss:append('It weighs ')
                end
                ss:append('%.2f oz.', weight / 100)
            end
        end

        local desc = it:getDescription()...
OP
OP
vexler222

vexler222

Member
Joined
Apr 22, 2012
Messages
618
Solutions
13
Reaction score
23
refresh
Post automatically merged:

Ok, i found it ;p
If someone needs it too, change to lib / core / item.lua - lookDistance <= 1, change 1 to your distance, from where the player can see the description
Code:
        if lookDistance <= 1 then
            local weight = obj:getWeight()
            local count = item and item:getCount() or 1
            if weight ~= 0 and it:isPickupable() then
                ss:append('\n')
                if it:isStackable() and count > 1 and it:hasShowCount() then
                    ss:append('They weigh ')
                else
                    ss:append('It weighs ')
                end
                ss:append('%.2f oz.', weight / 100)
            end
        end

        local desc = it:getDescription()
        if item then
            local specialDesc = item:getSpecialDescription()
            if specialDesc ~= '' then
                ss:append('\n%s', specialDesc)
            elseif lookDistance <= 1 and desc ~= '' then
                ss:append('\n%s', desc)
            end
        elseif lookDistance <= 1 and desc ~= '' then
            ss:append('\n%s', it:getDescription())
        end

        if it:hasAllowDistRead() or (it:getId() >= 7369 and it:getId() <= 7371) then
            if not text and item then
                text = item:getText()
            end

            if text and text ~= '' then
                ss:append('\n%s', text)
            end
        end

        return ss:concat()
    end
 
Last edited:
Solution
Top