Due to a few restrictions on how the Oblige generator code works and my current inability to properly code some new functionality for adding TIDs to actors during generation... I've finally worked out a slightly different method for a new custom trigger plate!
First I have a prefab coded in the prefab.LUA like so:
then it is referenced in the xdoom2.LUA like this:
at the top of the xdoom2.LUA the thing is defined here:
Oblige then generates the thing inside the prefabs into the maps successfully:
then within the DECORATE file I have 2 custom actors:
and:
so when the player 'bumps' into this invisible thing, a script is fired off:
Code: Select all
script 4511 (void)
{
//change the player TID to '0' because Project Brutality changes the player TID to '800' for NET reasons(?)
SetActivator(0, AAPTR_PLAYER1);
int x = GetActorX (0);
int y = GetActorY (0);
int z = GetActorZ (0) + 4.0;
int angle = GetActorAngle (0);
int spawnX = x + cos (angle + 0.50) * 64;
int spawnY = y + sin (angle + 0.50) * 64;
delay(35);
int UniqueWandererTID = UniqueTID();
//print(s:"UniqueWandererTID = ", d:UniqueWandererTID);
Spawn ("WanderingSpawnLoc", spawnX, spawnY, z, UniqueWandererTID);
delay(70);
int IMPspawnX = GetActorX (UniqueWandererTID);
int IMPspawnY = GetActorY (UniqueWandererTID);
int IMPspawnZ = GetActorZ (UniqueWandererTID) + 4.0;
int UniqueImpTID = UniqueTID();
//print(s:"UniqueImpTID = ", d:UniqueImpTID);
Spawn ("TeleportFog", IMPspawnX, IMPspawnY, IMPspawnZ);
Spawn ("DoomImp", IMPspawnX, IMPspawnY, IMPspawnZ, UniqueImpTID);
Thing_Remove(UniqueWandererTID);
Thing_Hate(UniqueImpTID, 0, 0);
}
The idea is that when the player triggers the script, I found that sometimes the Imps that were spawning sometimes got stuck in the walls!
So to improve on this, with some help from
Arctangent's post, the script will spawn an invisible wandering actor who will potter around for a short while, and then the Imp is spawned at the wanderer's X,Y,Z before the wanderer is removed.
Allowing the spawns to have their own unique TIDs allows several spawns to happen in succession (if several trigger-plates happen to spawn near each other), and they are easy to reference in the script.
Thanks to all for your suggestions with all this!
