T
tModLoader7mo ago
correct-apricot

How can I make a NPC take arguments from the in-game chat?

Hello, I am trying to make a custom NPC that says things to me, like "/npcName Hello!" and the NPC would repond "Hello! <playerName>" stuff like that. I plan to make it much more complex, but for now on is just this. I am using the examplePerson NPC from the exampleMod as a template. But I am a dumb dumb when comes to programming, the error starts when I try to use the function 'HandleChatMessage()" in a .cs file called ExampleMod.Chat.cs. But when I Build + Reload it causes error and the log says: ExampleMod.Chat.cs(9,30): error CS0115: 'ExampleMod.HandleChatMessage(string, string)': no suitable method found to override
4 Replies
tModLoader
tModLoader7mo ago
Welcome to #support-forum. Before someone helps you, please first consult the information in #TML Troubleshooting Guide and try all the suggestions that might fit your particular issue, especially in the linked FAQ page. If the information in the pinned thread does not solve your issue, please post all log files by dragging and dropping them into this chat. In Steam right click on tModLoader in the library, then hover over Manage and click on Browse local files. In the folder that appears find tModLoader-Logs and open that folder. Inside that folder are the logs files. Select them all except the Old folder and drag them into this chat. If you need a visual guide to this process watch this: https://github.com/tModLoader/tModLoader/assets/4522492/3f4efa43-753f-4733-b630-ba85e711340c
correct-apricot
correct-apricotOP7mo ago
This is the coding that I am trying to use:
tModLoader
tModLoader7mo ago
Automatic Hastebin for rique_belt: https://hst.sh/nukalahope.cs
correct-apricot
correct-apricotOP7mo ago
what? My tModLoader is in the version v2025.2.3.3, I think that the problem my be a compatibility issue with "HandleChatMessage(string text, Player player, string clientName)".

Did you find this page helpful?