Why is my gun causing the sectors to turn dark until [...]

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
SouthernLion
Posts: 776
Joined: Wed Aug 21, 2013 6:45 pm

Why is my gun causing the sectors to turn dark until [...]

Post by SouthernLion »

Why is my gun causing the sectors to turn dark until I fire a different gun? This is a map set I released a couple years ago, but I was going to do something on it for YouTube and I just realized this side effect of the gun (I don't know how I didn't notice it before?)

Here's a short video of what I mean. Included after is all the relevant scripts pertaining to the gun and shooting it.


Code: Select all

actor Unmaker : Weapon 6508
{
  obituary "%o experienced unbirth."
  radius 20
  height 16
  inventory.pickupmessage "You got the Unmaker! Use its ammo carefully..."
  Weapon.SlotNumber 8
  weapon.selectionorder 9
  weapon.kickback -500
  Weapon.AmmoType "UnmakerShard"
  Weapon.AmmoGive 0
  Weapon.AmmoUse 1
  Inventory.Icon "LGUNA0"
  Decal "BulletChip"
  states
  {
  Ready:
    UNKF A 25 A_WeaponReady
	UNKF B 9 A_WeaponReady
    loop
  Deselect: 
    UNKF AB 1 A_Lower
    loop
  Select:
    UNKF AB 1 A_Raise
    loop
  Fire:
	UNKF B 0 A_SetBlend("ff 00 00", 0.8, 180)
  	UNKF B 20 A_PlaySound("weapons/unmakef")
    UNKF B 10 
    UNKF B 0 A_FireCustomMissile ("UnmakerSkull", 0, 1)
    NONE B 7 A_GunFlash
    UNKF B 6 A_ReFire
    Goto Ready  
  Flash:
    UNKF B 40 bright A_Light(-20)
    stop
  Spawn:
    LGUN A -1
    stop
  }
}

actor UnmakerSkull 6512
{
  Game Doom
  Radius 14
  Height 8
  Speed 90
  Damage (4000)
  Projectile
  +DEHEXPLOSION
  SeeSound "weapons/unmakep"
  DeathSound "weapons/Xfireex"
  states
  {
  Spawn:
    ETHS R 4 bright A_SeekerMissile (10,20)
    loop
  Death: 
    NMBL D 20 bright A_PlaySound("weapons/unmakes",0,1.0,false,ATTN_NONE)
    NMBL E 8 bright
    NMBL F 6 bright ACS_ExecuteAlways(3)
    NMBL G 4 bright
    NMBL H 4 bright A_PlaySound("weapons/unmakee",0,1.0,false,ATTN_NONE)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,23,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,180,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,34,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,0,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,11,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,48,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,118,2)
	NMBL H 0 bright A_CustomMissile("UnmakerFire",15,0,76,2)
    NMBL I 4 A_Explode((4000), 1440, 0)
    stop
  }
}

ACTOR UnmakerFire 6516
{
   Radius 8
   Height 20
   Health 3000
   Speed 25
   Mass 300
   Damage 0
   +DROPOFF
   +FLOORCLIP
   +NOBLOOD
   +NOTARGET
   +THRUGHOST
   Renderstyle Add
   Alpha 0.6
   States
   {
   Spawn:
      NKFR A 1 Bright
      NKFR A 1 Bright
      NKFR A 1 Bright
      NKFR A 4 Bright 
      NKFR BC 4 Bright
      NKFR D 4 Bright 
      NKFR EF 4 Bright
      NKFR G 4 Bright 
      NKFR HI 4 Bright
      NKFR J 4 Bright 
      NKFR KL 4 Bright
      NKFR M 4 Bright 
      NKFR NA 4 Bright
      NKFR B 4 Bright 
      NKFR CD 4 Bright
      NKFR E 4 Bright 
      NKFR FG 4 Bright
      NKFR H 4 Bright 
      NKFR IJ 4 Bright
      NKFR K 4 Bright 
      NKFR LM 4 Bright
      NKFR N 4 Bright 
      NKFR AB 4 Bright
      NKFR C 4 Bright 
      NKFR DE 4 Bright
      NKFR F 4 Bright 
      NKFR GH 4 Bright
      NKFR I 4 Bright 
      NKFR JK 4 Bright
      NKFR L 4 Bright 
      NKFR MN 4 Bright
      Goto Spawn+5
	  Goto Death
   Death:
      NKFR O 5 Bright
      NKFR P 7 Bright
      NKFR Q 10 Bright
      Stop
   }
}

SCRIPT 3 (void)
{
    SetGravity(10.0);
    Delay (40);
    SetGravity(800.0);
}
User avatar
TDRR
Posts: 815
Joined: Sun Mar 11, 2018 4:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Debian 12/ Manjaro
Graphics Processor: nVidia with Vulkan support
Location: Venezuela

Re: Why is my gun causing the sectors to turn dark until [..

Post by TDRR »

A_Light(-20)

Isn't it kinda obvious? :p
Use A_Light1 and A_Light2 like this:
Flash:
UNKF B 5 bright A_Light1
UNKF B 35 bright A_Light2
Goto LightDone

Unless you want your gun to make sectors darker, in that case use a less extreme variation
A_Light(-10) and finish the flash state with "Goto LightDone" so the light is reset back to normal after this.
User avatar
SouthernLion
Posts: 776
Joined: Wed Aug 21, 2013 6:45 pm

Re: Why is my gun causing the sectors to turn dark until [..

Post by SouthernLion »

TDRR wrote:A_Light(-20)

Isn't it kinda obvious? :p
Use A_Light1 and A_Light2 like this:
Flash:
UNKF B 5 bright A_Light1
UNKF B 35 bright A_Light2
Goto LightDone

Unless you want your gun to make sectors darker, in that case use a less extreme variation
A_Light(-10) and finish the flash state with "Goto LightDone" so the light is reset back to normal after this.
DOH! I forgot I had done that. THANK YOU. lol
Post Reply

Return to “Scripting”