[Bug?] Actors inheriting from SpectralMonster/AlienSpectre1

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

[Bug?] Actors inheriting from SpectralMonster/AlienSpectre1

Post by StroggVorbis »

So, I've been trying to replace Strife's AlienSpectres with equivalents that don't possess the SPECTRAL flag, making them susceptible to conventional weaponry.
The only problem I face with this is that A_AlienSpectreDeath doesn't respond to the death of my custom actors, meaning I no longer get log changes or QuestItems.
Is this a bug or do I need to provide an adjusted DIALOGUE lump?
Before anyone asks, yes I did give all of them their original ConversationID. :?

EDIT: I looked at the A_AlienSpectralDeath function and if I understood correctly it checks for the actors by name, this would mean that I'm out of luck without using ZScript, as two actors cannot have the same name.
Last edited by StroggVorbis on Thu Nov 15, 2018 7:16 am, edited 1 time in total.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by Blue Shadow »

The function checks for AlienSpectre[1-5] classes specifically to do its thing. So if the caller is none of those classes, it won't do anything.
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by TheMightyHeracross »

Ah, the joys of Strife modding! :P

As Blue Shadow said, according to the Wiki page for [wiki]A_AlienSpectreDeath[/wiki], the function has hard-coded behavior which is different for the five AlienSpectres. Because your monster is not one of these five I am assuming that the function is being called, it's checking the actor, but finding that the actor is not one of those five, and therefore is doing nothing.

Fortunately, you can recreate this behavior using action functions. Call these action functions in the monster's DECORATE instead of the hardcoded function:

Code: Select all

Floor_LowerToLowest(999, 8)
SendToCommunicator(95, 0, 1, 0)
See [wiki]SendToCommunicator[/wiki]. Some of the other AlienSpectre death scripts are a bit more complex and you'll probably need some simple ACS.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by StroggVorbis »

Thank you both for the quick responses, I was in the middle of editing my post and after the page got refreshed I'm just seeing them :D
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by StroggVorbis »

TheMightyHeracross wrote:

Code: Select all

Floor_LowerToLowest(999, 8)
SendToCommunicator(95, 0, 1, 0)
I tried following your example, but still haven't managed to get it to work.

Like this?

Code: Select all

Actor AlienSpecter1 : AlienSpectre1 replaces AlienSpectre1
{
Conversationid 67
-SPECTRAL
States
{
Death:
    AL1P A 6 Bright A_SpectreChunkSmall
    AL1P B 6 Bright A_Scream
    AL1P C 6 Bright A_SpectreChunkSmall
    AL1P DE 6 Bright
    AL1P F 6 Bright A_SpectreChunkSmall
    AL1P G 6 Bright
    AL1P H 6 Bright A_SpectreChunkSmall
    AL1P IJK 6 Bright
    AL1P LM 5 Bright
    AL1P N 5 Bright A_SpectreChunkLarge
    AL1P OPQ 5 Bright
    AL1P R 5 Bright A_AlienSpectreDeath
    TNT1 A 0 Floor_LowerToLowest(999, 8)
    TNT1 A 0 SendToCommunicator(95, 0, 1, 0)
    Stop
}
}
EDIT: It works if I execute both specials from the console, but it's not called from the monster's death state for some reason. I also tried appending A_CallSpecial to them, even though the wiki states this shouldn't be used directly, as it's taken care of internally. :?
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by TheMightyHeracross »

Ah my mistake. You can't run SendToCommunicator in DECORATE like that because it's not actually being run by the player. For the player to get the communicator message the player themself has to execute the function. Looks like we're gonna need ACS.

This is what I got to work:

Code: Select all

Actor AlienSpecter1 : AlienSpectre1 replaces AlienSpectre1
{
Conversationid 67
-SPECTRAL
States
{
Death:
    AL1P A 6 Bright A_SpectreChunkSmall
    AL1P B 6 Bright A_Scream
    AL1P C 6 Bright A_SpectreChunkSmall
    AL1P DE 6 Bright
    AL1P F 6 Bright A_SpectreChunkSmall
    AL1P G 6 Bright
    AL1P H 6 Bright A_SpectreChunkSmall
    AL1P IJK 6 Bright
    AL1P LM 5 Bright
    AL1P N 5 Bright A_SpectreChunkLarge
    AL1P OPQ 5 Bright
    AL1P R 5 Bright ACS_NamedExecuteAlways("Die", 0, 0, 0, 0)
    Stop
}
}
Then, load this script in LOADACS:

Code: Select all

#library "TEST"
#include "zcommon.acs"

script "Die" (void)
{
	Floor_LowerToLowest(999, 8);
	SetActivator(0, AAPTR_PLAYER1);//This changes the activator to the player, so they can receive Blackbird's message.
   SendToCommunicator(95, 0, 1, 0);
}
To test this, make sure you give yourself the Communicator in the console first! You will not receive log messages without the Communicator item.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by Graf Zahl »

Why is ZScript not an option? Then you could just make a copy of the original function and change the names.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by StroggVorbis »

Thanks, this did the trick! Although, is it possible to do this in Decorate only through the help of something like A_RearrangePointers? There must be a way to redirect/transfer the AlienSpectre's SendToCommunicator special pointer to its target/killer, i.e. the player :P
If there isn't, I'm fine with that, it's not that I'm lazy, just that I'm in the middle of another playthrough and adding ACS would make my save unusable. :oops:
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: [Bug?] Actors inheriting from SpectralMonster/AlienSpect

Post by StroggVorbis »

Graf Zahl wrote:Why is ZScript not an option? Then you could just make a copy of the original function and change the names.
I'll try that out too, even though I've got bad feelings that I'll be unable to do this all by myself :?

I'll get back to you guys shall I hit a roadblock :)

EDIT: So, probably not the most elegant solution, but for starters I copied everything from alienspectre.txt inside gzdoom.pk3 into a ZScript lump and edited the names of all spectres to specters, same for the codepointer and its corresponding function and it works as intended. I only had to relocate the conversationIDs from the former Decorate lump into mapinfo, as the .zsc wouldn't accept it. And since the actors in my save file already had the same name, it loaded up without problems. But then I realized I could've avoided all of this trouble by simply adding the +spectral flag to all weapons, what a day :P

EDIT 2: Nevermind, +SPECTRAL can only be applied to projectiles, and this has the unintentional side effect of splash damage not hurting the player.
Post Reply

Return to “Scripting”