GZDoom light pool on weapons fire *solved!*
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
GZDoom light pool on weapons fire *solved!*
OK, I'm about ready to go nuts. I'm trying to do the final modifications and tweeks to my level pack, "The Island."
To see some screenshots of it, go to
http://www.prodigal-game.com/doomwads.html
and look for the section called "Jungle wad" in the middle.
I'm doing final play balancing, simplifying geometry to improve framerate, and modifying weapons.
First, I replaced the pistol with Captain Toenail's "Micro Uzi" from realm 667. Next, I modded both Vanilla doom shotguns to fire much more realistically like a shotgun would, and put in realistic powder flares instead of the comical red ones id made.
But... I've encountered a problem. Because I altered the fundamentals of the guns, I need to recreate their behavior from scratch, which I've never done before. While I figured out nearly everything, the one thing I can't figure out is how to make the gun cast a GZDoom dynamic light pool when fired. This effect is EXTREMELY important for my swamp area (See the screenshot on my website, link above.) I need that light pool to reflect off the fog that is in the air and create a huge, blinding flash when the player fires through the mists. The effect is awesome and adds tons to the atmosphere of the swamp, so I don't want to go without it.
I can't figure out what I'm doing wrong, but it doesn't seem to be set up like a standard GZDoom dynamic light... unless it's just been so long since I made my dynamic lights I've forgotten how to do it... But whatever I try, there is no light pool cast around the player when firing the guns I've modded. I've looked at weapon WADs from Wild-Weasel, but have figured out nothing from them either.
Is there some special command I've gotta give to make the onscreen weapon sprite cast a light pool?
Any help would be awesome...
Ben
To see some screenshots of it, go to
http://www.prodigal-game.com/doomwads.html
and look for the section called "Jungle wad" in the middle.
I'm doing final play balancing, simplifying geometry to improve framerate, and modifying weapons.
First, I replaced the pistol with Captain Toenail's "Micro Uzi" from realm 667. Next, I modded both Vanilla doom shotguns to fire much more realistically like a shotgun would, and put in realistic powder flares instead of the comical red ones id made.
But... I've encountered a problem. Because I altered the fundamentals of the guns, I need to recreate their behavior from scratch, which I've never done before. While I figured out nearly everything, the one thing I can't figure out is how to make the gun cast a GZDoom dynamic light pool when fired. This effect is EXTREMELY important for my swamp area (See the screenshot on my website, link above.) I need that light pool to reflect off the fog that is in the air and create a huge, blinding flash when the player fires through the mists. The effect is awesome and adds tons to the atmosphere of the swamp, so I don't want to go without it.
I can't figure out what I'm doing wrong, but it doesn't seem to be set up like a standard GZDoom dynamic light... unless it's just been so long since I made my dynamic lights I've forgotten how to do it... But whatever I try, there is no light pool cast around the player when firing the guns I've modded. I've looked at weapon WADs from Wild-Weasel, but have figured out nothing from them either.
Is there some special command I've gotta give to make the onscreen weapon sprite cast a light pool?
Any help would be awesome...
Ben
Last edited by real_trisk on Wed May 09, 2012 4:43 pm, edited 1 time in total.
Re: GZDoom light pool on weapons fire
http://zdoom.org/wiki/GLDEFS
There's a light attached to the player class, for its firing frames. When you make a new player class, you need to make a new Object entry for that (If you're using the same sprites, anyway). You don't attach lights directly to weapons.
There's a light attached to the player class, for its firing frames. When you make a new player class, you need to make a new Object entry for that (If you're using the same sprites, anyway). You don't attach lights directly to weapons.
- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
Re: GZDoom light pool on weapons fire
On the PLAYER class! (slaps self) I didn't even look there! No wonder I couldn't find anything about it!
OK, I'll see if I can figure that out and come back if I have any questions. Thanks Ghastly_dragon!
Ben
OK, I'll see if I can figure that out and come back if I have any questions. Thanks Ghastly_dragon!
Ben
Re: GZDoom light pool on weapons fire
Yeah, you can check for the currently equipped weapon, and then have it jump to different Fire states to which you can then link different dynlights as needed.real_trisk wrote:On the PLAYER class! (slaps self) I didn't even look there! No wonder I couldn't find anything about it!
OK, I'll see if I can figure that out and come back if I have any questions. Thanks Ghastly_dragon!
Ben
Oh and
Spoiler:that is awesome. I already know my computer couldn't run it, but that doesn't stop it from being awesome.
- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
Re: GZDoom light pool on weapons fire
OK, I'm still confused and it isn't working... Here's my player definition, mostly copied over from GZDoom.pk3:
//Player
ACTOR ATPlayer : DoomPlayer
{
Player.StartItem MicroUzi
Player.StartItem Fist
Player.StartItem Clip 120
Speed 1
Health 100
Radius 16
Height 56
Mass 100
PainChance 255
Player.DisplayName "Marine"
Player.CrouchSprite "PLYC"
Player.ColorRange 112, 127
Player.Colorset 0, "Green", 0x70, 0x7F, 0x72
Player.Colorset 1, "Gray", 0x60, 0x6F, 0x62
Player.Colorset 2, "Brown", 0x40, 0x4F, 0x42
Player.Colorset 3, "Red", 0x20, 0x2F, 0x22
// Doom Legacy additions
Player.Colorset 4, "Light Gray", 0x58, 0x67, 0x5A
Player.Colorset 5, "Light Brown", 0x38, 0x47, 0x3A
Player.Colorset 6, "Light Red", 0xB0, 0xBF, 0xB2
Player.Colorset 7, "Light Blue", 0xC0, 0xCF, 0xC2
States
{
Spawn:
PLAY A -1
Loop
See:
PLAY ABCD 4
Loop
Missile:
PLAY E 12 BRIGHT Light("ATshotlight")
Goto Spawn
Melee:
PLAY F 6 BRIGHT
Goto Missile
Pain:
PLAY G 4
PLAY G 4 A_Pain
Goto Spawn
Death:
PLAY H 0 A_PlayerSkinCheck("AltSkinDeath")
Death1:
PLAY H 10
PLAY I 10 A_PlayerScream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop
XDeath:
PLAY O 0 A_PlayerSkinCheck("AltSkinXDeath")
XDeath1:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop
AltSkinDeath:
PLAY H 6
PLAY I 6 A_PlayerScream
PLAY JK 6
PLAY L 6 A_NoBlocking
PLAY MNO 6
PLAY P -1
Stop
AltSkinXDeath:
PLAY Q 5 A_PlayerScream
PLAY R 0 A_NoBlocking
PLAY R 5 A_SkullPop
PLAY STUVWX 5
PLAY Y -1
Stop
}
}
Finally, here are the accompanying definitions for ATshotlight in my "Decorations" lump
pointlight ATSHOTGUNLIGHT
{
color 1.0 1.0 .8
size 256
}
object ATshotlight
{
frame PLAYE { light ATSHOTGUNLIGHT }
}
//Player
ACTOR ATPlayer : DoomPlayer
{
Player.StartItem MicroUzi
Player.StartItem Fist
Player.StartItem Clip 120
Speed 1
Health 100
Radius 16
Height 56
Mass 100
PainChance 255
Player.DisplayName "Marine"
Player.CrouchSprite "PLYC"
Player.ColorRange 112, 127
Player.Colorset 0, "Green", 0x70, 0x7F, 0x72
Player.Colorset 1, "Gray", 0x60, 0x6F, 0x62
Player.Colorset 2, "Brown", 0x40, 0x4F, 0x42
Player.Colorset 3, "Red", 0x20, 0x2F, 0x22
// Doom Legacy additions
Player.Colorset 4, "Light Gray", 0x58, 0x67, 0x5A
Player.Colorset 5, "Light Brown", 0x38, 0x47, 0x3A
Player.Colorset 6, "Light Red", 0xB0, 0xBF, 0xB2
Player.Colorset 7, "Light Blue", 0xC0, 0xCF, 0xC2
States
{
Spawn:
PLAY A -1
Loop
See:
PLAY ABCD 4
Loop
Missile:
PLAY E 12 BRIGHT Light("ATshotlight")
Goto Spawn
Melee:
PLAY F 6 BRIGHT
Goto Missile
Pain:
PLAY G 4
PLAY G 4 A_Pain
Goto Spawn
Death:
PLAY H 0 A_PlayerSkinCheck("AltSkinDeath")
Death1:
PLAY H 10
PLAY I 10 A_PlayerScream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop
XDeath:
PLAY O 0 A_PlayerSkinCheck("AltSkinXDeath")
XDeath1:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop
AltSkinDeath:
PLAY H 6
PLAY I 6 A_PlayerScream
PLAY JK 6
PLAY L 6 A_NoBlocking
PLAY MNO 6
PLAY P -1
Stop
AltSkinXDeath:
PLAY Q 5 A_PlayerScream
PLAY R 0 A_NoBlocking
PLAY R 5 A_SkullPop
PLAY STUVWX 5
PLAY Y -1
Stop
}
}
Finally, here are the accompanying definitions for ATshotlight in my "Decorations" lump
pointlight ATSHOTGUNLIGHT
{
color 1.0 1.0 .8
size 256
}
object ATshotlight
{
frame PLAYE { light ATSHOTGUNLIGHT }
}
Re: GZDoom light pool on weapons fire
Hmmm... Well, first off, if you link the light to a frame in Decorate, you don't also have to link it to one in the GLDefs lump. One or the other is fine. If you link it to a frame via GLDefs, keep in mind that that dynlight will *always* show when the specified actor is on that frame regardless of state, whereas when you link it through Decorate, you can use a different light whenever that frame is used.
Re: GZDoom light pool on weapons fire
Bad.real_trisk wrote:mostly copied over from GZDoom.pk3:
Code: Select all
ACTOR ATPlayer : DoomPlayer
{
Player.StartItem MicroUzi
Player.StartItem Fist
Player.StartItem Clip 120
States
{
Missile:
PLAY E 12 BRIGHT Light("ATshotlight")
Goto Spawn
Melee:
PLAY F 6 BRIGHT
Goto Missile
}
}
[wiki]Using inheritance[/wiki] is a necessary skill to learn. Lets you concentrate on what you actually want to do.
Also, since I'm nitpicking, it's lens flare, not lens flair. I don't know if I'd agree lens flare automatically adds flair.

- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: GZDoom light pool on weapons fire
Not unless your protagonist wears some sort of glasses or visor. 

- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
Re: GZDoom light pool on weapons fire
I didn't type "flair," I typed "flare." Correcting people when there isn't a problem isn't cool. Being completely off topic is also not cool.
Alright, amv2k9, now we're getting somewhere! Thanks for the heads up! It's working... sort of. It works on the stock Doom weapons, but mine are screwed up.
Getting rid of the duplicate light definition makes the light flash, but only AFTER the gun finishes firing. On the Uzi and the chaingun, it stays dark as long as the button is held down, then flashes when the fire button is released. For the shotguns, the flash happens immediately AFTER the powder flare disappears. I'm still confused why the id weapons would work and mine wouldn't... If you want, I can post my weapon code, or even post my WAD file for someone to take a look at.
Thanks again for helping!
Ben
P.S. The WAD should work on any Nvidia 8800, 9600 or better, and the equivalent AMD cards. Lower than that might get choppy, but I've cleaned the level architecture up a lot, which has helped the bad framerate areas quite a bit over the last build of the levels.
Alright, amv2k9, now we're getting somewhere! Thanks for the heads up! It's working... sort of. It works on the stock Doom weapons, but mine are screwed up.
Getting rid of the duplicate light definition makes the light flash, but only AFTER the gun finishes firing. On the Uzi and the chaingun, it stays dark as long as the button is held down, then flashes when the fire button is released. For the shotguns, the flash happens immediately AFTER the powder flare disappears. I'm still confused why the id weapons would work and mine wouldn't... If you want, I can post my weapon code, or even post my WAD file for someone to take a look at.
Thanks again for helping!
Ben
P.S. The WAD should work on any Nvidia 8800, 9600 or better, and the equivalent AMD cards. Lower than that might get choppy, but I've cleaned the level architecture up a lot, which has helped the bad framerate areas quite a bit over the last build of the levels.
Re: GZDoom light pool on weapons fire
I'm referring to http://www.prodigal-game.com/doomwads.html where "lens flair" is written twice, as of right now. (Not to power flare.)
- ChronoSeth
- Posts: 1631
- Joined: Mon Jul 05, 2010 2:04 pm
- Location: British Columbia
Re: GZDoom light pool on weapons fire
The light flash is only triggered when A_GunFlash is called, IIRC. Might want to check that first.real_trisk wrote:I didn't type "flair," I typed "flare." Correcting people when there isn't a problem isn't cool. Being completely off topic is also not cool.
Alright, amv2k9, now we're getting somewhere! Thanks for the heads up! It's working... sort of. It works on the stock Doom weapons, but mine are screwed up.
Getting rid of the duplicate light definition makes the light flash, but only AFTER the gun finishes firing. On the Uzi and the chaingun, it stays dark as long as the button is held down, then flashes when the fire button is released. For the shotguns, the flash happens immediately AFTER the powder flare disappears. I'm still confused why the id weapons would work and mine wouldn't... If you want, I can post my weapon code, or even post my WAD file for someone to take a look at.
Thanks again for helping!
Ben
- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
Re: GZDoom light pool on weapons fire
Aww... I thought you might have it for a second, ChronoSeth... but looking into it, I believe A_GunFlash is for making the vanilla doom style "brighten the whole level" style of muzzle flash. I do have those in there, but they don't seem to call the dynamic lights. For kicks, I even added them into the chaingun's firing sequence... but still nothing...
Here's the code for two of my guns:
// --------
//
// Super Shotgun
//
// --------
ACTOR ATSuperShotgun : Weapon replaces SuperShotgun
{
Game Doom
//SpawnID 33
Weapon.SelectionOrder 400
Weapon.AmmoUse 2
Weapon.AmmoGive 16
Weapon.AmmoType "Shell"
attacksound "weapons/sshotf"
Inventory.PickupMessage "$GOTSHOTGUN2"
Decal "BulletChip"
Obituary "$OB_MPSSHOTGUN"
States
{
Ready:
SHT2 A 1 A_WeaponReady
Loop
Deselect:
SHT2 A 1 A_Lower
Loop
Select:
SHT2 A 1 A_Raise
Loop
Fire:
SHT2 A 3
SHT2 K 0 A_GunFlash
SHT2 K 3 BRIGHT A_FireBullets (4,4,24,5,0,1)
SHT2 A 2 BRIGHT
SHT2 A 2
SHT2 B 7
SHT2 C 7 A_CheckReload
SHT2 D 7 A_OpenShotgun2
SHT2 E 7
SHT2 F 7 A_LoadShotgun2
SHT2 G 6
SHT2 H 6 A_CloseShotgun2
SHT2 A 5 A_ReFire
Goto Ready
// unused states
SHT2 B 7
SHT2 A 3
Goto Deselect
Flash:
TNT1 A 3 Bright A_Light2
TNT1 A 2 Bright A_Light1
Goto LightDone
Spawn:
SGN2 A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Chaingun
//
// --------------------------------------------------------------------------
ACTOR ATChaingun : Chaingun replaces Chaingun
{
//Game Doom
//SpawnID 28
//Weapon.SelectionOrder 700
Weapon.AmmoUse 1
Weapon.AmmoGive 100
Weapon.AmmoType "ATClip2"
Inventory.PickupMessage "You got the 10mm minigun!"
Obituary "$OB_MPCHAINGUN"
Decal "BulletChip"
scale .5
States
{
Ready:
ACHG C 1 A_WeaponReady
Loop
Deselect:
ACHG C 1 A_Lower
Loop
Select:
ACHG C 1 A_Raise
Loop
Fire:
ACHF C 1 Bright A_FireCGun
ACHG D 1
ACHF D 1 Bright A_FireCGun
ACHG F 1
ACHF E 1 Bright A_FireCGun
ACHG D 1
ACHF F 1 Bright A_FireCGun
ACHG F 1
ACHG F 0 A_ReFire
Goto Ready
Flash:
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
Goto LightDone
Spawn:
MGN2 A -1
Stop
}
}
Again, the chaingun doesn't light at all until you release the trigger, and the shotgun flashes late...
Any thoughts?
Thanks,
Ben
Here's the code for two of my guns:
// --------
//
// Super Shotgun
//
// --------
ACTOR ATSuperShotgun : Weapon replaces SuperShotgun
{
Game Doom
//SpawnID 33
Weapon.SelectionOrder 400
Weapon.AmmoUse 2
Weapon.AmmoGive 16
Weapon.AmmoType "Shell"
attacksound "weapons/sshotf"
Inventory.PickupMessage "$GOTSHOTGUN2"
Decal "BulletChip"
Obituary "$OB_MPSSHOTGUN"
States
{
Ready:
SHT2 A 1 A_WeaponReady
Loop
Deselect:
SHT2 A 1 A_Lower
Loop
Select:
SHT2 A 1 A_Raise
Loop
Fire:
SHT2 A 3
SHT2 K 0 A_GunFlash
SHT2 K 3 BRIGHT A_FireBullets (4,4,24,5,0,1)
SHT2 A 2 BRIGHT
SHT2 A 2
SHT2 B 7
SHT2 C 7 A_CheckReload
SHT2 D 7 A_OpenShotgun2
SHT2 E 7
SHT2 F 7 A_LoadShotgun2
SHT2 G 6
SHT2 H 6 A_CloseShotgun2
SHT2 A 5 A_ReFire
Goto Ready
// unused states
SHT2 B 7
SHT2 A 3
Goto Deselect
Flash:
TNT1 A 3 Bright A_Light2
TNT1 A 2 Bright A_Light1
Goto LightDone
Spawn:
SGN2 A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Chaingun
//
// --------------------------------------------------------------------------
ACTOR ATChaingun : Chaingun replaces Chaingun
{
//Game Doom
//SpawnID 28
//Weapon.SelectionOrder 700
Weapon.AmmoUse 1
Weapon.AmmoGive 100
Weapon.AmmoType "ATClip2"
Inventory.PickupMessage "You got the 10mm minigun!"
Obituary "$OB_MPCHAINGUN"
Decal "BulletChip"
scale .5
States
{
Ready:
ACHG C 1 A_WeaponReady
Loop
Deselect:
ACHG C 1 A_Lower
Loop
Select:
ACHG C 1 A_Raise
Loop
Fire:
ACHF C 1 Bright A_FireCGun
ACHG D 1
ACHF D 1 Bright A_FireCGun
ACHG F 1
ACHF E 1 Bright A_FireCGun
ACHG D 1
ACHF F 1 Bright A_FireCGun
ACHG F 1
ACHG F 0 A_ReFire
Goto Ready
Flash:
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light1
ACHF H 1
//Goto LightDone
ACHF H 1 Bright A_Light2
ACHF H 1
Goto LightDone
Spawn:
MGN2 A -1
Stop
}
}
Again, the chaingun doesn't light at all until you release the trigger, and the shotgun flashes late...
Any thoughts?
Thanks,
Ben
- cypherphage
- Posts: 213
- Joined: Sun Feb 27, 2011 2:54 am
Re: GZDoom light pool on weapons fire
You could make an invisible harmless projectile, give it a dynamic light, and fire it when your gun fires.
- real_trisk
- Posts: 152
- Joined: Wed Sep 24, 2008 11:19 am
- Location: Minnesota, USA
- Contact:
Re: GZDoom light pool on weapons fire
Hmm... Well, that's certainly a possibility I could pursue if nobody can help me. Thanks for the thought, cypherphage! Let me change tactics here: Does anybody know of ANY weapon mods that actually USE GZDoom light pools on the guns? Perhaps I could learn from one of those. I already learned that WildWeasel's mods don't use it, so I'm not sure what ones might actually have it.
I'm starting to wonder if anybody actually HAS made a weapon mod that uses GZDoom's poorly defined dynamic lights...??
Nobody seems to actually know how it's done.
Thanks to everybody who's trying to help! I'm determined to figure out a way to do it...
Ben
I'm starting to wonder if anybody actually HAS made a weapon mod that uses GZDoom's poorly defined dynamic lights...??

Thanks to everybody who's trying to help! I'm determined to figure out a way to do it...
Ben
Last edited by real_trisk on Mon May 07, 2012 9:50 pm, edited 1 time in total.
- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
Re: GZDoom light pool on weapons fire
A_GunFlash is for calling the Flash state. It by itself does not light up levels. A_Light# however, do. So if you don't want that effect, remove them.