[Zscript or DECORATE] player dash attack?

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
nakkemake
Posts: 237
Joined: Fri Apr 24, 2015 3:31 am
Location: ┌П┐(▀̿Ĺ̯▀̿ ̿)

[Zscript or DECORATE] player dash attack?

Post by nakkemake »

I'm out of ideas how to make player dash forward a certain distance when using melee attack. Should it be Zcript and what parameters should be used or can it be done simply in decorate?
I don't have any fancy code to show whats wrong in it, since I've discarded all that I've tried.

Edit*
I found out that there is a A_RECOIL Decorate parameter, and it can be used for negative values instead of positive, will test it out. Maybe this will solve it.

Edit2*
Now it does dash, BUT the Angle is messed up, sometimes it dashes towards enemy and sometimes it takes sharp 90 degree turns away from enemy. Any idea how to solve this? Can it be done so that the dash would follow the crosshair? Here is the code

Code: Select all

  AltFireBerserk:
    PUNG B 0 A_Recoil (-50)
    PUNG B 0 A_PlaySound("skeleton/swing")
   PUNG B 0 A_PlaySound("usefail")
    PUNG B 5 {a_overlayflags(1, pspf_flip, 1); a_overlayflags(1, pspf_mirror, 1);}
    PUNG C 5 A_Punch
    PUNG D 5 A_Punch
    PUNG C 5 A_Punch
    PUNG B 5 {a_overlayflags(1, pspf_flip, 0); a_overlayflags(1, pspf_mirror, 0);}
    PUNG B 0 
    Goto Ready2
Jarewill
 
 
Posts: 1766
Joined: Sun Jul 21, 2019 8:54 am

Re: [Zscript or DECORATE] player dash attack?

Post by Jarewill »

That is odd, it shouldn't do that.
What I assume is happening, is the weapon recoils the player forwards and it's the punch attack that jerks the camera away.
A_Punch is coded to move the player's camera in the direction of the enemy hit.
If you want it to not do that, you will have to use A_CustomPunch with the CPF_NOTURN flag instead.
User avatar
Virathas
Posts: 249
Joined: Thu Aug 10, 2017 9:38 am

Re: [Zscript or DECORATE] player dash attack?

Post by Virathas »

Not sure how helpful this would be, but a simple "dash" could use something alogn this line:

Code: Select all

	TNT1 A 0 A_ChangeVelocity(25,0,0,CVF_RELATIVE | CVF_REPLACE)
Note that probably you'd need to change Z speed as well, since being on the ground tends to greatly reduce horizontal speed.
(This is actually code for a charge attack, a copy from a weapon that duplicates lost soul attack)
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: [Zscript or DECORATE] player dash attack?

Post by hfc2x »

nakkemake wrote:I'm out of ideas how to make player dash forward a certain distance when using melee attack. Should it be Zcript and what parameters should be used or can it be done simply in decorate?
The only way I can think of doing this, is by doing it in ZScript and using a custom action that sets the player actor's [wiki=Actor_flags#Limited_use]bSkullFly[/wiki] flag to true. That's the Lost Soul and Maulotaur's charge flag. What this does is propel the actor forward at the speed of your choosing, and disables all actions until it collides with an obstacle (sort of making the actor into a temporary projectile), at which point it will call [wiki=ZScript_virtual_functions#Actor]bool Slam(Actor victim)[/wiki], which you can customize to your liking.
User avatar
nakkemake
Posts: 237
Joined: Fri Apr 24, 2015 3:31 am
Location: ┌П┐(▀̿Ĺ̯▀̿ ̿)

Re: [Zscript or DECORATE] player dash attack?

Post by nakkemake »

I implemented A_ChangeVelocity and CPF_NOTURN. It works somewhat better, 90% of the time no random sidebounce versus just "recoil decorate command" 50% of the time random bounce. bSkullfly sound intriguing so I have to try that aswell.

Thanks!
Post Reply

Return to “Scripting”