You are viewing a potentially older version of this package. View all versions.
MelanieMelicious-NPC_API_MelanieMelicious-1.0.3 icon

NPC API MelanieMelicious

WIKI SOON. An API for setting up interactive NPCs with dialogue, stores, quests, unlockable dialogue, and built-in save system! Can be built solely in-editor, but also can be edited with code. Find me in Lethal Company Modding Discord.

Date uploaded 3 weeks ago
Version 1.0.3
Download link MelanieMelicious-NPC_API_MelanieMelicious-1.0.3.zip
Downloads 305
Dependency string MelanieMelicious-NPC_API_MelanieMelicious-1.0.3

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

README

NPC API - MelanieMelicious v1.0.3

WIKI SOON. An API for setting up interactive NPCs with dialogue, stores, quests, unlockable dialogue, and built-in save system! Can be built solely in-editor, but also can be edited with code. Find me in Lethal Company Modding Discord.

Previews:

Editor Components

More info in the wiki (if written at the time of you reading this).

Name Type Public Methods Editor Variables Overview
NPC MonoBehavior Script Welcome() nameBox, welcome, spawnScrapPos Script you place on the object considered your NPC, alongside its trigger (example, interact trigger) to invoke its Welcome() method as a Unity event. Welcome() opens chat box to the chat node set in the welcome variable. Chat box name is set by the nameBox variable. Any scrap spawns from interacting with this NPC will be located at spawnScrapPos variable.
NPCChatNode Scriptable Object LockDialogue(int index), UnlockDialogue(int index) displayText, selectText, selectEvent, saveUnlockedDialogue, allResponses, lockedResponsesIndex, shop, quests Each NPCChatNode is the data for 1 dialogue option. Display text is what the NPC says, select text is what you say to trigger the NPC using this node, selectEvent for Unity events to play when selecting this option, saveUnlockedDialogue is if this node is intended to have saveable changes per-save, allResponses is a list of all possible responses (quest ones), lockedResponsesIndex is a list of indexes in allResponses that should be locked/hidden by default, shop is for if this node instead opens a shop - and which shop - instead of dialogue, and quests is if this chat node is the center for the input quests.
NPCShopNode Scriptable Object None buy, buyByName, buyCost, sell, sellByName, sellMulti, addQuota, tradeWant, tradeWantByName, tradeGive, tradeGiveByName Each NPCShopNode is the data for 1 shop. Buy is a list of items intended to be buyable, and buyByName is for alternatively fetching the item by itemName, for example, to use third-party mod or vanilla items. Items found by name are added to the normal list after directly referenced ones. Sell, sellByName, tradeWant, tradeWantByName, tradeGive, and tradeGive by name work similarly. BuyCost syncs the buy price of items of the same list index. Selling allows the player to sell specific items, if they are holding them, for their credit value, sellMulti multiplies this value, and addQuota is whether or not this value progresses the quota. TradeWant is what the NPC wants in order to give the player the item of the same index, in tradeGive.
NPCQuestNode Scriptable Object Progress(int index), DespawnHeld(), ClaimQuest(bool claim) conditions{requirement, item, itemByName, progress, progressMax}, completeEvent, questDefault, questProgress, questComplete, claimed Each NPCQuestNode is the data for 1 quest. Progress(int index) allows you to increment progression for a condition based on index, by one. DespawnHeld() despawns current player's held object. ClaimQuest(bool claim) marks a quest as claimed or unclaimed a quest. Conditions are your list of conditions required to be completed, to complete the quest, requirement is a short worded description of what's needed to meet this condition (for future quest UI visualization), item and itemByName are optional, for if your progress is intended to be triggered by handing in an item to the NPC, progress is how much progress this condition is met up to, and progressMax is how much progress you need for this condition to be complete. CompleteEvent is for running Unity events once the quest is completed, questDefault is the dialogue option that shows up in no special scenarios, questProgress is for if the player is holding any item (if applicable) needed by any of the quest conditions, when in the chat node housing the quest, and questComplete is the dialogue for when the player has first completed the quest, and in the chat node housing the quest.

CHANGELOG

1.0.3

  • Added "Add To Quota" bool option for trade items in shop nodes.
  • Made shop node less unnecessarily convoluted for user-end in syncing items and item values. Also better for modifying shops in code (should anybody choose to do that).

1.0.2

  • Added NPC save state for GameObjects turning active, or spawning (depending on referenced prefab type). Example use cases, doing more quests making more objects appear around the NPC.
  • Added optional NPC Node specifically for GameObject save states (still includes a bool for adding node to save list). NPCs should still work without these.
  • Added optional animator reference components for running animations when talking, and when no longer talking to an NPC. Currently hard-coded to "Talk" and "Idle" animator states, when entering and exiting chat box.
  • Fixed bug of sell shop showing empty elements based on number of trade shop elements visible.

1.0.1

  • Fixed an issue casued by sync re-order.

1.0.0

  • Initial release!
  • Added NPC script with public welcome trigger (to begin interacting with NPC). Typically just use an interact trigger, but you CAN activate it using something else. Also includes NPC name for chatbox, welcome message for initial interaction, and scrap spawn position for shops (FKKK I NEED TO ADD NATIVE OPTION FOR SPAWNING SCRAP BESIDES JUST FROM SHOP, but later). NPC script can be placed on ANYTHING, items, furniture, map objects, enemies, etc. Just know, if you place this on vanilla thumper for some reason, it will still attack you, BUT... you can talk to it!
  • Added NPC chat node scriptable object. Includes NPC display text (what the NPC says when this node is active), response select text (your response in other chat nodes, that lead to this chat node), a list where you add response options (0 response options closes chat box when selecting this node), locked options based on indexes in response list, if this specific node has saveable interactions, if this node opens a shop instead of dialogue (and which shop), a list of quests that will allow them to be instructed, progressed, and completed here, and the ability to trigger unity events when activating this node. Save data key (for saveable chat nodes) depends on .asset name.
  • Added NPC shop node scriptable object. Includes options to allow players to buy items for set amount of credits, sell items for their value (alongside any multiplier to this), if selling here contributes to quota, trades to turn in one item in exchange for another, and item lists for buying, selling, or trading items, either referenced directly, or by name (for third-party or vanilla items).
  • Added NPC quest node scriptable object. Includes list of conditions to consider this quest complete, ability to progress conditions via unity event and condition index, OPTIONAL item (or item name) to check held player object to show "progress option" dialogue, ability to run unity event when completed, dialogue for unfinished quest, progression opportunity, and completion message, and a bool for when completed quest has been claimed (example, after completing a quest, and claiming a reward at an NPC). Save data key depends on .asset name.
  • Usable unity events include: LockDialogue(index), and UnlockDialogue(index) for Chat Nodes, Progress(index), DespawnHeld(), and ClaimQuest(claim) for Quest Nodes, and Welcome() for NPC script.
  • WILL ADD A WIKI FOR MORE DETAILED INSTRUCTIONS, SOON!