[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 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.
User avatar
DragonFlayer
Posts: 17
Joined: Tue Apr 02, 2019 11:39 am

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by DragonFlayer »

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 all

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 all

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
theleo_ua
Posts: 149
Joined: Sun Feb 07, 2016 11:38 am
Operating System Version (Optional): Windows 10
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Ukraine

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by theleo_ua »

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
Dan_The_Noob
Posts: 741
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by Dan_The_Noob »

gonna try this at some point soon, just want to know...

can commands be left "blank" or use $dummyormsg as the command somehow?
so as to let doomers who know what they're doing really mess with you?

--edit--
an example would be

!summon <message> and whatever the message is, would be the monster/item?
basically something more generic.
or do i need to set up every single enemy/item with individual !archvile !medkit etc.

---EDIT---

OKAY, so i got commands setup and made a bunch of randomspawners that should work.
BUT not getting anything registering from chat, and chat gets spammed up with the "response" code stuff when triggered.

--EDIT--
the mod doesn't seem to be reading the file or something. also it says "10 commands found" is there somewhere i am meant to add commands in the mod itself? because i only have 9 setup and it was saying 10 before i even edited it to begin with.

got it to write

Code: Select all

SpawnItem|Actor=RandomWeapon|${twitch_last_channel_point_redeemer}|${twitch_last_channel_point_message}
doesn't convert to name or message (setup via Touch Portal) i think it's a reading issue though that keeps GZdoom from doing anything.

--EDIT--
got it to write everything as intended, mod won't read the file in-game for some reason.
kyler_smiler
Posts: 2
Joined: Sat Nov 26, 2022 11:36 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by kyler_smiler »

Having same issue as Dan!
kyler_smiler
Posts: 2
Joined: Sat Nov 26, 2022 11:36 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by kyler_smiler »

Ok, i got it figured out with my issue. you MUST use ZDL 3.1.1
When you're pointing to the .txt, you MUST point it to the folder that the .txt is in. NOT the .txt file

Stoked to start playing with this!
User avatar
Dan_The_Noob
Posts: 741
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by Dan_The_Noob »

got this working with Kyle's help.
commands should be "Appended" to the notepad and include a new line after each one.

anyways...
Is it possible to add some toggles to the options menu to show/hide usernames and play/hide messages for each type of command?
currently friendly monsters dont have nametags but spawned enemies do.

--EDIT--
for the life of me, I can't figure out how to make the usernames appear on friendly monsters at all never mind adding the (ally) tag
and also can't seem to stop friendly monsters from spawning right on top of my head.

--EDIT--
OK I have figured out some things.
-Friendly nametags or effects only work on directly chosen actors (randomspawners don't work)
-Friendly enemies can't damage their own species (far as i can tell)
Friendly monsters can't melee other enemies, for some reason.
Friendly fire protection is preventing melee attacks working on friendlies (I just commented it out for now to fix it)
-Friendly monsters also don't draw aggro because enemies can pass through them.

-Still can't figure out how to stop friendly enemies spawning right on my head.
User avatar
KaosWulf
Posts: 1
Joined: Wed Jan 04, 2023 10:41 am
Operating System Version (Optional): Win 10
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by KaosWulf »

I managed to migrate this over to SAMMI and set up consolidated commands. So now my viewers can redeem channel points and type out the monster they want to appear.
This mod is certainly going to bring some excitement to my live streams; thank you for your work on it!
User avatar
Dan_The_Noob
Posts: 741
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

Post by Dan_The_Noob »

been enjoying this mod thoroughly with a plethora of ridiculous chaos on top.

some fixes for future updates.

-> Friendly Fire Protection causes friendly monster melee to not work <- Most Important
- Possibly some way to make the friendly monsters targetable by enemies or only allow player to walk through them
-some useful behaviour flags like STAYONLIFT, JUMPDOWN etc.

- SpawnItem can't be spawned in line of sight
- GiveItem doesn't work while paused/frozen for UI menus etc.
- SpawnFriendlyMonster needs an option to spawn at a radius to avoid friendlies getting stuck in the wall (perhaps can get the monsters' radius and set that as the spawn radius)
- maybe add all variables to all commands? (NoName, NoLOS etc)
- support for randomspawners on SpawnFriendlyMonster
- Spawns need a "quantity" variable too, to save on line usage
- an option to have the messages from redeems appear in the middle of the screen instead of as a console Log (print message or whatever)
- add redeemers name to monsters on revive (and overwrite revived summoned monster names?)
- make revived allies hostile, when revived via twitchydoom revive (maybe a variable?)

Return to “Gameplay Mods”