ProjectileKickback?

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
whirledtsar
Posts: 109
Joined: Mon Mar 12, 2018 10:06 pm

ProjectileKickback?

Post by whirledtsar »

Anybody have experience using this actor property? I just cant get it to have any effect. Tried putting it on the weapon, tried putting it on the projectile fired by said weapon, tried setting it to an extreme value (20000), nothing makes the projectile actually push enemies back. Using GZDoom 4.1.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: ProjectileKickback?

Post by Void Weaver »

In regular cases this property doesn't work only if damage of source projectile\puff is 0 OR its impact target have 0 momentum (if externally stopped for ex.). It also stacks with natural damage thrusting.
Looks that all works correctly:

Code: Select all

Actor PushPistol : Pistol replaces Pistol
{
Weapon.SelectionOrder 1900
Weapon.SlotNumber 2
Weapon.SlotPriority 1
States
{
Fire:
PISG A 4
PISG B 6 A_FireBullets(5.6,0,1,0,"BulletPuff",FBF_USEAMMO|FBF_NORANDOM|FBF_NORANDOMPUFFZ,8192,"PistolBall",0)
PISG B 0 A_PlaySound("weapons/pistol",0)
PISG B 0 A_GunFlash
PISG C 4
PISG B 5 A_ReFire
Goto Ready
}
}

Actor PistolBall : DoomImpBall
{
//Damage 1 //Will work
Damage(1)
//Damage(0) //Wouldn't work
+HITTRACER
ProjectileKickBack 10000
States
{
Death:
//TNT1 A 0 A_GiveInventory("Stoper",1,AAPTR_TRACER) //BUT! If its imact target (projectile's TRACER in this case) will get this item, then property wouldn't work too!
Goto Super::Death
}
}

Actor Stoper : CustomInventory
{
+INVENTORY.ALWAYSPICKUP
Inventory.MaxAmount 0
States
{
Pickup:
TNT1 A 0 A_Stop
Stop
}
}
whirledtsar
Posts: 109
Joined: Mon Mar 12, 2018 10:06 pm

Re: ProjectileKickback?

Post by whirledtsar »

Void Weaver wrote:In regular cases this property doesn't work only if damage of source projectile\puff is 0 OR its impact target have 0 momentum (if externally stopped for ex.). It also stacks with natural damage thrusting.
Looks that all works correctly:
So youre saying it only works if the damage isnt zero and the projectile doesnt stop things on impact? Because my projectile does damage and doesn't stop things, and projectilekickback still does absolutely nothing. Setting Weapon.Kickback on the weapon that fires it also does nothing.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: ProjectileKickback?

Post by Void Weaver »

AFAIK, that is. Mainly restrictions of this property are source's zero damage and possibility to stop movenent on impact.

That's odd. Do you have tried the my example? Is it doesn't work too? Because I tested it on 3.7.0 and 4.1.3 and it works as intended.
Blue Shadow
Posts: 5040
Joined: Sun Nov 14, 2010 12:59 am

Re: ProjectileKickback?

Post by Blue Shadow »

fluffyshambler wrote:Because my projectile does damage and doesn't stop things, and projectilekickback still does absolutely nothing. Setting Weapon.Kickback on the weapon that fires it also does nothing.
Could you upload something that demonstrates the problem so someone can figure out what's wrong?
whirledtsar
Posts: 109
Joined: Mon Mar 12, 2018 10:06 pm

Re: ProjectileKickback?

Post by whirledtsar »

Blue Shadow wrote: Could you upload something that demonstrates the problem so someone can figure out what's wrong?
Sure. Its not really MY weapon btw, I was trying to alter a weapon from the Serpent Arsenal mod for Hexen.
Spoiler:
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: ProjectileKickback?

Post by Void Weaver »

Your ProjectileKickback works absolutelly correct, but for some reason ProjectileKickback property doesn't work in Hexen game. o_0
Probably that's a bug.
Last edited by Void Weaver on Thu Aug 08, 2019 7:18 am, edited 1 time in total.
Blue Shadow
Posts: 5040
Joined: Sun Nov 14, 2010 12:59 am

Re: ProjectileKickback?

Post by Blue Shadow »

All Hexen player classes have the [wiki=Actor_flags#NODAMAGETHRUST]NODAMAGETHRUST[/wiki] flag set. That's why damage kickback is completely ignored in that case.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: ProjectileKickback?

Post by Void Weaver »

Wow, thank you for explanation! :)

So easiest solution is to turn off this flag when the weapon selected and turn it back when de-selected.

Code: Select all

  Select:
    JSPR A 0 A_ChangeFlag("NODAMAGETHRUST",0)
    JSPR A 0 A_JumpIfInventory("Mana1", 3, "SelectGlow")
    JSPR A 1 A_Raise
    Goto Select+2
  SelectGlow:
    JSPR B 1 Bright A_Raise
    Loop
  Deselect:
    JSPR A 0 A_ChangeFlag("NODAMAGETHRUST",1)
    JSPR A 0 A_JumpIfInventory("Mana1", 3, "DeselectGlow")
    JSPR A 1 A_Lower
    Goto Deselect+2
  DeselectGlow:
    JSPR B 1 Bright A_Lower
    Loop
whirledtsar
Posts: 109
Joined: Mon Mar 12, 2018 10:06 pm

Re: ProjectileKickback?

Post by whirledtsar »

Thanks for the help guys, now I can get it working properly.
Protozoare
Posts: 17
Joined: Sat Oct 08, 2022 2:51 am
Preferred Pronouns: He/Him

Re: ProjectileKickback?

Post by Protozoare »

I was wondering, is there a way to reverse projectile kickback, and make the hit monsters be knocked towards the player?
Post Reply

Return to “Scripting”