SetPickpocketing
Switches pickpocketing between players on or off, with its rules.
On, the game’s “Rob” prompt shows on the bodies of players who are robbable and on NPC actors with pockets, and a thief’s ask is
checked and answered (see the group’s description). Off by default. Switching it off ends the sessions that run (the mode
hears "cancelled", reason "mode").
rules is a table, every key optional: range (metres the thief may stand from the body, 3, from 0.5 to 6; the game’s own reach
is about 2.4), cooldown (seconds before the same thief may rob the same player - or the same NPC actor - again, counted from
the start, 30; 0 = none, at most 3600),
max_items (stacks the pockets offer, 8, never more than 11), max_stack (the most of one class the pockets offer, 5,
at most 9999; a class that does not stack shows one tile per item), behind_only (the thief must stand within 70 degrees of
straight behind the victim, false: the game’s own roll already punishes the front), min_seconds (the shortest session that
may take anything, 2.5, at most 60), money (a player’s purse is in the pockets, as one entry, false), money_share (the
share of the purse that entry holds, 0.1, from 0 to 1), money_cap (the most it holds, in Groschen, 100, at most
6553.5), actors (an NPC actor with pockets can be robbed, true), deny (a list of item classes, item names or catalogue
categories that are never offered: {"Food", "dagger"}; it keeps at most 64 entries and drops empty and repeated ones). A
number that is not usable is the default. Without rules the earlier ones stay; a table without a key puts that key back to
its default.
A mode reload (ReloadGameMode) switches pickpocketing off again with the default rules (see the group’s description). The
world state key pocket is the server’s - this call writes it.
Syntax
Section titled “Syntax”SetPickpocketing(enabled [, rules])| Parameter | Type | |
|---|---|---|
enabled |
boolean | true shows the prompt and answers asks; false (the default) takes it away and ends running sessions |
rules |
table | {range, cooldown, max_items, max_stack, behind_only, min_seconds, money, money_share, money_cap, actors, deny} (optional) |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnGameModeInit() SetPickpocketing(true, {range = 2.5, cooldown = 60, max_items = 5, behind_only = true, money = true, money_share = 0.2, money_cap = 30})endSee also
Section titled “See also”GetPickpocketing · SetPlayerPickpocketable · SetPlayerCanPickpocket · SetActorPocket · OnPlayerPickpocketStart · the Pickpocketing group of the index
