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: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:
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!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); } } } } }
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);
}
}
}
}