You are viewing a potentially older version of this package. View all versions.
BLUJAY_LETHAL_MODS-LuckyLotteryTicket-1.1.0 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.

Date uploaded 5 days ago
Version 1.1.0
Download link BLUJAY_LETHAL_MODS-LuckyLotteryTicket-1.1.0.zip
Downloads 1182
Dependency string BLUJAY_LETHAL_MODS-LuckyLotteryTicket-1.1.0

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.

No Unity required. By default the ticket is built entirely in code, so the mod works with no asset bundle and no Unity install — the model is just a simple gold "card" placeholder. You can later swap in a custom 3D model via an optional asset bundle (see docs/ASSETS.md).


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
25% $25
25% $50
18% $100
12% $250
8% $500
5% $1,000
3% $2,500
2% $5,000
1.5% $10,000
0.5% $25,000

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 icon.png into BepInEx/plugins/LuckyLotteryTicket/. (If you built a custom-model lotteryticket bundle, put it there too — it's optional.)
  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.

Compatibility

Designed to play nice with scrap-management mods. In particular, LethalLevelLoader (and mods like LethalQuantities) can rebuild each moon's scrap pool from their own config, which would otherwise silently exclude any newly-registered scrap. To handle this, the mod re-injects the ticket into the moon's scrap pool right before scrap spawns — running after those mods — so it appears regardless of how the pool was built. On each landing you'll see:

Injected Lucky Lottery Ticket into 'Experimentation' scrap pool (weight 15).

(If the ticket is already in the pool, e.g. on vanilla/non-override setups, it's left alone — no duplicate.)


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..10.Amount 25/50/100/250/500/1000/2500/5000/10000/25000 Payout per tier.
Prize Table Tier1..10.Chance 25/25/18/12/8/5/3/2/1.5/0.5 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 build auto-runs NetcodePatcher so the multiplayer RPCs work.

No Unity is needed: the item is built in code. If you later want a nicer custom model, build an optional asset bundle named lotteryticket (see docs/ASSETS.md) and the mod uses it automatically instead of the code-built placeholder.


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/                  # OPTIONAL custom-model bundle goes here (not needed by default)
  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).

CHANGELOG

Changelog

All notable changes to Lucky Lottery Ticket are documented here.

1.1.0

  • LethalLevelLoader / scrap-override compatibility: the ticket is now re-injected into each moon's scrap pool right before scrap spawns, so it appears even on modpacks (e.g. ones using LethalLevelLoader or LethalQuantities) that replace the per-moon scrap list. Without this, those packs' fixed scrap lists silently excluded the ticket.
  • New default prize table (sums to 100%, no losing tier): 25% $25, 25% $50, 18% $100, 12% $250, 8% $500, 5% $1,000, 3% $2,500, 2% $5,000, 1.5% $10,000, 0.5% $25,000.

If you used 1.0.0, delete your old *.LuckyLotteryTicket.cfg so the new prize-table defaults apply — BepInEx keeps existing config values otherwise.

1.0.0

Initial release.

  • Adds the Lucky Lottery Ticket, a rare scrap item that spawns on all moons.
  • Works with no Unity / no asset bundle: the item is built in code with a simple gold "card" model and a procedural scratch sound. An optional asset bundle can supply a custom model later.
  • Tickets can be sold normally, or scratched once for a chance at a bigger payout.
  • Scratching is server-authoritative: the host rolls the prize a single time and the result + new scrap value are synced to every client (including late joiners).
  • Scratching never pays out directly — the ticket must still be carried back and sold at the Company building.
  • Default prize table: 50% $0, 20% $25, 10% $50, 7% $100, 5% $250, 4% $500, 3% $1000, 1% $5000.
  • Fully configurable: spawn weight, unscratched value, scratch duration, every payout amount and chance, sounds, jackpot announcement, and whether normal wins announce to all players or only the scratcher.
  • Polish: scratch sound (if present in the bundle), a short reveal delay, on-screen result messages, and an optional jackpot announcement.