Can I prevent Project Brutality changing my unique TIDs?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
crowbars82
Posts: 40
Joined: Sun Nov 05, 2017 6:22 pm
Contact:

Can I prevent Project Brutality changing my unique TIDs?

Post by crowbars82 »

Hi everyone!

This is a bit of a weird one, but someone may have had a similar issue with Project Brutality or other mods that randomly change monsters.

I made an ACS script that will spawn monsters near the player using something like:

Code: Select all

SpawnForced ("ZombieMan", acx, acy, acz, UniqueTestNumber);
However, what I have found Project Brutality doing (after digging around in all it's files for references to "Thing_ChangeTID") is when I ask for a ZombieMan to be spawned, Project Brutality will change the ZombieMan into one of it's variants.

This is expected, however, it removes the Vanilla ZombieMan variant that my script spawned and by doing so loses the "UniqueTestNumber" (TID) that I gave it, resetting it to 0.

(And then if Monster Tracking is enabled in the UDV visor mod, UDV will then change that TID into -32427 or something, but I have found a way to deal with this...)

Does anyone have any idea if anything can be done to retain this assigned TID, or is it a case of having to modify/overwrite Project Brutality's code?

Many thanks!
Crow :)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Can I prevent Project Brutality changing my unique TIDs?

Post by Graf Zahl »

Do you really expect this mod to play by the numbers?
I haven't checked the code but it most likely uses some random hack to achieve its thing and if that's the case you have no chance aside from not using the mod.
In general you cannot expect such mods to coexist with complex scripting in a map.
User avatar
crowbars82
Posts: 40
Joined: Sun Nov 05, 2017 6:22 pm
Contact:

Re: Can I prevent Project Brutality changing my unique TIDs?

Post by crowbars82 »

I have been thinking similarly, but I've been searching through the Wiki at what is available that might help.

My actor that spawns a monster is an invisible flat pancake that when stepped on by the player (bumped) it runs a script that gets the player coordinates and spawns monsters.
  • If I use "A_RadiusGive" using the flag "RGF_MONSTERS" (Any monster, be it friend or foe, is eligible) and a massive radius...
  • then I could give every single existing monster some kind of placeholder actor of some description...
  • then spawn in my monster...
  • then somehow find out which monsters don't have the placeholder in their inventory (by looping through all the monsters, which is what I'm trying to work out now)...
  • then whichever monster doesn't have a placeholder must be the monster I just spawned in, so I can maybe give it a TID if there are functions to allow me to do this?
It's a very hopeful idea, but something along these lines just might do the trick!

EDIT

Okay, I have something working...

The script that governs an imp randomly bursting out of the ceiling is as follows:

Code: Select all

script "Crow Hole Imp Wake" (void)
{
	int UniqueImpyTID;
	Radius_Quake2 (0, 2, 40, 0, 128, "NULL");
	str monsterclass = "DoomImp";
	int x = GetActorX (0);
	int y = GetActorY (0);
	int z = GetActorZ (0) + 1000.0;
	UniqueImpyTID = UniqueTID();
	SpawnForced(monsterclass, x, y, z, UniqueImpyTID);
	SpawnForced("CrowLookAllAroundGiver", x, y, z);
	delay(1);
}
The actor "CrowLookAllAroundGiver" is spawned at the same time and has a delay of 35 tics (this allows for Project Brutality to do it's thing where it changes the DoomImp into a Brutal variant), the actor is as follows:

Code: Select all

ACTOR CrowLookAllAroundGiver
{
	States
	{
	Spawn:
		TNT1 D 35
		TNT1 D 0 A_RadiusGive ("CrowLookAllAroundFlag", 64.0, RGF_MONSTERS, 1)
		Stop
	}
}
It uses "A_RadiusGive" to give the following actor to the monster:

Code: Select all

ACTOR CrowLookAllAroundFlag : CustomInventory
{
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A -1
		Stop
	Pickup:
		TNT1 A 1 A_ChangeFlag ("LOOKALLAROUND", TRUE)
		TNT1 A 1 A_ChangeFlag ("QUICKTORETALIATE", TRUE)
		Stop
	}
}
This then changes the flag of the new monster "LOOKALLAROUND" to true, which is what I was after. Sometimes the Imp will fall down and not attack the player as he is facing the other way.

This will do for now! :)
Cacodemon345
Posts: 422
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)
Contact:

Re: Can I prevent Project Brutality changing my unique TIDs?

Post by Cacodemon345 »

Just in case, the next version of PB is supposed to fix the TID problem.
Post Reply

Return to “Scripting”