Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
asd1994

How do I give my flare effects like sparks and smoke?

Question

So I've been working on a flare gun for awhile and I've almost got it working. It's not really a weapon like in Blood, but more like a tool that lights up dark areas. I've gotten the projectile firing working, it has an arc and bounces off walls and stuff. All I want to do now is give the flare itself some particle effects like sparks and smoke, but I can't seem to figure out how to do that. Below is all my code for the Flare that I have so far. Flare is the flare itself. The states are crazy because it's supposed to last 30 seconds before going out. If there is a way to condense that, I would like to know. Flare2 are the sparks and Flare3 is the smoke. I've messed around with things like A_ThrowGrenade and A_SpawnProjectile but was unable to get the desired results. I want the sparks to fly out from the flare in any direction in a small arc, and the smoke to rise up from the flare before disappearing. Any suggestions on how to do this?

 

Actor  Flare
{
  Radius 2
  Height 4
  Speed 25
  Projectile
  DamageType Fire
  -NoGravity
  +NoExplodeFloor
  +NoDamageThrust
  +DoomBounce
  +BounceOnActors
  BounceType Hexen
  BounceFactor 0.5
  
  States
  {
  Spawn:
    FLAR A 1
    TNT1 A 0 A_PlaySound("Flaregun/ Flare")
    FLAR BCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCDABCDABCDABCDABCDABCD 1 Bright  
    FLAR ABCDABCDABCDABCD 1 Bright  
    FLAR ABCDA 1 Bright
    TNT1 A 1
    Stop
  }
}

Actor Flare2 
{
  Radius 1
  Height 1
  Speed 25
  Projectile
  +NoGravity
  +Ghost
  States
  {
  Spawn:
    TNT1 A 1
    FLAR E 5 bright Bright A_ThrowGrenade("Flare3", (random(-8,-16)), (random(-1,1)), (random(-8,8)))
    TNT1 A -1
    Stop
  }
}

Actor Flare3
{
  Scale 0.5
  RenderStyle "Translucent"
  Alpha 0.5
  Radius 1
  Height 1
  Speed 25
  Projectile
  +NoGravity
  +Ghost
  States
  {
  Spawn:
    FLAR FGH 10 
    TNT1 A -1
    Stop
  }
}

Share this post


Link to post

17 answers to this question

Recommended Posts

  • 1
Just now, Skully Boots said:

It's not working. I'm getting an error saying that A_ChangeFlag is an invalid Parameter

Well, that's unexpected. Maybe they removed it in newer GZDoom versions?

Anyways here's the fix (REMOVE THE +ROCKETTRAIL FLAG!):

 

Spawn:

TNT1 A 0 A_PlaySound("Flaregun/Fire")

FlareFlying:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1 

TNT1 A 0 A_SpawnItem("RocketSmokeTrail")

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

Death:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

Share this post


Link to post
  • 1
Just now, Skully Boots said:

Also is there a way to make the dynamic light brighter? Thats why I had seperate actors for the sparks. I was gonna use them to add additional lights to make the flare brighter.

Sorry, don't know much about GLDEFS, but try checking out the ZDoom wiki page on it.

 

If you really want to have less smoke you can just change all instances of 262 to 131 and change the FLAR ABCD 1 line to FLAR ABCDABCD 1

Share this post


Link to post
  • 1
2 hours ago, Skully Boots said:

But thats the thing, I don't want the smoke to be covering the flare at all. I want it to rise above it instead of just sticking to where the flare is.

 

So spawn it above the flare instead.

Share this post


Link to post
  • 0

Use +ROCKETTRAIL and it will have the same effect as the rocket.

Using A_SpawnParticle may also help with customizing the effect. Note that it only works in ZDoom 2.8.1, or GZDoom 2.2 onwards. That means it will not work with Zandronum.

Share this post


Link to post
  • 0
36 minutes ago, -TDRR- said:

Use +ROCKETTRAIL and it will have the same effect as the rocket.

Using A_SpawnParticle may also help with customizing the effect. Note that it only works in ZDoom 2.8.1, or GZDoom 2.2 onwards. That means it will not work with Zandronum.

Thanks, I'll give this a try! The mod I'm making the flare gun for is intended for GZDoom since portals will be used.

Share this post


Link to post
  • 0
1 hour ago, -TDRR- said:

Use +ROCKETTRAIL and it will have the same effect as the rocket.

Using A_SpawnParticle may also help with customizing the effect. Note that it only works in ZDoom 2.8.1, or GZDoom 2.2 onwards. That means it will not work with Zandronum.

The rocket trail looks fine when it's in the air, but not so much when on the ground tho

Screenshot_Doom_20190518_160629.png

Share this post


Link to post
  • 0
Just now, Skully Boots said:

The rocket trail looks fine when it's in the air, but not so much when on the ground tho

 

image of the projectile looking terrible

Try using A_ChangeFlag("ROCKETTRAIL", false) on the projectile's death state.

 

Now, because i'm not 100% sure if that can be changed dynamically, here's a backup plan:
Make a separate projectile that has the same animation as the normal flare, and make that spawn on the flare's death state, make sure the separate projectile has this flag: -ROCKETTRAIL

So it won't spawn the usual rocket trail that the regular flare does.

Share this post


Link to post
  • 0
39 minutes ago, -TDRR- said:

Try using A_ChangeFlag("ROCKETTRAIL", false) on the projectile's death state.

 

Now, because i'm not 100% sure if that can be changed dynamically, here's a backup plan:
Make a separate projectile that has the same animation as the normal flare, and make that spawn on the flare's death state, make sure the separate projectile has this flag: -ROCKETTRAIL

So it won't spawn the usual rocket trail that the regular flare does.

The thing is thats not in it's death state. It's "alive" for about 30 seconds and disappears when it dies.

Share this post


Link to post
  • 0
Just now, Skully Boots said:

The thing is thats not in it's death state. It's "alive" for about 30 seconds and disappears when it dies.

Which brings us to the second problem: The code is REALLY messy, here's how you can fix it up:

Define a new actor:

ACTOR FlareLifeTimer : Inventory {Inventory.MaxAmount 262} //1050 tics divided by 4, or, 30 seconds

 

Change your flare's states like so:

 

Spawn:

TNT1 AA 0 A_PlaySound("Flaregun/Fire")

FlareFlying:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

Death:

TNT1 A 0 A_ChangeFlag("ROCKETTRAIL", false)

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

 

Much better and workable, isn't it? Now the flare still lasts exactly 30 seconds, the code is shorter, and the smoking trail stops after hitting something and even then still preserving the same remaining life time the flare had before impact.

Share this post


Link to post
  • 0
5 minutes ago, -TDRR- said:

Which brings us to the second problem: The code is REALLY messy, here's how you can fix it up:

Define a new actor:

ACTOR FlareLifeTimer : Inventory {Inventory.MaxAmount 262} //1050 tics divided by 4, or, 30 seconds

 

Change your flare's states like so:

 

Spawn:

TNT1 A 0 A_PlaySound("Flaregun/Fire")

FlareFlying:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

Death:

TNT1 A 0 A_ChangeFlag("ROCKETTRAIL", false)

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

 

Much better and workable, isn't it? Now the flare still lasts exactly 30 seconds, the code is shorter, and the smoking trail stops after hitting something and even then still preserving the same remaining life time the flare had before impact.

It's not working. I'm getting an error saying that A_ChangeFlag is an invalid Parameter

Share this post


Link to post
  • 0
9 minutes ago, -TDRR- said:

Well, that's unexpected. Maybe they removed it in newer GZDoom versions?

Anyways here's the fix (REMOVE THE +ROCKETTRAIL FLAG!):

 

Spawn:

TNT1 A 0 A_PlaySound("Flaregun/Fire")

FlareFlying:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1 

TNT1 A 0 A_SpawnItem("RocketSmokeTrail")

 TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

 

Death:

TNT1 A 0 A_JumpIfInventory("FlareLifeTimer", 262, "Null")

FLAR ABCD 1

TNT1 A 0 A_GiveInventory("FlareLifeTimer", 1)

Loop

Okay so the only real difference between the new states and my old ones is that the Flairgun/Flare sound doesn't work anymore. Even when I fixed the A_PlaySound error you made (you put Flairgun/Fire by mistake) it still doesn't work. Here's a video of what it's like rn. 

 

Share this post


Link to post
  • 0

That was a very minor error from my part, just swap the A_PlaySound line with this:
TNT1 AA 0 A_PlaySound("Flaregun/Fire")

Share this post


Link to post
  • 0
2 minutes ago, -TDRR- said:

That was a very minor error from my part, just swap the A_PlaySound line with this:
TNT1 AA 0 A_PlaySound("Flaregun/Fire")

You still got the name of the sound wrong lol, but it works now. Only problem I have now is my flare being drowned in smoke. 

Share this post


Link to post
  • 0

Also is there a way to make the dynamic light brighter? Thats why I had seperate actors for the sparks. I was gonna use them to add additional lights to make the flare brighter.

Share this post


Link to post
  • 0
10 minutes ago, -TDRR- said:

Sorry, don't know much about GLDEFS, but try checking out the ZDoom wiki page on it.

 

If you really want to have less smoke you can just change all instances of 262 to 131 and change the FLAR ABCD 1 line to FLAR ABCDABCD 1

But thats the thing, I don't want the smoke to be covering the flare at all. I want it to rise above it instead of just sticking to where the flare is.

Share this post


Link to post
  • 0
31 minutes ago, R4L said:

 

So spawn it above the flare instead.

Oof I'm so stupid lol, thanks xD

Share this post


Link to post
  • 0

Both Flare2 and Flare3 have TNT1 A -1, which means that the actor will be invisible, but it will be there forever, so the game has to keep track of it.  Delete that line from bots actors, and then it will simply cease to exist when it is done doing its thing.

 

Also, Flare2 summons Flare3, but what is causing Flare2 to come into being?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×