[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.

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

Postby Void Weaver » Mon Apr 22, 2019 9:35 pm

I tried to make missile with non-lethal temporary "freezing" effect via A_GenericFreezeDeath f-tion, something like as:
Code: Select allExpand view
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
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: A few questions about A_(Generic)FreezeDeath

Postby Graf Zahl » Tue Apr 23, 2019 2:35 am

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A few questions about A_(Generic)FreezeDeath

Postby Void Weaver » Tue Apr 23, 2019 2:59 am

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
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: A few questions about A_(Generic)FreezeDeath

Postby Graf Zahl » Tue Apr 23, 2019 10:54 am

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A few questions about A_(Generic)FreezeDeath

Postby Void Weaver » Tue Apr 23, 2019 1:26 pm

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:
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest