Jump to content

New Death Notes doesn't catch most deaths

Closed 1.7.6 Next Version

Covfefe
Covfefe

Posted

So far it's only working with turret deaths and suicides. Doesn't get any from botrespawn or raidablebases, or events like convoy, etc etc. Is there any way to revert back to the old death notes method?

GOO_

Posted

I'm updating the plugin tonight but I can't make any promises of the death commentary working with multiple plugins. After this update Ill try and work in fixes for popular plugins that have zombies and special turrets, etc. 

Covfefe

Posted

I also just tried a normal vanilla scarecrow and still no message.

GOO_

Posted

Changed Status from Pending to Work in Progress

Changed Fixed In to Next Version

Covfefe

Posted

I'm still not getting anything but suicides. Not sure what I'm doing wrong. This used to work perfectly 2 versions ago


  "AIResponseParameters": {
    "Frequency Penalty": 0.0,
    "Max Tokens": 999,
    "Model": "gpt-3.5-turbo-0125",
    "Presence Penalty": 0.6,
    "Temperature": 0.9
  },
  "Broadcast Response to the server": true,
  "Chat cool down in seconds": 3,
  "DeathNoteSettings": {
    "Kill Message Color": "#ADD8E6",
    "Kill Message Font Size": 12,
    "Show simple kill feed in chat": true
  },
  "OpenAI_Api_Key": {
    "OpenAI API Key": "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"
  },
  "OptionalPlugins": {
    "Broadcast RustGPT Messages to Discord?": true,
    "DiscordMessages Webhook URL": "https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks",
    "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.",
    "Steam API Key": "966DF5F37A61ADADF4E125576B35AA97",
    "Turn on GPT Powered Death Notes": true
  },

 

Covfefe

Posted

When gpt tries to reply in game, nothing comes up and I see this in console

Quote

WebException: The remote server returned an error: (403) Forbidden.

What does this mean? It was working yesterday

GOO_

Posted

It's an error from openAi. Check your API key. 

GOO_

Posted

Changed Status from Work in Progress to Closed

Covfefe

Posted

On 2/15/2024 at 5:42 AM, Covfefe said:

So far it's only working with turret deaths and suicides. Doesn't get any from botrespawn or raidablebases, or events like convoy, etc etc. Is there any way to revert back to the old death notes method?

I'm still having this issue. I only get replies from suicides. Should I delete my deathnotes plugin?

Covfefe

Posted

i fixed it with chat gpt

Quote

To ensure the plugin triggers on all player deaths, including those caused by other players or environmental factors, you should ensure that your `OnEntityDeath` hook is correctly capturing and handling these scenarios.

Your existing `OnEntityDeath` hook seems to be focused on handling player deaths. However, the check for `NPCPlayer` in the code indicates that it may not be processing all types of deaths correctly. Let's refine this to handle all player deaths, regardless of whether they are caused by other players, environmental hazards, or other game mechanics.

Here's the revised `OnEntityDeath` method:

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

    BasePlayer victim = entity.ToPlayer();

    if (victim != null && !(victim is NPCPlayer))
    {
        BasePlayer attacker = info?.InitiatorPlayer;

        string attackerName = attacker != null ? StripRichText(attacker.displayName) : "an unknown attacker";
        string victimName = StripRichText(victim.displayName);
        string weaponName = GetWeaponDisplayName(attacker);
        string hitBone = GetHitBone(info);

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

        if (_config.DeathNoteSettings.ShowSimpleKillFeed)
        {
            string killMessageColor = _config.DeathNoteSettings.KillMessageColor;
            int killMessageFontSize = _config.DeathNoteSettings.KillMessageFontSize;

            string formattedMessagePart = $"<color={killMessageColor}><size={killMessageFontSize}>{deathMessage}</size></color>";

            Server.Broadcast(formattedMessagePart);
        }

        if (_config.OptionalPlugins.UseDiscordWebhookChat)
        {
            SendDiscordMessage(deathMessage);
        }

        SendDeathMessageToOpenAI(deathMessage);
    }
}
```

### Key Changes:

1. **Check for `null`**: Ensure `info` is not `null` before accessing its properties. This prevents potential null reference exceptions.

2. **Handle Attacker**: Set the `attackerName` to `"an unknown attacker"` if `InitiatorPlayer` is `null`, covering cases where the death was not directly caused by another player (e.g., environmental hazards).

3. **Broadcast Message**: Ensure that the `deathMessage` is broadcasted regardless of the type of attacker.

With these changes, the `OnEntityDeath` hook should now trigger for all player deaths, not just those where the player commits suicide or is killed directly by another player. This includes deaths caused by environmental factors or NPCs.

 

  • Like 1
1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.5k

Files Sold

Total number of files sold.

2.1m

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.