[0.4 BETA] TwitchyDoom - Streamer interaction!

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Postby DragonFlayer » Thu May 19, 2022 6:45 pm

DragonFlayer wrote:I'm really loving every bit of this mod!

That said, I had to make a little change to how friendly spawn works, given I tend to pair this up with stuff like Colorful Hell or DoomRL Monster replacers, some monsters can spawn new monsters, and they don't inherit the friendliness or properties/inventory given to the parent monster, so some of their spawns will be hostile to the players, or they will be friendly but lack consistency with how the actual TwitchyDoom ally functions as they lack any of extra properties given to the parent.

So I made an event handler to make any new spawning monster with a friendly master copy the same properties TwitchyDoom gives to friendly spawn, however, I have never done anything in ZScript before, so here's the thing I wrote:

Code: Select allExpand view
Class Friendliness_Handler : EventHandler
{
   override void WorldThingSpawned(WorldEvent e)
   {
      if(!e.Thing.bISMONSTER)
      {
         return;
      }
      Actor mst = e.Thing.Master;
      if(mst)
      {
         if(mst.bFRIENDLY)
         {
            e.Thing.bFRIENDLY = true;
            e.Thing.bNOBLOCKMONST = true;
            e.Thing.bSOLID = false;
            e.Thing.target = mst;
            e.Thing.lastheard = mst;
            if(e.Thing.bCOUNTKILL)
            {
               e.Thing.A_ChangeCountFlags(0);
               e.Thing.bCOUNTKILL = false;
            }
            if(mst.FindInventory("Twitchy_FriendlySpawnProtection"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlySpawnProtection", 1);
            }
            if(mst.FindInventory("Twitchy_FriendlyFireProtection"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlyFireProtection", 1);
            }
            if(mst.FindInventory("Twitchy_FriendlyFollower"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlyFollower", 1);
            }
            if(mst.FindInventory("Twitchy_Username"))
            {
               String username = mst.FindInventory("Twitchy_Username").GetTag();
               Twitchy_Username.Show(e.Thing, username);
            }
         }
      }
   }
}


This works fine, as I said, but there's certain monsters like RLBruiserBrother from DoomRL Monsters that spawn a secondary demon (RLBruiserBrother2) and they are both supposed to also spawn their own respective aura effects as non-monster actors (RLBruiserBroAura) on spawn, that just gets fixed on their position and follows them around to give them this fiery look, however, with this Friendliness Handler I wrote, it seems the original brother does not spawn the aura or it goes somewhere else, I'm kind of stuck to be honest, as I said, I don't know anything about ZScript so I thought using bISMONSTER would allow me to filter those actors out, I'd appreciate any help!


Nevermind the issues! It seems the aura effect for that enemy stops working altogether if the monster goes bShootable = false, so nothing I can do about that without modifying the monster aura, this is what my friendliness handler ended up looking like at the end:

Code: Select allExpand view
Class Friendliness_Handler : EventHandler
{
   override void WorldThingSpawned(WorldEvent e)
   {
      if(!e.Thing.bISMONSTER)
      {
         //Console.Printf("Spawned Actor (" .. e.Thing.GetClassName() ..") is not a Monster");
         //if(e.Thing.Master)
         //{
         //   Console.Printf("Spawned non-Monster Actor (" .. e.Thing.GetClassName() ..") has a Master (" .. e.Thing.Master.GetClassName() ..")");
         //}
         return;
      }
      //Console.Printf("Spawned Actor (" .. e.Thing.GetClassName() .. ") is a Monster");
      Actor mst = e.Thing.Master;
      if(mst)
      {
         //Console.Printf("Spawned Actor (" .. e.Thing.GetClassName() ..") has a Master (" .. mst.GetClassName() ..")");
         if(mst.bFRIENDLY)
         {
            //Console.Printf("Spawned Actor's (" .. e.Thing.GetClassName() ..") Master (" .. mst.GetClassName() ..") is Friendly");
            e.Thing.bFRIENDLY = mst.bFRIENDLY;
            e.Thing.bSHOOTABLE = mst.bSHOOTABLE;
            e.Thing.bNOBLOCKMONST = mst.bNOBLOCKMONST;
            e.Thing.bSOLID = mst.bSOLID;
            e.Thing.target = mst.target;
            e.Thing.lastheard = mst.lastheard;
            if(e.Thing.bCOUNTKILL)
            {
               e.Thing.A_ChangeCountFlags(0);
               e.Thing.bCOUNTKILL = false;
            }
            if(mst.FindInventory("Twitchy_FriendlySpawnProtection"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlySpawnProtection", 1);
            }
            if(mst.FindInventory("Twitchy_FriendlyFireProtection"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlyFireProtection", 1);
            }
            if(mst.FindInventory("Twitchy_FriendlyFollower"))
            {
               e.Thing.GiveInventory("Twitchy_FriendlyFollower", 1);
            }
            if(mst.FindInventory("Twitchy_Username"))
            {
               String username = mst.FindInventory("Twitchy_Username").GetTag();
               Twitchy_Username.Show(e.Thing, username);
            }
            Twitchy_Actor_MapMarker.Show(e.Thing);
         }
      }
   }
}


That said, I wanted to extend this inheritance of properties to raised enemies as well, but I couldn't find anything in the ZScript documentation that lets me inspect which actor revived another, WorldThingRevived only gives you the Thing that was revived, but not the Inflictor, like WorldThingDamaged/Died do, and resurrected monsters don't seem to get a Master pointer like spawned monsters do, it would be neat if there was a way for a raised monster to have information about who raised them, but haven't figured out a way just yet 🤔
User avatar
DragonFlayer
 
Joined: 02 Apr 2019

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Postby theleo_ua » Thu May 26, 2022 1:22 am

hi, I just saw this thread because of Xeotroid's suggestion in other thread

I using same idea as you in twitchydoom, but with another software (so it works not only on twitch, but also on youtube, trovo, goodgame and works with obs studio, so streamlabs is not required)

The only problem is I still use keybindings method, but as I undertdstand, GZDoom dev team will commit https://github.com/coelckers/gzdoom/pull/1541 refresh file functionality soon, so no keybindings will be required anymore

My first question to you: is it correct, that your zscript mod allows current version of gzdoom to read refresh file and execute commands from it?
User avatar
theleo_ua
 
Joined: 07 Feb 2016
Location: Ukraine
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Previous

Return to Gameplay Mods

Who is online

Users browsing this forum: dasho, Gorec and 6 guests