Jump to content

Rust GPT 1.7.6

   (4 reviews)

4 Screenshots

Recommended Comments



GOO_

Posted

On 1/20/2024 at 5:08 AM, papi said:

GOO_ will you add text to voice to the API?

I tried doing this a few months ago and it was way too janky. I'll try again though. I need someone smarter than myself to help me out with that. 

Tbird412

Posted

I had to revert versions, no matter what I do I cannot get the new version to stop giving these huge long death messages.  The old version I had it giving nice short one sentence answers that are hilarious and great.  But this new version no matter what I do it tries to spit out a novel for every death.  I even went into the code and hard coded the token limits for deaths to be real low.  No dice, it just cuts the message off when it hits that limit.  I even made sure to make the second sentence of my prompt say to keep the response to once sentence with no more than 100 characters and it still sends the novel each time.  I finally gave up and reverted, been wresting with this for about 6 hours today.

  • Like 1
Covfefe

Posted

Is the new death notes working for you guys? I'm only getting suicides and turret kills. Everything else isn't working 

  • Like 1
GOO_

Posted

14 hours ago, Tbird412 said:

I had to revert versions, no matter what I do I cannot get the new version to stop giving these huge long death messages.  The old version I had it giving nice short one sentence answers that are hilarious and great.  But this new version no matter what I do it tries to spit out a novel for every death.  I even went into the code and hard coded the token limits for deaths to be real low.  No dice, it just cuts the message off when it hits that limit.  I even made sure to make the second sentence of my prompt say to keep the response to once sentence with no more than 100 characters and it still sends the novel each time.  I finally gave up and reverted, been wresting with this for about 6 hours today.

What model are you using?

 

GOO_

Posted

4 hours ago, Covfefe said:

Is the new death notes working for you guys? I'm only getting suicides and turret kills. Everything else isn't working 

 

14 hours ago, Tbird412 said:

I had to revert versions, no matter what I do I cannot get the new version to stop giving these huge long death messages.  The old version I had it giving nice short one sentence answers that are hilarious and great.  But this new version no matter what I do it tries to spit out a novel for every death.  I even went into the code and hard coded the token limits for deaths to be real low.  No dice, it just cuts the message off when it hits that limit.  I even made sure to make the second sentence of my prompt say to keep the response to once sentence with no more than 100 characters and it still sends the novel each time.  I finally gave up and reverted, been wresting with this for about 6 hours today.

image.png.34639ead6e1b24f2e94940e230bff919.png

Here is what I have in my RustGPT.json

 

{
  "OpenAI_Api_Key": {
    "OpenAI API Key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "OutboundAPIUrl": {
    "API URL": "https://api.openai.com/v1/chat/completions"
  },
  "AIResponseParameters": {
    "Model": "gpt-4",
    "Temperature": 0.9,
    "Max Tokens": 575,
    "Presence Penalty": 0.6,
    "Frequency Penalty": 0.0
  },
  "AIPromptParameters": {
    "System role": "You are a helpful assistant on Rust game server called Rust.Haus Testing Server.",
    "User Server Details": "Server wipes Thursdays at 2pm CST. Blueprints are wiped on forced wipes only. Gather rate is 5X. Available commands available by using /info. Server admin is Goo. The discord link is https://discord.gg/EQNPBxdjRu"
  },
  "OptionalPlugins": {
    "Turn on GPT Powered Death Notes": true,
    "Kill GPT Prompt": "You are an extremely rude color commentator. You use profanity and make fun of the people involved. Only respond in one sentence.",
    "DiscordMessages Webhook URL": "https://discord.com/api/webhooks/1158127241046282371/8D3OZcQBmXYUWn_liNNir6g_qld3eO8fhBZs6N6hGTFJRoKKRax_mo5o7ScgptaVeg58",
    "Broadcast RustGPT Messages to Discord?": true,
    "Steam API Key": "XXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "DeathNoteSettings": {
    "Kill Message Color": "#ADD8E6",
    "Kill Message Font Size": 12,
    "Show simple kill feed in chat": true
  },
  "Response Prefix": "[RustGPT]",
  "Question Pattern": "!gpt",
  "Response Prefix Color": "#55AAFF",
  "Broadcast Response to the server": false,
  "Plugin Version": "1.7.6",
  "Chat cool down in seconds": 10
}

 

Covfefe

Posted (edited)

Quote

{
  "OpenAI_Api_Key": {
    "OpenAI API Key": "xxxxxxxxxxxx"
  },
  "OutboundAPIUrl": {
    "API URL": "https://api.openai.com/v1/chat/completions"
  },
  "AIResponseParameters": {
    "Model": "gpt-4",
    "Temperature": 0.9,
    "Max Tokens": 999,
    "Presence Penalty": 0.6,
    "Frequency Penalty": 0.0
  },

  "OptionalPlugins": {
    "Turn on GPT Powered Death Notes": true,
    "Kill GPT Prompt": "You are an extremely rude color commentator on the hottest new deathmatch show of the future. You use profanity and make fun of the people involved.",
    "DiscordMessages Webhook URL": "https://discord.com/api/webhooks/1131399828736319550/CmyxVRGwYGmeByv-Jn2QkTYiLeCcWw64CnQ2KbkjT9QhrcRhuaZVqVEhiW3N6ktSDOKC",
    "Broadcast RustGPT Messages to Discord?": false,
    "Steam API Key": "xxxxxxxxxxxxxx"
  },
  "DeathNoteSettings": {
    "Kill Message Color": "#699a69",
    "Kill Message Font Size": 14,
    "Show simple kill feed in chat": true
  },
  "Response Prefix": "Zombot: ",
  "Question Pattern": "(who|what|when|discord|tell|anyone|where|why|how|hello|zombot|admin|help).*$",
  "Response Prefix Color": "white",
  "Broadcast Response to the server": true,
  "Plugin Version": "1.7.6",
  "Chat cool down in seconds": 1

 

Edited by Covfefe
Tbird412

Posted

So a few things ....

1) I'd flip that to 3.5 if I were you.  Go look at the cost difference it is insane.  I think our servers ran up about $0.06 in one day at the worst, then I tried gpt-4 in hopes it would fix the issue I was having and in one day of using that it ran up to like $4.62 with LESS usage than the day before.  It was insane

2) I had to do a LOT of code tweaking.  In it's default form (downloaded from here) it was not showing any kills.  I forgot what the original criteria were (I have already customized my kill criteria) and I am not here to insult the author of any plugin so I am choosing my words carefully but I think the issue I had found was something like a "if victim is NOT an npc and killer is NOT an npc" or something I honestly don't remember what it was in original form.  But I altered mine some and it is showing all the deaths fine now.  Just cannot stop it from the giant paragraph.

I am trying to get the new version up to speed (by that I mean migrating over my changes from the last version to this new version) but I aborted that migration because of the paragraph thing.  I am new to this AI stuff but I cannot figure out for the life in me why it is sending a huge paragraph for this version but the previous version (same settings) is not.

......... ok yeah I just re-downloaded the original to see.  But yes, this line is stopping it from doing death notes if there is an NPC involved (victim or killer).  Most servers that run any sort of death notes are PVE because on PVP servers those types of plugins can be frowned upon....

if (victim != null && !(victim is NPCPlayer) && attacker != null && !(attacker is NPCPlayer))

.............. as for my issue with paragraphs.  I just don't get it.  Old version, fine, new version, huge paragraph each death.  Same exact settings and prompt phrases.

Some of the other features I added to my copy (if the dev here is interested in stealing the code I am all for sharing) I added a few features:

- I changed the cooldown to a person by person basis.  But it is also dynamic (explained below)
- I changed server broadcast to iterate through the online players and send directly rather than just broadcast to the entire server.  This was done to enable these next two options.
- I added a command /DMtoggle for players that do not want to see the death messages (you know how some players call everything "spammy" even if it is only every now and then)
- I added a command /QAtoggle for players to turn off seeing the AI answer questions in chat.  Again, some real veteran players get annoyed by it because they "know everything" lol
- I added a permission "blocked" for players that don't want the bot to answer their questions (we use a very global set of question triggers not just a command).  This is also mainly for the following ...
- I added some playtime based functionality since we are using this bot to answer questions of new players, and our veteran players are not very interested in it all.   I assigned the blocked permission to our higher "playtime" oxide groups so they get ignored.  
- I then added the logic that if the player does NOT have the blocked permission (so they are pretty new) it performs as normal.  But if they DO have the blocked permission (they are not new) it completely ignores anything they ask unless they purposely include the command keyword for the AI bot (so in other words if you are new, he answers everything you might ask, if you are not new you must trigger him on purpose)
- I got rid of the "chunks" logic in mine.  Sorry but my entire point is to keep the answers short and not spammy.  If I ever have answers big enough to need chunks, then I am doing something wrong.  So to save on unnecessary logic (especially since I already iterate through the players for broadcasting, which means I would need to nest a foreach statement for the chunks inside of the foreach for the players) I just flat out removed that logic.

So far all of that has been delightful and the players love it.

The only two issues we are facing now:
1) Cannot figure out this issue with the response being a massive paragraph only in the new version
2) I cannot figure out how to code it to use my OpenAI assistant rather than the default models.

 

Tbird412

Posted

Proof about the costs (the darker green is gpt-4, the lighter is gpt-3.5, ignore the fuscia that is our fine tuning models).  Also attaching our tokens bargraph so you can see we used MUCH LESS tokens on those days that the costs went through the roof ...
image.png.b8e10c959cd0e03062e625c22e3de4e4.png

image.png.d645023f89a8d23bf2ce079628e96f74.png

Tbird412

Posted (edited)

OK apparently I am a moron, because suddenly I am no longer having paragraphs.

Now the fun project of finishing the migration of all my changes to the new version lol

image.png.905700bda3f195f6d0eab22b1164d640.png

Edited by Tbird412
DeltaEremita

Posted (edited)

Hello, how you doing? Perfect Plugin, thank you for letting us have it!
I have a question: I've updated to the new version but the message that you dont have perms has gone, any ideias? I tryed to do it a clean install but didnt happen too

Have a great day!

Edited: I found the problem, i got a downgrade istead xD I know why you did it now, no problem, i have backups anyway. Hope you find a way for the fix! Good luck

Edited by DeltaEremita
Covfefe

Posted

 

On 2/15/2024 at 8:45 AM, Covfefe said:

Is the new death notes working for you guys? I'm only getting suicides and turret kills. Everything else isn't working 

 

On 2/15/2024 at 9:13 PM, Tbird412 said:


if (victim != null && !(victim is NPCPlayer) && attacker != null && !(attacker is NPCPlayer))
 

What do I do with that line? Just delete it?

GOO_

Posted

@Covfefe can you start a support thread so I can better help you?

DeltaEremita

Posted (edited)

Hello, I don't know what happen, but after the new update, Gpt is not answer anymore, the cooldown message show up, and when we reload, the version etc show up, but when we ask something, nothing happens, any idea?



Edited:

This show up on console:

[RustGPT] The remote server returned an error: (429) Too Many Requests.
[RustGPT] There was an issue with the API request. Check your API key and API Url. If problem persists, check your usage at OpenAI.

I did put credits, but even dought, nothing changed

I did created a new api key, but that didn't help too

Edited 2:

The problem is that I need to wait a little after the payment, everything working fine now

 

Edited by DeltaEremita
RustyB

Posted

Is there a way to make it ignore commands from team chat and only reply to global chat?

Covfefe

Posted

how do i get it to only respond to question marks?

i can't compile with just "?"

Quote

"Question Pattern": "?",

Quote

Could not initialize plugin 'RustGPT v1.7.6' (ArgumentException: parsing "?" - Quantifier {x,y} following nothing.) at System.Text.RegularExpressions.RegexParser.ScanRegex () [0x0029a] in :0 at System.Text.RegularExpressions.RegexParser.Parse (System.String re, System.Text.RegularExpressions.RegexOptions op) [0x00036] in :0 at System.Text.RegularExpressions.Regex..ctor (System.String pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout, System.Boolean addToCache) [0x00097] in :0 at System.Text.RegularExpressions.Regex..ctor (System.String pattern, System.Text.RegularExpressions.RegexOptions options) [0x00000] in :0 at Oxide.Plugins.RustGPT.LoadConfig () [0x00097] in <53c635e0c60f4122a281afecd3a1151f>:0 at Oxide.Core.Plugins.Plugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0000f] in :0 at Oxide.Core.Plugins.CSPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00000] in :0 at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00000] in <795304323ac74a298b8ed190a1dfa739>:0 at Oxide.Plugins.RustPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0028e] in <9bca18641a87469b8930d041f1c86847>:0 at Oxide.Core.Plugins.PluginManager.AddPlugin (Oxide.Core.Plugins.Plugin plugin) [0x00027] in :0 at Oxide.Core.OxideMod.PluginLoaded (Oxide.Core.Plugins.Plugin plugin) [0x00035] in :0

 

Covfefe

Posted

nevermind, i got chatgpt to tell me it's 

Quote

".*\\?$"

 

  • Like 1
Butters

Posted

I've regsitered and verified my openai account, generated an openai key, I replace the key in the config.

I type !gpt followed by a question in chat and nothing happens? plugins working cause if i try again too quick i activate the cooldown. Do we need to pay the openai website for it to function or something?

Butters

Posted

15 minutes ago, Butters said:

I've regsitered and verified my openai account, generated an openai key, I replace the key in the config.

I type !gpt followed by a question in chat and nothing happens? plugins working cause if i try again too quick i activate the cooldown. Do we need to pay the openai website for it to function or something?

yeah added $10 to my openai account and works all good now

Butters

Posted

On 2/16/2024 at 12:43 PM, Tbird412 said:

2) I had to do a LOT of code tweaking.  In it's default form (downloaded from here) it was not showing any kills.  I forgot what the original criteria were (I have already customized my kill criteria) and I am not here to insult the author of any plugin so I am choosing my words carefully but I think the issue I had found was something like a "if victim is NOT an npc and killer is NOT an npc" or something I honestly don't remember what it was in original form.  But I altered mine some and it is showing all the deaths fine now.  Just cannot stop it from the giant paragraph.

......... ok yeah I just re-downloaded the original to see.  But yes, this line is stopping it from doing death notes if there is an NPC involved (victim or killer).  Most servers that run any sort of death notes are PVE because on PVP servers those types of plugins can be frowned upon....

if (victim != null && !(victim is NPCPlayer) && attacker != null && !(attacker is NPCPlayer))
 

I too am having this issue of only suicides making death messages appear? Everything else works perfectly. 

What did we need to do to that 'if (victim != null && !(victim is NPCPlayer) && attacker != null && !(attacker is NPCPlayer))' line to solve it?

  • Like 1
Covfefe

Posted

i tried to get chatgpt to fix the "mystery attacker" when players get killed by an animal 

RustGPT.cs

File

when a player gets killed by an animal, the response says "mystery attacker" fix it so it will say the name of the animal instead of "mystery attacker"

ChatGPT said:

ChatGPT

I can help you modify the script so that it displays the name of the animal instead of "mystery attacker" when a player gets killed by an animal. I'll take a look at the script and make the necessary changes. Let me start by reading the contents of the file.

The script appears to be part of a plugin for the game Rust, which includes features for interacting with OpenAI's ChatGPT and handling game events like player deaths.

To ensure I modify the correct part of the script, I need to find where the script handles player deaths, particularly the section where it identifies the "mystery attacker" and changes the message to include the specific animal.

Let me search for relevant code sections related to player deaths and attacker identification.

The script includes a section for handling death commentary, and it identifies the attacker during a player's death. There's a check for whether the entity is an animal (entity is BaseAnimalNPC), which might be where the "mystery attacker" issue originates.

I'll modify the script so that when the entity is an animal, it will display the animal's name instead of "mystery attacker." I'll now proceed with this change.

I have modified the script so that when a player is killed by an animal, the name of the animal will be displayed instead of "mystery attacker." You can download the modified script using the link below:

Download Modified_RustGPT.cs

4o

You said:

It's still saying mystery attacker when someone dies to an animal

ChatGPT said:

ChatGPT

It seems that there may be another part of the code handling the death messages where the "mystery attacker" is still being used. I'll check the code again to find where else this might be occurring and fix it so that the correct animal name is displayed.

Let me take another look at the script.

It seems like I can’t do more advanced data analysis right now. Please try again later.

However, based on the image you provided, it looks like the issue might be related to a different section of the script that handles the commentary or messages related to the kill. I suggest checking the parts of the code where death commentary or custom messages are generated to ensure that they reference the correct attacker name, particularly for animals.

If you still have the script available, you might want to look for any instances where "mystery attacker" or similar phrases are used and replace them with the logic that checks for the animal's name. If you'd like, I can guide you through where to look or what specific changes to make.

S0TR

Posted

So after following some of the comments in this discussion, I was able to modify RustGPT to report all player-only deaths, regardless of how, in a GPT-Powered Death Message. My next issue was that I had a plugin called BetterNpc installed, and RustGPT was reporting those Npc deaths to chat. After some more modifications, and help from ChatGPT itself, I was able to get the two plugins to work together and now RustGPT does not report any of those "BetterNpc" deaths either. Hoorah, victory! See below for some snips of my code so you can also modify both plugins and have BetterNpc and RustGPT collaborate together, so they do not spam your in-game chat with Death Messages from Npc Deaths! ❤️

*Bold text is my added modified lines of code with //explanation of use*

BetterNpc.cs modification -

if (IsEvent) DeadNpc.Add(new DeadScientistNpc { Preset = preset, TimeToSpawn = 0 });
                else
                {
                    DeadNpc.Add(new DeadScientistNpc { Preset = preset, TimeToSpawn = (int)UnityEngine.Random.Range(preset.Config.MinTime, preset.Config.MaxTime) });
                    if (DeadNpc.Count == 1) InvokeRepeating(ChangeDeadNpcTime, 1f, 1f);
                }
                ActiveNpc.Remove(activeScientistNpc);
                Interface.CallHook("OnBetterNpcDeath", npc);  //Notify other Plugins (Like RustGPT) that this NPC was managed by BetterNpc
                BasePlayer attacker = npc.lastAttacker as BasePlayer;
                if (attacker.IsPlayer()) _ins.SendBalance(attacker.userID, preset.Economic);
                _ins.NextTick(() =>
                {
                    if (preset.TypeLootTable == 1 || preset.TypeLootTable == 4 || preset.TypeLootTable == 5)
 

RustGPT.cs -

 private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
        {
            if (!_config.OptionalPlugins.UseDeathComment || entity == null || info == null) return;

            BasePlayer victim = entity.ToPlayer();
            BasePlayer attacker = info.InitiatorPlayer;
            
            // Skip processing if the victim is an NPC managed by BetterNPC
            if (victim != null && victim is ScientistNPC)
          {
            // The OnBetterNpcDeath hook should have handled this
            return;
          }

 

*Disclaimer: I have absolutely no knowledge or skill of plugin creation or .cs coding. However, doing this has spawned some desire in me to learn!*

My next task, which will now be simple after figuring this out, is to make it so RustGPT also does not report the deaths of Npcs spawned by the Raidable Bases plugin 🙂

S0TR

Posted

21 hours ago, S0TR said:

So after following some of the comments in this discussion, I was able to modify RustGPT to report all player-only deaths, regardless of how, in a GPT-Powered Death Message. My next issue was that I had a plugin called BetterNpc installed, and RustGPT was reporting those Npc deaths to chat. After some more modifications, and help from ChatGPT itself, I was able to get the two plugins to work together and now RustGPT does not report any of those "BetterNpc" deaths either. Hoorah, victory! See below for some snips of my code so you can also modify both plugins and have BetterNpc and RustGPT collaborate together, so they do not spam your in-game chat with Death Messages from Npc Deaths! ❤️

*Bold text is my added modified lines of code with //explanation of use*

BetterNpc.cs modification -

if (IsEvent) DeadNpc.Add(new DeadScientistNpc { Preset = preset, TimeToSpawn = 0 });
                else
                {
                    DeadNpc.Add(new DeadScientistNpc { Preset = preset, TimeToSpawn = (int)UnityEngine.Random.Range(preset.Config.MinTime, preset.Config.MaxTime) });
                    if (DeadNpc.Count == 1) InvokeRepeating(ChangeDeadNpcTime, 1f, 1f);
                }
                ActiveNpc.Remove(activeScientistNpc);
                Interface.CallHook("OnBetterNpcDeath", npc);  //Notify other Plugins (Like RustGPT) that this NPC was managed by BetterNpc
                BasePlayer attacker = npc.lastAttacker as BasePlayer;
                if (attacker.IsPlayer()) _ins.SendBalance(attacker.userID, preset.Economic);
                _ins.NextTick(() =>
                {
                    if (preset.TypeLootTable == 1 || preset.TypeLootTable == 4 || preset.TypeLootTable == 5)
 

RustGPT.cs -

 private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
        {
            if (!_config.OptionalPlugins.UseDeathComment || entity == null || info == null) return;

            BasePlayer victim = entity.ToPlayer();
            BasePlayer attacker = info.InitiatorPlayer;
            
            // Skip processing if the victim is an NPC managed by BetterNPC
            if (victim != null && victim is ScientistNPC)
          {
            // The OnBetterNpcDeath hook should have handled this
            return;
          }

 

*Disclaimer: I have absolutely no knowledge or skill of plugin creation or .cs coding. However, doing this has spawned some desire in me to learn!*

My next task, which will now be simple after figuring this out, is to make it so RustGPT also does not report the deaths of NPCs spawned by the Raidable Bases plugin 🙂

To further help my fellow Rust Plugin Enthusiasts, I've successfully implemented the CallHook into Raidable Bases, with RustGPT no longer reporting those NPC deaths, only player deaths BY those NPCs. See below for where I've imputed the new line of code.

public class HumanoidNPC : ScientistNPC
        {
            public new HumanoidBrain Brain;

            public new Translate.Phrase LootPanelTitle => displayName;

            public override string Categorize() => "Humanoid";

            public override bool ShouldDropActiveItem() => false;
        
            public HumanoidNPC()
            {
             Interface.CallHook("OnHumanoidNpcSpawned", this); // Notify other plugins of NPC spawn
            }

            protected override string OverrideCorpseName() => displayName;

            public override void AttackerInfo(ProtoBuf.PlayerLifeStory.DeathInfo info)
            {
                info.attackerName = displayName;
                info.attackerSteamID = userID;
                info.inflictorName = inventory.containerBelt.GetSlot(0).info.shortname;
                info.attackerDistance = Vector3.Distance(Brain.ServerPosition, Brain.AttackPosition);
            }

 

Due to the fact that RaidableBases.cs uses the same identifier as BetterNPC.cs for their NPCs, "ScientistNPC", I did not need to add any additional code into RustGPT as it just automatically recognizes the "ScientistNPC" tag. Will be back when I implement this CallHook into both Convoy.cs and NPCRandomRaids.cs in order to the same thing of non-reporting those custom NPC deaths and help out my fellow Script Kitties!  😄

S0TR

Posted (edited)

On 9/2/2024 at 9:58 PM, S0TR said:

To further help my fellow Rust Plugin Enthusiasts, I've successfully implemented the CallHook into Raidable Bases, with RustGPT no longer reporting those NPC deaths, only player deaths BY those NPCs. See below for where I've imputed the new line of code.

public class HumanoidNPC : ScientistNPC
        {
            public new HumanoidBrain Brain;

            public new Translate.Phrase LootPanelTitle => displayName;

            public override string Categorize() => "Humanoid";

            public override bool ShouldDropActiveItem() => false;
        
            public HumanoidNPC()
            {
             Interface.CallHook("OnHumanoidNpcSpawned", this); // Notify other plugins of NPC spawn
            }

            protected override string OverrideCorpseName() => displayName;

            public override void AttackerInfo(ProtoBuf.PlayerLifeStory.DeathInfo info)
            {
                info.attackerName = displayName;
                info.attackerSteamID = userID;
                info.inflictorName = inventory.containerBelt.GetSlot(0).info.shortname;
                info.attackerDistance = Vector3.Distance(Brain.ServerPosition, Brain.AttackPosition);
            }

 

Due to the fact that RaidableBases.cs uses the same identifier as BetterNPC.cs for their NPCs, "ScientistNPC", I did not need to add any additional code into RustGPT as it just automatically recognizes the "ScientistNPC" tag. Will be back when I implement this CallHook into both Convoy.cs and NPCRandomRaids.cs in order to the same thing of non-reporting those custom NPC deaths and help out my fellow Script Kitties!  😄

I've returned again, and after much headache (partly due to not knowing what tf I am doing in regard to Rust Plugin coding, or C# coding in general) I have successfully integrated the different plugins that spawn their own NPCs into RustGPT, and its OnEntityDeath method, so there are no reports for the NPC deaths! My code has changed, and gotten simpler, or more complicated? Not sure what it is, I'm new to this!

Convoy.cs did not need a CallHook or any modification, this plugin also classifies its NPCs with "ScientistNPC", therefore RustGPT automatically recognized the deaths and skipped over generating a Death Message.

RandomRaids.cs, however, was more of a headache than it needed to be. This plugin classifies its NPCs in multiple different ways, and even my GPT couldn't help me figure out how to find and implement the identifier or which identifier to be using for that matter! With the help of my GPT (I made one specifically to help me do Rust Server things), we've came up with an idea. In my RandomRaids.json configuration file, I've named every single NPC the same name (makes sense since they are all technically spawned for the same reason). In my RustGPT.cs, we wrote a check inside the OnEntityDeath method to look for NPCs specifically with that display name in order to skip over a reported Death Message; and it works, thank the heavens it works, or I would have been up until sunrise trying to get this functioning.

Below is my new code for RustGPT. The previous Hooks I wrote inside the other plugins remain the same.

 

private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
        {
              if (!_config.OptionalPlugins.UseDeathComment || entity == null || info == null) return;

            BasePlayer victim = entity.ToPlayer();
            BasePlayer attacker = info.InitiatorPlayer;

            // Check if the victim's display name is "Revenge Raider"
            if (victim != null && victim.displayName == "Revenge Raider")
             {
                // Handled if NPC was specifically named "Revenge Raider"
                return;
             }

            
            // Check if the victim is any ScientistNPC managed by other plugins
            if (victim is ScientistNPC)
           {
            // Handled if NPC was classified as ScientistNPC
            return;
           }

            if (victim != null && attacker != null)
            {
                string attackerName = StripRichText(attacker.displayName);
                string victimName = StripRichText(victim.displayName);

                string weaponName = GetWeaponDisplayName(attacker);
                string hitBone = GetHitBone(info);

                string deathMessage = $"{attackerName} killed {victimName} with a {weaponName} in the {hitBone}";

 

 

Side Note to all this: I am not sure exactly why Convoy.cs did not need a CallHook integrated into its code for RustGPT to automatically recognize its NPCs and avoid reporting a Death Message, and quite frankly I'm too tired to care and find out. However, this was an incredible amount of fun, and as I install more plugins that handle NPCs, such as my upcoming Armored Train, I'll be sure to always modify the source codes, so they cooperate with RustGPT. In fact, I'm thinking of other plugins that aren't NPC related that I could modify (not necessarily for use with RustGPT) and have even been thinking about plugins of my own creation I can create for the world ❤️ Happy Coding !

Edited by S0TR
TheRustingDead

Posted (edited)

How long can you make these lines?

  "AIPromptParameters": {
    "System role": "",
    "User Server Details": "",


Our server has 150+ plugins and a lot of info specific to our server.

Does increasing the info in these lines affect the plugin negatively?
Or does it increase the token count per response?

Just trying to wrap my head around this plugin, love it so far though!

Also any chance we could get openwebui integration?

I run a locally hosted LLM and would love to avoid the openai costs by using my local instance.

Edit:
Does anyone know how to get RustCord to not display the RustGPT in the "sync" channel?

Currently when a question is answered by RUSTGPT it is sent to the sync channel and then sent back again to the server resulting in a global/doubled response. For now I have the RustGPT response getting sent to a separate channel, but I would like it to appear in discord only as well as privately communicated to the player that asked it,

Edited by TheRustingDead

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Like 1
  • Love 3

GOO_'s Collection

User Feedback

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.4k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.