[DECORATE] Making a projectile stick to 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!)
Post Reply
User avatar
Recurracy
Posts: 545
Joined: Fri Dec 19, 2008 12:11 pm

[DECORATE] Making a projectile stick to an enemy?

Post by Recurracy »

Hello again, right now I'm trying to recreate the aerosol can from Blood. But I'm having trouble figuring out how to make the fire stick to an enemy, as if he's actually on fire. Can anyone help?
User avatar
Lagi
Posts: 677
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: [DECORATE] Making a projectile stick to an enemy?

Post by Lagi »

not sure if you want something more complicated than basic stuff

1. if you using hitscan (no projectile, like a bullet) weapon (like https://zdoom.org/wiki/A_FireBullets) they have buff string inside the function (check it on wiki)

create a puff with flag +PUFFONACTORS (so no blood is display)
adjust in Spawn: how long the puff should be display (by amount of letters ABC.. and tic time "3"

Code: Select all

ACTOR burnpuff 
{
  RenderStyle Translucent
  Alpha 0.4
  VSpeed 0.3
  damagetype fire
  +NOBLOCKMAP
  +NOGRAVITY
  +PUFFONACTORS
  States
  {
  Spawn:
    burn ABCABCABCABCABC 3 Bright
    Stop
  }
}

2. if you use some flame projectile for aerosol can

use somewhere in your weapon
TNT1 A 0 A_FireProjectile ("nameofprojectile" ,,,
https://zdoom.org/wiki/A_FireProjectile

create projectile actor, and in Death state of that projectile specify how long the flame should last (its "FHFX STUVW 4" below)

Code: Select all

ACTOR DryHammerMissile
{
  Radius 10
  Height 20
  Speed 30 
  Damage (random(140,200))
  Projectile
  +WINDTHRUST
  +THRUGHOST
  -NOGRAVITY
	Gravity 0.7
	DeathSound "FighterHammerExplode"
  Obituary "$OB_MPFWEAPHAMMERR"
  States
  {
  Spawn:
    DHFX A 2 Bright
    DHFX B 2 Bright A_PlaySound("FighterHammerContinuous")
    DHFX CDEFGH 2 Bright
    Loop
  [b]Death:
    TNT1 A 0 A_Jump (42, 2)
  	TNT1 A 0 A_SpawnItemEx ("justhammer")
	FHFX STUVW 4
    Stop[/b]
  }
}
Jarewill
 
 
Posts: 1766
Joined: Sun Jul 21, 2019 8:54 am

Re: [DECORATE] Making a projectile stick to an enemy?

Post by Jarewill »

Lagi wrote:not sure if you want something more complicated than basic stuff
Sorry to say this, but this won't actually make it stick to the target.

While I am not an expert of Blood, I know which weapon and feature you are talking about.
I'll provide a working example, but keep in mind that you still need to provide the required actors.
Spoiler:
This should work, just copy the +HITTRACER flag and the Death state onto your flame projectile.
User avatar
Lagi
Posts: 677
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: [DECORATE] Making a projectile stick to an enemy?

Post by Lagi »

Jarewill wrote:
Lagi wrote:not sure if you want something more complicated than basic stuff
Sorry to say this, but this won't actually make it stick to the target.
No worries, thank you for hittracer, it can be useful for me

EDIT:

here is what to do to make Puff (not projectile) stick to victim. In case of f.ex. melee attack with fire or explosions (with fire puff effect).
important flags:
+PUFFONACTORS
+PUFFGETSOWNER
+HITTRACER

and

A_Warp(AAPTR_TRACER, 2, 0, -5, 0, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE,"",0.6)
Spoiler:

Code: Select all

ACTOR burnpuff 
{
  RenderStyle Translucent
  Alpha 0.8
  VSpeed 0.3
  damagetype fire
  +NOBLOCKMAP
  +NOGRAVITY
  +PUFFONACTORS
  +PUFFGETSOWNER
  +HITTRACER
  AttackSound "PLRBURN"
  States
  {
 Spawn: 
    burn ABCABCABCABCABC 3 Bright A_Warp(AAPTR_TRACER, 1, 0, -5, 0, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE,"",0.6)
    Stop
  }
}
User avatar
Aerosplinter
Posts: 98
Joined: Wed Feb 01, 2017 2:14 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)

Re: [DECORATE] Making a projectile stick to an enemy?

Post by Aerosplinter »

Is there also a way where the projectile can be able to trigger infighting?

For me, I am trying to make an enemy use projectiles that stick to whoever is struck by that.
Post Reply

Return to “Scripting”