FilUnderscore / ImprovedHordes

7 Days To Die Server/Client Mod - Improves existing hordes by reworking their core behaviours.
https://community.7daystodie.com/topic/26781-improved-hordes/
Other
8 stars 3 forks source link

Screamer/Scout spawn reporting in log #4

Closed trevorjd closed 1 year ago

trevorjd commented 2 years ago

I'm trying to write a CSMM hook to provide a warning to players that they've been targeted by a screamer.

In the vanilla game, I understand that I should see the following in the output_log. INF Spawned [type=EntityZombie, name=zombieScreamer We're generating screamer hordes but aren't seeing that. We are however seeing the following: INF [Improved Hordes] [Scout] Scout trying to summon horde for TrevorJD.

Is ImprovedHordes suppressing or preventing the vanilla spawn message? If so, is it possible to return it?


For reference, this is the code I'd like to use:

Hook Search string: INF Spawned [type=EntityZombie, name=zombieScreamer variable xcoord (?<=INF Spawned [type=EntityZombie, name=zombieScreamer, id=\d+] at ()(-?\d+) variable zcoord (?<=INF Spawned [type=EntityZombie, name=zombieScreamer, id=\d+] at (-?\d+.\d, -?\d+.\d, )(-?\d+)

Command

{{#each server.onlinePlayers}}
    {{#if (and (gte this.positionX (subtract ../custom.xcoord 150)) (lte this.positionX (sum ../custom.xcoord 150)))}}
        {{#if (and (gte this.positionZ (subtract ../custom.zcoord 150)) (lte this.positionZ (sum ../custom.zcoord 150)))}}
            pm Steam_{{this.steamId}} "You hear a scream in the distance.";
        {{/if}}
    {{/if}}
{{/each}}
FilUnderscore commented 2 years ago

Is ImprovedHordes suppressing or preventing the vanilla spawn message? If so, is it possible to return it?

I cancel the vanilla spawning mechanism and use my own when scouts would be summoned. I can make it a DLL add-on that brings it back specifically for CSMM server configurations. Though you will be missing information in the log such as Day=X TotalInWave=X CurrentWave=X since I do not do hordes in waves. So the resulting output message would look more like the ones you provided.

trevorjd commented 2 years ago

Thanks for the quick reply. Our goal is to be able to give players some warning that a scout's on their way so loss of wave data isn't important, so long as we can detect when a scout begins stalking someone.

I'm not sure if it's possible but something like this would make it even easier:

INF Spawned [type=EntityZombie, name=zombieScreamer, target=TrevorJD

Cheers!

FilUnderscore commented 2 years ago

IH-CSMM.zip Extract and install inside the server's mods folder along with the ImprovedHordes mod.

The following message is output when a scout spawns:

INF Spawned [type=EntityZombie, name=zombieScreamerRadiated, id=1076] for PlayerHordeGroup [members={Fil}] at (1375.5, 50.6, 1867.5

trevorjd commented 2 years ago

That's great! Thanks very much for getting it done so quickly. I'll install it now and let you know how it goes.

trevorjd commented 2 years ago

Hi Fil,

Got some testing done tonight, I got some screamers that didn't trigger the script. I was half-way through preparing a log excerpt when I got one that did. So, good news, when a Radiated Screamer appears, we do get the following in the log: 2022-02-20T23:05:33 18023.162 INF Spawned [type=EntityZombie, name=zombieScreamerRadiated, id=124518] for PlayerHordeGroup [members={TrevorJD}] at (2035.5, 38.2, -1874.5)

However I'm guessing that it might not be catching other (non-radiated?) screamer types. My server toon is level 200+ for testing but I'd like to ensure it works for players of all levels. I reset my toon on the server, levelled to 5 but still nothing after 30 mins (12 chem benches and 6 forges). So, I tried to test in singleplayer (all the same mods as on our server) but it appears that IH isn't active in singleplayer.

This excerpt is from singleplayer with a level 1 toon.

2022-02-20T23:44:53 427.611 INF AIDirector: Spawning scouts at (-1235.0, 71.0, 141.0), towards (-1298.0, 61.0, 191.0)
2022-02-20T23:44:53 427.617 INF Spawning this wave: 1
2022-02-20T23:44:53 427.691 INF Spawned [type=EntityZombie, name=zombieScreamer, id=177] at (-1234.5, 71.0, 145.5) Day=2 TotalInWave=1 CurrentWave=1
2022-02-20T23:44:53 427.691 INF AIDirector: scout horde spawned '[type=EntityZombie, name=zombieScreamer, id=177]'. Moving to point of interest
2022-02-20T23:44:54 428.609 INF Start a new wave 'Scouts'. timeout=1s. worldtime=0

This excerpt is from the server with the level 200 toon. You can see in there that I'm getting some hordes but no screamer/scout spawn message: https://pastebin.com/bZy7Z1mX


Side question, the syntax of your spawn message suggests that it might target multiple members for the group. Would you please give an example of a 2+ player target so I can see how you're separating the player names?

Thanks!

FilUnderscore commented 2 years ago

I got some screamers that didn't trigger the script. However I'm guessing that it might not be catching other (non-radiated?) screamer types.

The add-on only handles screamers that are spawned through IH's horde spawning system. I have updated it to include any screamer spawned in any of the hordes generated, will not work with spider scouts because there are some fundamental changes to the system I need to make which will allow me to track entities in hordes better. Expect this in a major update coming soon. In the meantime, here is the updated version I was talking about that works for all IH spawned screamers: IH-CSMM.zip

I reset my toon on the server, levelled to 5 but still nothing after 30 mins (12 chem benches and 6 forges).

Default configuration is that screamers start spawning after GS 15 to give players a chance to prepare their base for screamer hordes since they do get difficult. If you want to change this, see here on the wiki for customizing hordes under the Scouts horde type.

So, I tried to test in singleplayer (all the same mods as on our server) but it appears that IH isn't active in singleplayer.

Seems like IH might not be installed or enabled, did you disable EAC since clients cannot run the mod with EAC enabled since it is a DLL.

Side question, the syntax of your spawn message suggests that it might target multiple members for the group. Would you please give an example of a 2+ player target so I can see how you're separating the player names?

The names are comma separated, i.e. members={Fil, Player1, Player2}

trevorjd commented 2 years ago

Hi Fil,

Thanks again for the update!

I didn't know about the EAC + mods issue. Funny thing I noticed, if you launch the non_EAC version directly, the game runs fine but it doesn't create a log file! So, used the launcher and I now have a log file. Success!

2022-02-22T11:18:38 401.291 INF Spawned [type=EntityZombie, name=zombieScreamer, id=214] for PlayerHordeGroup [members={TrevorJD}] at (-1373.5, 63.3, 202.5)

I now have a script up and working, thanks very much. Seems to be reliable. However, I'm still finding that zombies are arriving before the warning message comes through. That's with a level 15 toon at GS 33 or so, so just base zombie types (although we run at Difficulty 5, not sure if that effects it). I know there can be a several seconds delay between the message coming up in the log and the script engine detecting it and running the script.

Is it possible to introduce a configurable delay? Perhaps between the log write and the actual spawning? Or between the spawning and the activation of the scream AI?

Thanks

FilUnderscore commented 2 years ago

Is it possible to introduce a configurable delay? Perhaps between the log write and the actual spawning? Or between the spawning and the activation of the scream AI?

Try this: IH-CSMM.zip I have introduced a delay when spawning where the screamer will wander for a given amount of ticks. To use this, you must create a new entry in your ImprovedHordes settings.xml file under the scout_horde settings like so:

<scout_horde>
    ...
    <spawn_delay>10.0</spawn_delay>
</scout_horde>

As for the values, you'll need to play around with them yourself to see what kind of delay you are looking for.

trevorjd commented 2 years ago

That's awesome! Thank you! I'll give it a whirl tomorrow. That xml is under the main IH folder. You've linked the updated addon. Is there an updated IH required?

FilUnderscore commented 2 years ago

No, the updated add-on patches it.

trevorjd commented 1 year ago

Hi FilUnderscore,

Set up a new map on A20.6b9 and someone commented that there were no screamer warnings. I updated to the latest IH and I'm still getting this error at startup. Is this coming from IH or the IH-CSMM addon?

Thanks

2022-11-20T05:00:54 15.814 ERR [MODS] Failed initializing ModAPI instance on mod 'ImprovedHordes' from DLL 'ImprovedHordes.dll' 2022-11-20T05:00:54 15.816 EXC Node with name spawn_delay does not exist. at ImprovedHordes.IHSettingsNode.GetSubnode (System.String nodeName) [0x0001e] in <fd54174351564b5f91644fecdaa2f318>:0 at ImprovedHordes.Settings.GetFloat (System.String name, System.Single defaultValue) [0x00000] in <fd54174351564b5f91644fecdaa2f318>:0 at ImprovedHordes.Settings.GetFloat (System.String name, System.Single compareTo, System.Boolean larger, System.Single defaultValue) [0x00000] in <fd54174351564b5f91644fecdaa2f318>:0 at ImprovedHordes.CSMM.ImprovedHordesCSMM+HarmonyPatches+ScoutManagerReadSettingsPatch.Postfix (ImprovedHordes.Settings settings) [0x00000] in <0b8f4f2302484c5aa27319d07ad9930f>:0 at (wrapper dynamic-method) ImprovedHordes.Horde.Scout.ScoutManager.DMD<ImprovedHordes.Horde.Scout.ScoutManager::ReadSettings>(ImprovedHordes.Horde.Scout.ScoutManager,ImprovedHordes.Settings) at ImprovedHordes.ImprovedHordesManager.LoadSettings (Mod modInstance) [0x00062] in <fd54174351564b5f91644fecdaa2f318>:0 at ImprovedHordes.ImprovedHordesManager..ctor (Mod mod) [0x00099] in <fd54174351564b5f91644fecdaa2f318>:0 at ImprovedHordes.ImprovedHordesMod.InitMod (Mod mod) [0x00000] in <fd54174351564b5f91644fecdaa2f318>:0 at ModManager.LoadMods () [0x0008a] in <5135e30b517b4368a94317ce6e11f1c3>:0 UnityEngine.StackTraceUtility:ExtractStringFromException(Object) Log:Exception(Exception) ModManager:LoadMods() GameManager:Awake()

FilUnderscore commented 1 year ago

Set up a new map on A20.6b9 and someone commented that there were no screamer warnings.

This could be because screamers do not spawn by the default mod settings until gamestage 15.

I updated to the latest IH and I'm still getting this error at startup. Is this coming from IH or the IH-CSMM addon?

It's coming from IH-CSMM, it's referring to the missing setting that it reads from the settings XML file, Quoting from the reply that had the original download for IH-CSMM,

To use this, you must create a new entry in your ImprovedHordes settings.xml file under the scout_horde settings like so:

<scout_horde>
    ...
    <spawn_delay>10.0</spawn_delay>
</scout_horde>

This will get overwritten every time you update IH, however I can look into adding a separate config for IH-CSMM to prevent this issue.

trevorjd commented 1 year ago

Ah OK! Thanks for the quick reply. Yes, a separate config would be a good idea because I just know I'll have forgotten this tidbit come next time!

Actually, it might be simplest to just add it to IH itself and have it skip over / ignore it unless IH-CSMM is installed.

trevorjd commented 1 year ago

I don't think it's causing any trouble but I don't recall seeing this before. The screamer warning does seem to be working OK.

12:02 PM 2022-11-22T12:02:02 25286.721 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25286.721 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25287.193 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25287.193 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:03 25287.356 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:03 25287.357 WRN [Improved Hordes] [Scout] Current AI command is not scout.

FilUnderscore commented 1 year ago

I don't think it's causing any trouble but I don't recall seeing this before. The screamer warning does seem to be working OK.

12:02 PM 2022-11-22T12:02:02 25286.721 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25286.721 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25287.193 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:02 25287.193 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:03 25287.356 WRN [Improved Hordes] [Scout] Current AI command is not scout. 12:02 PM 2022-11-22T12:02:03 25287.357 WRN [Improved Hordes] [Scout] Current AI command is not scout.

Thanks for bringing this up, it's just a warning message I put into the Scout code when there is heatmap activity nearby, but the scouts current instruction is not scouting. This is because I insert a wander instruction for the spawn_delay setting before the scout instruction. I'll put a small workaround into IH-CSMM to bypass the warning message.

FilUnderscore commented 1 year ago

Hi, please create a new issue regarding this functionality if you still require something like it in the A21 version.

Improved Hordes A20 and A21 are very distinct in functionality so this isn't going to be backwards compatible with the new A21 update.