pitching problem with spreading projectile originally autoaiming at an enemy

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!)
User avatar
TIIKKETMASTER
Posts: 32
Joined: Thu Jul 29, 2021 2:02 pm

pitching problem with spreading projectile originally autoaiming at an enemy

Post by TIIKKETMASTER »

Hi all. i am having trouble with projectiles not firing how i intend.

My goal is to make a projectile that fires with the aimed pitch (when you autoaim at an enemy) as well as having a vertical spread for that projectile after it is fired.

i tried various flag combinations to no avail, it either:
-shoots randomly based on 0 pitch
-shoots backwards ( :bang: )
-shoots the specified pitch as an absolute value

this is in decorate, and i am using either A_CustomMissile, or A_FireCustomMissile, since the others do not work in decorate.



oh and to ask a another question (to reduce spam), is there any way i could make autoaim work as long as the enemy is in front of them? like how a monster can target a player if they're in their range of view at all? Thanks! :D
yum13241
Posts: 781
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: pitching problem with spreading projectile originally autoaiming at an enemy

Post by yum13241 »

https://zdoom.org/wiki/A_FireCustomMissile
ZDoom Wiki wrote: Fires a projectile from a Weapon or a CustomInventory. Optionally you can specify an angle and a spawn offset.

If used in a weapon, useammo specifies whether this attack uses ammo or not. This parameter is irrelevant if used in a custom inventory.

The following flags can optionally be used. Multiple flags can be combined by separating them with the pipe character '|'.

FPF_AIMATANGLE — Alternate autoaim behavior, relevant when playing with autoaim. Autoaiming is based off of the projectile's trajectory instead of the player's aim. If this flag is set, the engine looks at the horizontal line of fire projected for the projectile, independent of the player's aim. If the horizontal line of fire cuts close enough to a valid target (again ignoring vertical aim), that projectile will fire directly towards that target. If this flag is not set, the engine looks at the player's horizontal aim. If the horizontal line of fire cuts close enough to a valid target (ignoring vertical aim), the resulting projectile will fire with the vertical angle adjusted to aim directly at the target.
FPF_TRANSFERTRANSLATION — Transfer Translation. The projectile fired uses the same translation as the actor that fired it. In most cases, this will be the player.
FPF_NOAUTOAIM — Disables autoaim for this attack.

pitch becomes relevant with autoaim off. It adjusts the player's vertical aim by the given angle value, like the angle parameter affects the horizontal aim. A positive value makes it fire the missile higher than the player's aim, a negative value makes it fire lower.
You don't need to specify the pitch.

Return to “Scripting”