Posts by Elysium317

    You can use bot.AIData.Player.ClearHands() before setting the object inactive to fix the floating ghost weapons. This is probably the solution you would use if not using the destructive route.


    I'm personally going to continue to use dipose along with destroy as it frees up memory. I've tested it enough at this point to where I can confidently say it causes no issues. The end raid cleanup throws some NREs when it looks for the bots but it is harmless.

    Got a player check working. I know this is a support thread and you may not be personally interested, but I doubt I am the only one who would appreciate this functionality.



    bot cleanup - Pastebin.com
    Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
    pastebin.com


    Noticed some false positives if I was recently engaged with a bot who died to another bot, but if you are not near the engagement it works. In this case a false player detection only results in the corpse lasting a little longer. More or less does what I want for personal use, which was to clean loot I did not feel I earned. Any performance gain is a cherry on top, but it feels mostly negligible on my end, probably due to a memory bottleneck.

    Oh okay, I only tested it briefly. I came across LootItem.RemoveLootItem and RagdollClass.ClearWeapon which seemed potentially useful but I was unable to make use of them so far.


    Edit: Didn't make any progress in that area. Came across so BotsClass.Remove. Seems like that is the trick but I'm too dumb to figure it out I guess. On the bright side I have not run into any issues yet, and I realized it is pretty easy to track corpse lifetime and have it clean up more frequently.

    if (Time.time - botOwner.Memory.LastTimeHit >= 180f) would include any bot that has not been hit in the last 3 minutes, for example.

    Currently experimenting with a 10 minute clean-up cycle (separated the airdrop event) with a range of 30m and LastTimeHit at 3 minutes, seems to be working as intended.


    I'm thinking I can also use Memory.GoalEnemy to check if the bot was last looking at the player when it died, if I can figure out how to check for players.


    Edit#2: Looks like the the end-raid cleanup outputs an error for what looks like each destroyed bot object, so yeah maybe not ideal. I see what you mean by lots of issues. Will have to settle with deactivate for now.

    I figured it out. You have to use botOwner.gameObject.DestroyAllChildren or UnityEngine.Object.Destroy(botOwner.gameObject) to effectively remove the equipped weapon. The trace will complain about destroying a player body before properly disposing of it. There is a dispose method but it didn't seem to help with the complaints when I tried. Either way I'm fairly certain GC will clean up anything left over in memory, if a dead bot even has anything.


    Now to figure out how to check the last aggressor or killed by data before deciding which bodies to clean up.

    Been trying to figure out why the currently held weapon of the bot does not get cleaned up with the bot. You can't grab it or anything but it is still rendered. Not a huge deal but I've been trying to minimize lag on my client. They add after awhile, especially if they happened to have a light on it. I tried a few different things with the code with no luck. Seems like the held weapon is not part of the bot like a holstered weapon is.