[DECORATE] how do i make a weapon that has laser sighting

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
JetteboyTV
Posts: 52
Joined: Mon Sep 04, 2023 9:17 am

[DECORATE] how do i make a weapon that has laser sighting

Post by JetteboyTV »

How do i make a weapon that has laser sighting similar to this
Screenshot 2023-12-20 133016 (convert.io).jpg
You do not have the required permissions to view the files attached to this post.
Jarewill
 
 
Posts: 1790
Joined: Sun Jul 21, 2019 8:54 am

Re: [DECORATE] how do i make a weapon that has laser sighting

Post by Jarewill »

One way to do this in DECORATE is to create an actor such as this:

Code: Select all

Actor RedDot
{
  +NOGRAVITY
  +NOBLOCKMAP
  +ALWAYSPUFF
  +PUFFONACTORS
  +BLOODLESSIMPACT
  States
  {
  Spawn:
    TNT1 A 1 NoDelay A_SpawnParticle("red",SPF_FULLBRIGHT,1,10)
    Stop
  }
}
And then in your weapon's Ready state fire a 0 damage hitscan attack with that actor set as the bullet puff:

Code: Select all

  Ready:
    SHTG A 0 A_FireBullets(0,0,1,0,"RedDot",FBF_NORANDOMPUFFZ)
    SHTG A 1 A_WeaponReady
    Loop
User avatar
JetteboyTV
Posts: 52
Joined: Mon Sep 04, 2023 9:17 am

Re: [DECORATE] how do i make a weapon that has laser sighting

Post by JetteboyTV »

Jarewill wrote: Wed Dec 20, 2023 4:08 pm One way to do this in DECORATE is to create an actor such as this:

Code: Select all

Actor RedDot
{
  +NOGRAVITY
  +NOBLOCKMAP
  +ALWAYSPUFF
  +PUFFONACTORS
  +BLOODLESSIMPACT
  States
  {
  Spawn:
    TNT1 A 1 NoDelay A_SpawnParticle("red",SPF_FULLBRIGHT,1,10)
    Stop
  }
}
And then in your weapon's Ready state fire a 0 damage hitscan attack with that actor set as the bullet puff:

Code: Select all

  Ready:
    SHTG A 0 A_FireBullets(0,0,1,0,"RedDot",FBF_NORANDOMPUFFZ)
    SHTG A 1 A_WeaponReady
    Loop
how do i make the laser sight leave no decal
Jarewill
 
 
Posts: 1790
Joined: Sun Jul 21, 2019 8:54 am

Re: [DECORATE] how do i make a weapon that has laser sighting

Post by Jarewill »

Instead of making the gun leave the decal, make the bullet puff leave it.
So remove the decal definition from your weapon and create a custom puff that leaves it instead:
Actor NewBulletPuff : BulletPuff {Decal BulletChip}
Then make your weapon use this new puff.
User avatar
JetteboyTV
Posts: 52
Joined: Mon Sep 04, 2023 9:17 am

Re: [DECORATE] how do i make a weapon that has laser sighting

Post by JetteboyTV »

Jarewill wrote: Thu Dec 21, 2023 6:13 pm Instead of making the gun leave the decal, make the bullet puff leave it.
So remove the decal definition from your weapon and create a custom puff that leaves it instead:
Actor NewBulletPuff : BulletPuff {Decal BulletChip}
Then make your weapon use this new puff.
Thanks dude!

Return to “Scripting”