Jump to content

S0TR

Member
  • Posts

    47
  • Joined

  • Last visited

Everything posted by S0TR

  1. S0TR

    Rust GPT

    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!
  2. S0TR

    Rust GPT

    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
1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.3k

Files Sold

Total number of files sold.

2.3m

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.