Recreating Hexen's Action Functions
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Recreating Hexen's Action Functions
I've been working on recreating several of the action functions in Hexen (I'll post those somewhere eventually) such that they can be used anywhere and in more generalized ways, but I often come to ones that I'm not sure how to adequately recreate so I'll ask here about a few of them.
A_IceGuyDie: I know the basics of how this uses the radius and height to determine the spawn box, but I am not entirely sure of the best way to determine how many chunks to spawn. I could spawn a bunch, give them DONTOVERLAP, and then have a full box, but it isn't particularly elegant.This one has been solved.
A_SinkGib: I'm clueless as to this one and all the other functions that use the floorclip property to sink/rise.
A_CMaceAttack: I can handle jumps based on range, but the angle is throwing me off. The only thing I can thing of is A_JumpIfTargetInLOS, but on weapons the fov is ignored. That or some ACS that gets the angle of the calling actor, as well as the position of the calling actor and target.This one is probably done. Unless it there is a bug or something, this should work in the same as A_CMaceAttack.
I want to stay away from ACS as much as I can, but I will use it if I have too. (ACS was required for replication of A_IceSetTics)
Any help would be appreciated.
A_IceGuyDie: I know the basics of how this uses the radius and height to determine the spawn box, but I am not entirely sure of the best way to determine how many chunks to spawn. I could spawn a bunch, give them DONTOVERLAP, and then have a full box, but it isn't particularly elegant.This one has been solved.
A_SinkGib: I'm clueless as to this one and all the other functions that use the floorclip property to sink/rise.
A_CMaceAttack: I can handle jumps based on range, but the angle is throwing me off. The only thing I can thing of is A_JumpIfTargetInLOS, but on weapons the fov is ignored. That or some ACS that gets the angle of the calling actor, as well as the position of the calling actor and target.This one is probably done. Unless it there is a bug or something, this should work in the same as A_CMaceAttack.
I want to stay away from ACS as much as I can, but I will use it if I have too. (ACS was required for replication of A_IceSetTics)
Any help would be appreciated.
Last edited by zrrion the insect on Mon Mar 31, 2014 6:54 pm, edited 3 times in total.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: Recreating Hexen's Action Functions
A_IceGuyDie could be recreated with A_Burst, if you're trying to use a different actor for the chunks.
And if you can find a way to recreate A_CMaceAttack faithfully, let me know. That one's been taunting me for years now. Or, if you think it's worth making a feature request to parameterize the function for modder flexibility, I'd throw my support behind that...
And if you can find a way to recreate A_CMaceAttack faithfully, let me know. That one's been taunting me for years now. Or, if you think it's worth making a feature request to parameterize the function for modder flexibility, I'd throw my support behind that...
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: Recreating Hexen's Action Functions
I had forgotten that A_Burst even existed! I so hardly see it used (I don't think I have ever seen it used actually.) I'll play around with it and see what it does. Thanks!
-
- Lead GZDoom+Raze Developer
- Posts: 49194
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Recreating Hexen's Action Functions
A_IceGuyDie is already globally available (it's defined in Actor, not IceGuy.) And it's nothing more than a combination of A_Stop and A_FreezeDeathChunks.
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: Recreating Hexen's Action Functions
Doing it that way accomplishes nothing though. It doesn't let the player pick the sound that's played, nor does it let the player pick what type of chunk to spawn (or in the player's case, what to spawn in place of IceChunkHead), which is what I'm trying to do. I essentially want to recreate these functions in such away as to allow for parameters.
@Ed, A_Burst works for monsters, but using it on the player crashes things. I may try throwing in A_SkullPop before A_Burst so that the player's view will still be tied to something as I suspect that removing the actor that the player's view is tied to (without moving the view to something else) is making things angry.
EDIT: A_SkullPop fixes the crash.
@Ed, A_Burst works for monsters, but using it on the player crashes things. I may try throwing in A_SkullPop before A_Burst so that the player's view will still be tied to something as I suspect that removing the actor that the player's view is tied to (without moving the view to something else) is making things angry.
EDIT: A_SkullPop fixes the crash.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: Recreating Hexen's Action Functions
Correct. Removing a player will crash the game. This is why a working playerclass NEVER has the Stop command ,unless it's after an infinite-duration (-1) state so it never hits it. I think your idea will work, as it would closely simulate a condition of the ice death, where one chunk is designated as the "skull" to pass the camera to. Personally, though, I would actually suggest spawning a dummy actor which, itself, calls A_Burst, and then make the playerclass invisible. I'm a big fan of being able to use the Resurrect cheat, in case something went wrong and I just wanna jump back into the action. Changing the camera to a popped skull or an ice chunk will prevent that.zrrion the insect wrote:A_Burst works for monsters, but using it on the player crashes things. I may try throwing in A_SkullPop before A_Burst so that the player's view will still be tied to something as I suspect that removing the actor that the player's view is tied to (without moving the view to something else) is making things angry.
EDIT: I guess you got to it faster than I could say anything.

-
- Posts: 1631
- Joined: Mon Jul 05, 2010 2:04 pm
- Location: British Columbia
Re: Recreating Hexen's Action Functions
There are already at least two feature request threads for it.Ed the Bat wrote:Or, if you think it's worth making a feature request to parameterize the function for modder flexibility, I'd throw my support behind that...
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: Recreating Hexen's Action Functions
Ah. I'd seen the one for A_FPunchAttack. I must've missed the one for A_CMaceAttack. I'd love to see any/all of them, really...ChronoSeth wrote:There are already at least two feature request threads for it.Ed the Bat wrote:Or, if you think it's worth making a feature request to parameterize the function for modder flexibility, I'd throw my support behind that...
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: Recreating Hexen's Action Functions
Well, I've got some DECORATE that I believe is close to being a recreation of Hexen's melee attacks.
What it does is do a range limited hit-scan and check to see if the puff hits an actor. If it does not, the angle value decreases and it does another hit-scan, and it decreases on fail and repeat. When the angle is zero or it hits something, the actor's angle is set to the angle of the hit and then does a normal melee.
This code should replicate some of the fighter's fist, it does not keep track of successful punches or do the super punch, all it does is do the angle check stuff.
What it does is do a range limited hit-scan and check to see if the puff hits an actor. If it does not, the angle value decreases and it does another hit-scan, and it decreases on fail and repeat. When the angle is zero or it hits something, the actor's angle is set to the angle of the hit and then does a normal melee.
This code should replicate some of the fighter's fist, it does not keep track of successful punches or do the super punch, all it does is do the angle check stuff.
Code: Select all
ACTOR Zar_FWeapFist : FWeapFist replaces FWeapFist
{
States
{
Fire:
FPCH B 5 Offset (5, 40)
FPCH C 4 Offset (5, 40)
TNT1 A 0 A_SetArg(3,128)//distance to check
TNT1 A 0 A_SetArg(2,64)// 1/2 angle to check
TNT1 A 0 A_SetArg(4,-ARGS[4])
CheckHit1:
TNT1 A 0 A_JumpIfInventory("Fake_FPunchAttack",1,"ExitHit")
TNT1 A 0 A_JumpIf(ARGS[4] >= 0 , "CheckHit2")
TNT1 A 0 A_FireBullets(ARGS[4],0,-1,0,"Fake_FPunchAttack_Puff",FBF_EXPLICITANGLE|FBF_NOFLASH,ARGS[3])
TNT1 A 0 A_SetArg(4,ARGS[4]+1)
Loop
CheckHit2:
TNT1 A 0 A_SetArg(4,ARGS[4])
CheckHit2Loop:
TNT1 A 0 A_JumpIfInventory("Fake_FPunchAttack",1,"ExitHit")
TNT1 A 0 A_JumpIf(ARGS[4] <= 0 , "ExitHit")
TNT1 A 0 A_FireBullets(ARGS[4],0,-1,0,"Fake_FPunchAttack_Puff",FBF_EXPLICITANGLE|FBF_NOFLASH,ARGS[3])
TNT1 A 0 A_SetArg(4,ARGS[4]-1)
Loop
ExitHit:
TNT1 A 0 A_SetAngle(Angle + ARGS[4])
TNT1 A 0 A_JumpIfInventory("Fake_FPunchAttack",3,"Fire2")
TNT1 A 0 A_TakeInventory("Fake_FPunchAttack",999)
FPCH D 4 Offset (5, 40) A_CustomPunch(random(40,55),1,0,"PunchPuff",ARGS[3])//A_FPunchAttack
FPCH C 4 Offset (5, 40)
FPCH B 5 Offset (5, 40) A_ReFire
Goto Ready
Fire2:
FPCH DE 4 Offset (5, 40)
FPCH E 1 Offset (15, 50)
FPCH E 1 Offset (25, 60)
FPCH E 1 Offset (35, 70)
FPCH E 1 Offset (45, 80)
FPCH E 1 Offset (55, 90)
FPCH E 1 Offset (65, 90)
FPCH E 10 Offset (0, 150)
Goto Ready
}
}
ACTOR Fake_FPunchAttack_Puff
{
+NOTIMEFREEZE
-DONTSPLASH
+PUFFONACTORS
+BLOODLESSIMPACT
-ACTIVATEPCROSS
States
{
Spawn:
TNT1 A 1
Stop
Melee:
TNT1 A 1 A_GiveToTarget("Fake_FPunchAttack",1)
Stop
}
}
Actor Fake_FPunchAttack : Inventory
{
Inventory.MaxAmount 1
}
-
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
Re: Recreating Hexen's Action Functions
How about something much cleaner and less frustrating to use? I made such a thing a while back, and just posted it up.
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: Recreating Hexen's Action Functions
I will eventually move it to a custom inventory item, but I wanted to get it up since I was excited that it actually worked. I can make a few changes to mine relatively easily and clean a lot of it up. (Yours actually does some of the things I was thinking of doing to mine) If I end up just using your code I'll credit you.