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!  
