[Bug?] Actors inheriting from SpectralMonster/AlienSpectre1

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.

[Bug?] Actors inheriting from SpectralMonster/AlienSpectre1

Postby DabbingSquidward » Thu Nov 15, 2018 8:01 am

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 DabbingSquidward on Thu Nov 15, 2018 8:16 am, edited 1 time in total.
User avatar
DabbingSquidward
 
Joined: 08 Nov 2017
Location: Germany

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

Postby Blue Shadow » Thu Nov 15, 2018 8:14 am

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
Blue Shadow
 
 
 
Joined: 14 Nov 2010

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

Postby TheMightyHeracross » Thu Nov 15, 2018 8:15 am

Ah, the joys of Strife modding! :P

As Blue Shadow said, according to the Wiki page for A_AlienSpectreDeath, 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 allExpand view
Floor_LowerToLowest(999, 8)
SendToCommunicator(95, 0, 1, 0)


See SendToCommunicator. Some of the other AlienSpectre death scripts are a bit more complex and you'll probably need some simple ACS.
User avatar
TheMightyHeracross
Close Combat!
 
Joined: 18 Aug 2013
Location: Philadelphia, PA
Discord: TheMightyHeracross#1716

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

Postby DabbingSquidward » Thu Nov 15, 2018 8:18 am

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
DabbingSquidward
 
Joined: 08 Nov 2017
Location: Germany

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

Postby DabbingSquidward » Thu Nov 15, 2018 8:58 am

TheMightyHeracross wrote:
Code: Select allExpand view
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 allExpand view
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
DabbingSquidward
 
Joined: 08 Nov 2017
Location: Germany

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

Postby TheMightyHeracross » Thu Nov 15, 2018 9:27 am

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 allExpand view
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 allExpand view
#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
TheMightyHeracross
Close Combat!
 
Joined: 18 Aug 2013
Location: Philadelphia, PA
Discord: TheMightyHeracross#1716

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

Postby Graf Zahl » Thu Nov 15, 2018 10:02 am

Why is ZScript not an option? Then you could just make a copy of the original function and change the names.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby DabbingSquidward » Thu Nov 15, 2018 10:12 am

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
DabbingSquidward
 
Joined: 08 Nov 2017
Location: Germany

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

Postby DabbingSquidward » Thu Nov 15, 2018 10:15 am

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.
User avatar
DabbingSquidward
 
Joined: 08 Nov 2017
Location: Germany


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest