TryConnect

v0.1.2·Updated 2026-05-06

API and runtime support for registering custom items and prefab-based content in Gamble With Your Friends

About this mod Author’s original text

How to Use TryConnect in Your Mod (WIP!!)

  • Add TryConnect as a dependency in your mod.
  • Register your custom item in the Awake method.

using System.Collections;

using BepInEx;

using TryConnect;

using UnityEngine;

[BepInDependency(TryConnectApi.PluginGuid)]

[BepInPlugin("com.try-4646.Heroin-Mod", "Heroin", "1.0.0")]

public sealed class HeroinPlugin: BaseUnityPlugin

{

private void Awake()

{

TryConnectRegistrationResult result =

TryConnectApi.RegisterBundledCustomItem(

this,

new TryConnectBundledItemRegistration

{

Key = "heroin_injector",

DisplayName = "Heroin",

Description = "Go Crazy.",

BundlePath = "heroin.assetbundle",

VisualPrefabName = "heroin",

VisualLocalScale = Vector3.one * 1f,

ApplyVisualColor = true,

VisualColor = new Color(0.8f, 0.1f, 0.1f),

ReplacementChancePercent = 100,

ExtraBasePrice = 1,

ExtraFloorPrice = 1

// ReplaceColliders = true,

// VisualLocalPosition = new Vector3(0f, 0f, 0f),

// VisualLocalEulerAngles = new Vector3(0f, 0f, 0f)

});

Logger.LogInfo($"TryConnect register result: {result}");

}

}

public sealed class HeroinDrink: Drink

{

private bool _extraEffectAppliedThisPress;

private bool _ragdollEffectActive;

protected override void OnUseItem(bool isPressed)

{

base.OnUseItem(isPressed);

if (!isPressed)

{

_extraEffectAppliedThisPress = false;

return;

}

if (_extraEffectAppliedThisPress ||!isServer)

{

return;

}

_extraEffectAppliedThisPress = true;

PlayerInventory holder = NetworkHolder;

if (holder == null)

{

return;

}

PlayerBuff buff = holder.GetComponent();

if (buff!= null)

{

buff.ApplyBuff(PlayerBuffType.TipsyFortune, 1, 15f);

}

if (!_ragdollEffectActive)

{

StartCoroutine(RandomRagdollEffect(holder));

}

Debug.Log("[Heroin] Random ragdoll effect started.");

}

private IEnumerator RandomRagdollEffect(PlayerInventory holder)

{

_ragdollEffectActive = true;

PlayerController playerController = holder.GetComponent();

float duration = 15f;

float timer = 0f;

while (timer < duration)

{

float randomDelay = Random.Range(1f, 3.5f);

yield return new WaitForSeconds(randomDelay);

if (playerController!= null)

{

playerController.TriggerRagdoll();

Debug.Log("[Heroin] Random ragdoll triggered.");

}

timer += randomDelay;

}

_ragdollEffectActive = false;

Debug.Log("[Heroin] Random ragdoll effect ended.");

}

}

Explanation:

  • Add [BepInDependency(TryConnectApi.PluginGuid)] to make sure TryConnect is loaded first.
  • Create a TryConnectItemRegistration object with your custom item details.
  • Call TryConnectApi.RegisterCustomItem(registration) to register your item.
  • Log the result for debugging.

Result:

Your custom item will now appear in the shop with the specified chance and properties, managed by TryConnect.

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide.

Dependencies

Install these first, or the mod will not work:

BepInEx-BepInExPack

File & checksum

Filename
TryConnect-0.1.2.zip
File size
69.4 KiB