BLUJAY_LETHAL_MODS-LuckyLotteryTicket icon

LuckyLotteryTicket

A rare, scratchable lottery ticket scrap item. Scratch it for a chance at a payout, then survive and sell it at the Company building.

Last updated 3 hours ago
Total downloads 14
Total rating 0 
Categories Mods Server-side Items
Dependency string BLUJAY_LETHAL_MODS-LuckyLotteryTicket-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305
Evaisa-LethalLib-1.2.0 icon
Evaisa-LethalLib

Personal modding tools for Lethal Company

Preferred version: 1.2.0

README

Lucky Lottery Ticket

A small, vanilla-feeling gambling scrap item for Lethal Company (V81).

The Lucky Lottery Ticket spawns rarely as scrap. You can sell it as-is for a few credits, or scratch it for a chance at a much bigger payout. The catch: scratching only reveals the prize and changes the ticket's scrap value — you still have to survive and sell it at the Company building to actually get paid.

Built as a real BepInEx + LethalLib mod with Unity Netcode multiplayer syncing, structured so more custom items can be added later.


How it plays

  1. Find a Lucky Lottery Ticket in the scrap on a moon.
  2. (Optional) While holding it, press Use to scratch it.
    • Any player can scratch.
    • There's a short delay (default 2.5s), then the prize is revealed.
    • The host decides the prize, once. The result is synced to everyone.
    • The ticket's scrap value becomes the prize amount. It can't be scratched again.
  3. Carry the ticket back and sell it at the Company to collect the credits.

Scratching never gives you credits directly. An unsold scratched ticket is worth nothing until it's sold.

Default prize table

Chance Payout
50% $0
20% $25
10% $50
7% $100
5% $250
4% $500
3% $1000
1% $5000

An unscratched ticket is worth about $10–15 (configurable; like all scrap, the shown value is scaled by the moon's scrap multiplier).


Requirements

Install with a mod manager (r2modman / Thunderstore Mod Manager) and these are pulled in automatically.


Installation (players)

Use a mod manager and install the package, or manually:

  1. Install BepInEx + LethalLib.
  2. Copy LuckyLotteryTicket.dll and the lotteryticket asset bundle into BepInEx/plugins/ (a subfolder is fine).
  3. Launch the game. All players in a lobby should have the mod installed.

Multiplayer

  • Any player can scratch a ticket.
  • Only the host/server rolls the result (using the host's config), so the prize can't be tampered with by clients and payouts can't be duplicated.
  • The result and the new scrap value are synced to all clients via NetworkVariables, so they also reach players who join after a ticket was scratched.
  • A scratched ticket keeps its result/value if it's dropped, picked up by someone else, or carried between rounds.
  • Client config only affects that player's local display (sounds, whether they see other players' results). Spawn weight, value, odds and payouts come from the host.

Configuration

Config file: BepInEx/config/YourName.LuckyLotteryTicket.cfg (generated on first run).

Section Key Default What it does
Spawning SpawnWeight 15 Spawn weight relative to other scrap (higher = more common).
Unscratched Value MinValue / MaxValue 12 / 18 Raw scrap value range of an unscratched ticket (before moon scaling).
Scratch ScratchDurationSeconds 2.5 Delay before the prize is revealed.
Polish EnableSounds true Play the scratch sound (local).
Polish EnableJackpotAnnouncement true Show the big jackpot banner to everyone.
Polish AnnounceWinsToAll false Announce normal wins to all players, or just the scratcher.
Polish JackpotThreshold 5000 Prize at/above this triggers the jackpot banner.
Prize Table Tier1..8.Amount 0/25/50/100/250/500/1000/5000 Payout per tier.
Prize Table Tier1..8.Chance 50/20/10/7/5/4/3/1 Relative weight per tier (don't have to sum to 100).

Building from source

See docs/BUILDING.md for the full setup (install the .NET SDK, drop LethalLib.dll into libs/, then dotnet build).

The mod needs a Unity asset bundle (the ticket's model + Item asset) that can't be generated from C# alone. See docs/ASSETS.md for the step-by-step Unity guide. Until the bundle exists the plugin still loads and logs — it just won't register the item.


Project structure

LuckyLotteryTicket/
  src/
    Plugin.cs              # BepInEx entry point (loads config, assets, netcode, items)
    PluginInfo.cs          # GUID / name / version constants
    Config/
      LotteryConfig.cs     # BepInEx config -> shared settings
    Items/
      LotterySettings.cs   # plain shared settings (also used inside Unity)
      LotteryTicketItem.cs # the item behaviour + multiplayer logic (also used inside Unity)
    Registry/
      ItemRegistry.cs      # LethalLib registration (add future items here)
    Assets/
      Bundles.cs           # asset bundle loader
  assets/                  # put the built `lotteryticket` bundle here (+ deployed)
  thunderstore/            # Thunderstore packaging (manifest/icon/readme + tcli config)
  docs/                    # BUILDING.md, ASSETS.md
  libs/                    # local LethalLib.dll (you download this; not redistributed)
  manifest.json            # Thunderstore manifest
  icon.png                 # 256x256 package icon (placeholder included)
  CHANGELOG.md
  README.md

Adding more items later

The structure is built to grow. To add e.g. a Security Keycard, Hard Drive, Company Credit Card, Coffee, or Scanner Drone:

  1. Build its prefab + Item asset into the same Unity asset bundle.
  2. (If it has custom behaviour) add a GrabbableObject subclass in src/Items/.
  3. Add a Register...() call in src/Registry/ItemRegistry.cs.

ItemRegistry.LoadAndPrepare(...) already handles the repetitive wiring (load → fix mixer → register network prefab).