[SOLVED] A few questions about A_(Generic)FreezeDeath

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
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

[SOLVED] A few questions about A_(Generic)FreezeDeath

Post by Void Weaver »

I tried to make missile with non-lethal temporary "freezing" effect via A_GenericFreezeDeath f-tion, something like as:

Code: Select all

Actor VPlasmaBall : PlasmaBall
{
States
{
Spawn:
    PLSS AB 6 A_RadiusGive("Freezer",65,RGF_MONSTERS|RGF_EXFILTER,1,"RShield")
    Loop
Death:
    PLSE ABCDE 4 A_RadiusGive("Freezer",65,RGF_MONSTERS|RGF_EXFILTER,1,"RShield")
    Stop
}
} 

Actor Freezer : CustomInventory
{
+INVENTORY.ALWAYSPICKUP
Inventory.MaxAmount 0
States
{
Pickup:
"####" "#" 0 A_GenericFreezeDeath
Stop
}
}
In general it works as I expected, but duration of fake freezing seems to be odd randomized and original translation doesn't restores.

So questions itself:
1. What determines the duration of A_GenericFreezeDeath f-tion? And how it can be controlled?
2. In case if duration hardcoded and there no levers to directly control function duration, then how it can be terminated (via another custominventory "unfreezer" for ex.) outside? With exception of calling foe's Pain state ofc.
3. How to restore foe's source translation? I mean I know about A_SetTranslation and Thing_SetTranslation functions, but I dunno values\stringname of default translation vanilla's actors.
Or maybe I should use another methods of translation restoring?
Last edited by Void Weaver on Tue Apr 23, 2019 1:58 pm, edited 2 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A few questions about A_(Generic)FreezeDeath

Post by Graf Zahl »

One word: Ouch!

That won't work because A_FreezeDeath expects to operate on something dead. This functions sets many flags to values that only make sense for a corpse and since it assumes that this corpse will shatter there is no attempt to make it restorable. It also sets a delay counter.

It's A_FreezeDeathChunks that performs the waiting on this timer and that gets immediately disqualified when you want to freeze something alive. And this needs to be operated by the actor itself, you cannot do this from a powerup.

This all means that the actor you want to freeze has to know about this feature and deal with the delay, you cannot enforce it from the outside.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: A few questions about A_(Generic)FreezeDeath

Post by Void Weaver »

Well, I know that's function supposed to be used in Death state(s), but I would to use it as external custom status modifier...
Sooo, does mean yours "Ouch!" that current "feature" will be considered as bug and will be fixed in the next releases and therefore I shouldn't use it anyway? I need know this beforehand.
Graf Zahl wrote:This functions sets many flags to values that only make sense for a corpse and since it assumes that this corpse will shatter there is no attempt to make it restorable. It also sets a delay counter.
Um, maybe I understand something wrong or maybe you don't understand me, but in my case A_FreezeDeath externally called by alive actor do restore its normal activity... a little while later.
Graf Zahl wrote:It's A_FreezeDeathChunks that performs the waiting on this timer and that gets immediately disqualified when you want to freeze something alive. And this needs to be operated by the actor itself, you cannot do this from a powerup.
So this is mean that only A_FreezeDeathChunks handle A_FreezeDeath actual timer, right? Then why "unfreezing" takes a some a bit random duration?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A few questions about A_(Generic)FreezeDeath

Post by Graf Zahl »

Void Weaver wrote:Um, maybe I understand something wrong or maybe you don't understand me, but in my case A_FreezeDeath externally called by alive actor do restore its normal activity... a little while later.
Careful! You are deeply wading in "undefined behavior" territory here!
So this is mean that only A_FreezeDeathChunks handle A_FreezeDeath actual timer, right?
Correctly. Of course you can write your own timing function, but the setup you are using can not call it.
Then why "unfreezing" takes a some a bit random duration?
Because the duration is randomized.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: A few questions about A_(Generic)FreezeDeath

Post by Void Weaver »

Got it. Thank you for clarifying! ^_^

EDIT:
In case if a somebody will looking for A_(Generic)FreezeDeath and A_FreezeDeathChunks source code, it placed here "\zscript\shared\ice.txt":
Spoiler:
Post Reply

Return to “Scripting”