Sly 2:Pickpocketing

From SlyMods
Jump to navigation Jump to search
Pickpocketing
Game Mechanic
GameSly 2: Band of Thieves

Pickpocketing guards in Sly 2 is a method of obtaining coins, as well as loot items which can be sold for coins in Thiefnet. Each guard can have been 2-4 pockets, with 2-3 pockets containing coins and 0-1 pockets with an item.

Loot table

Each guard type in the game has it’s own loot table, with some exceptions. The loot table contains the following information:

  • The minimum possible amount of coins the guard can have
  • The maximum possible amount of coins the guard can have
  • A percent chance that that guard will have an item
  • For each of 5 possible items the guard can have:
    • The odds of that item (out of the total odds for all 5 items)
    • The ID of that item

Pocket generation

When a guard is spawned, the game calls a function that populates the contents of each pocket.

Coins

The following algorithm is used to populate the coins in the guard’s pockets.

  1. Select a random number of coins between the min and max values from the loot table
  2. Select a random number of pockets between 2 and 3
  3. For each pocket:
    1. Divide the number of coins by the number of pockets
    2. Put that many coins in the pocket
    3. Move on to the next pocket, or stop if no coins are left

Items

The following algorithm is used to determine what item will be in the last pocket.

  1. Sum up the total odds for all items in the loot table
  2. Select a random value between 0 and the max odds
  3. For each item in the loot table:
    1. If the random value is greater than the current total odds, set the item to that item
    2. Otherwise, subtract that item’s odds from the total odds and move on

Although all the odds normally add up to 100, they can be anything. The odds of any one item appearing in a pocket is just the fraction of that item’s odds out of the total odds.

Editing pocket values

The values on the guard pocket can be modified to change the loot type (from coins to items or vice versa), or replace the item with an entity.

Gallery

See also