Skip to content

Code Samples

DillyzThe1 edited this page Dec 26, 2022 · 6 revisions

Code Samples

NOTE: These code samples are intended to be modified. They may not work as intended.

Summary

This is a page in which you can find examples of custom Code Samples made to recreate certain aspects or functions.
Have fun.

Kill Button

Note: This will not work unless you have an embedded resource of kill.png and replace the asset directory with one output by the game console saying your embedded resource's path.
[Explanation]

CustomButton killButton = DillyzUtil.addButton(System.Reflection.Assembly.GetExecutingAssembly(), "Kill Button", "ExampleRolePackage.kill.png", -1f, true, new string[] { "Impostor", "ShapeShifter" }, new string[] { "Impostor", "ShapeShifter" }, delegate(KillButtonCustomData button, bool success) {
    if (!success)
        return;

    DillyzUtil.RpcCommitAssassination(PlayerControl.LocalPlayer, button.killButton.currentTarget);
});
killButton.buttonText = "Kill";
killButton.textOutlineColor = new Color32(253, 25, 25, 255);

Impostor Role

[Explanation]

CustomRole impostorRole = DillyzUtil.createRole("Impostor", "Kill crewmates and hide in vents.", true, false, new Color32(253, 25, 25, 255), true, CustomRoleSide.Impostor, VentPrivilege.Impostor, true, true);
impostorRole.a_or_an = "an";

Crewmate Role

[Explanation]

CustomRole crewmateRole = DillyzUtil.createRole("Crewmate", "Do tasks and vote out suspects.", false, false, new Color32(139, 253, 253, 255), false, CustomRoleSide.Crewmate, VentPrivilege.None, false, false);
crewmateRole.a_or_an = "an";
Clone this wiki locally