November 23, 2026, 12:47:22 am
Username:

Password:

Topic: How exactly does the sneak looting work?  (Read 4884 times)

Blarney

  • Posts: 317
    • View Profile
How exactly does the sneak looting work?
« on: December 20, 2015, 10:00:47 am »
This is really something I should already know  :facepalm, but from experience alone, the rate at which looting de-sneaks is very random.

Using the take all option seems to always desneak, but taking them one at a time or using the ctrl click will often leave you in stealth mode. Similarly picking items off the floor de-sneaks at a pretty random rate, with the same item sometimes desneaking and sometimes not..

So what exactly is the deal there, should looting desneak all the time, or is there a specific method that sneakers are supposed to utilised to loot while staying stealthed?

Slowhand

  • Posts: 282
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
Re: How exactly does the sneak looting work?
« Reply #1 on: December 20, 2015, 02:38:42 pm »
Studying the Reloaded source version 2:

Server\scripts\main.fos

Code: [Select]
bool critter_use_skill(Critter& cr, int skill, Critter@ targetCr, Item@ targetItem, Scenery@ targetScen)
{
...
    switch(skill)
    {
    case SKILL_PICK_ON_GROUND:     // Pick item or scenery on ground
    {
...
                MoveItem(item, 0, cr);
                if(cr.Mode[MODE_HIDE] != 0 && cr.GetAccess() < ACCESS_TESTER)
                {
                    int sk = cr.Skill[SK_STEAL] - 10 * GRAMM_TO_LBS(item.Proto.Weight * item.GetCount());
                    sk = CLAMP(sk, 5, 95);
                    if(sk < Random(1, 100))
                        cr.ModeBase[MODE_HIDE] = 0;
                }
...


It seems that picking up items from ground (or from container, etc) while sneaking will check for a steal roll (even if you don't use steal skill). Maybe you should try to level up ur steal skill a bit more, if you have problem taking items while sneaking.

Take all, will automatically desneak, that is another code part which I did not link, but you can find it urself since the source is published.

Blarney

  • Posts: 317
    • View Profile
Re: How exactly does the sneak looting work?
« Reply #2 on: December 20, 2015, 02:50:57 pm »
Thanks for that info Slowhand, I don't think I would have found that even if I searched the source, I'm not too great at finding specific details in large sections of code.

Interesting that it is linked to steal, that is a strange one. Not sure what to make of that.

Thanks again for the info.

mojuk

  • Posts: 332
    • View Profile
Re: How exactly does the sneak looting work?
« Reply #3 on: December 20, 2015, 02:54:16 pm »
Chance to desneak depends on action:

- Take/Put All items: 100%

- Pick All items: 100%

- Drop All items: 0%

- Moving one item in/out of the body: 50%

- Moving one item in/out of the container/ground:
Code: [Select]
if(target.Mode[MODE_HIDE] != 0 && target.GetAccess() < ACCESS_TESTER)
{
       int sk = target.Skill[SK_STEAL] - 10 * GRAMM_TO_LBS(itm.Proto.Weight * itm.GetCount());
       sk = CLAMP(sk, 5, 95);
       if(sk < Random(1, 100))
              target.ModeBase[MODE_HIDE] = 0;
}
---
#define GRAMM_TO_LBS        # (grm)       ((grm) / 453)
In human language it means:
Chance to desneak is calculated from your Steal skill -  weight of item you want to pick up:
chance_to_avoid = Steal_skill - 10 * ((item_weight * item_count) / 453)
chance_to_avoid is from range <5, 95>

So for example if you have 40 Steal skill and want to pick 150x 2mm ammo, with 1x 2mm weight being 8 you get:
chance_to_avoid = 40 - 10 * ((8 * 150) / 453) = 20%
((8 * 150) / 453) is rounded down before it gets multiplied by 10 so it's 10 * 2 not 10 * 2.649

Because of roll:
chance_to_avoid < random(1, 100) = desneak
that calculated 20% means 20% to avoid desneaking.
:facepalm

Slowhand

  • Posts: 282
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
Re: How exactly does the sneak looting work?
« Reply #4 on: December 20, 2015, 03:18:36 pm »
Thanks for that info Slowhand, I don't think I would have found that even if I searched the source, I'm not too great at finding specific details in large sections of code.

Interesting that it is linked to steal, that is a strange one. Not sure what to make of that.

Thanks again for the info.

I belive it was mentioned on the Wiki as well, that steal roll is checked in these cases, but, yeah, u r welcome. Also Mojuk was more accurate.

You should level stealing if you want to run around PvP zones sneaking to loot free and possibly heavy stuff!

Blarney

  • Posts: 317
    • View Profile
Re: How exactly does the sneak looting work?
« Reply #5 on: December 20, 2015, 03:25:50 pm »
Thanks for that info Slowhand, I don't think I would have found that even if I searched the source, I'm not too great at finding specific details in large sections of code.

Interesting that it is linked to steal, that is a strange one. Not sure what to make of that.

Thanks again for the info.

I belive it was mentioned on the Wiki as well, that steal roll is checked in these cases, but, yeah, u r welcome. Also Mojuk was more accurate.

You should level stealing if you want to run around PvP zones sneaking to loot free and possibly heavy stuff!

I had always figured it to be random, as the rate that it happened was very unpredictable.

In reality, while sneaking, I always wait until it is as safe as possible while looting anyway.

In pve terms, you can re-sneak in front of npcs before they even spot you if you have the AP for it, so it's never effected me that much, I was just curious about its unpredictability and failed to find the info myself.

Still good to know though :)