[DECORATE] Make weapon have laser sight?

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
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

[DECORATE] Make weapon have laser sight?

Post by Graaicko »

Hello. I was wondering if it would be possible to make a hitscan weapon have a laser dot similar to the photos below. It would use a small sprite that is separate from the weapon sprite itself.



User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: [DECORATE] Make weapon have laser sight?

Post by m8f »

Is this solution ok? It uses ACS + ZScript, and ZScript part can be easily converted to Decorate if you don't need customizable color and size.
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: [DECORATE] Make weapon have laser sight?

Post by Graaicko »

Yes, This is actaully what I'm looking for. But I would like the sight to be automatically be toggled on a certain weapon when selected.
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: [DECORATE] Make weapon have laser sight?

Post by m8f »

In this mod, there is a user CVar named m8f_wm_ShowLaserSight. Set it to 1 whenever you want the Laser Sight to be shown, and to 0 when you want the Laser Sight to be hidden.
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: [DECORATE] Make weapon have laser sight?

Post by Graaicko »

m8f wrote:In this mod, there is a user CVar named m8f_wm_ShowLaserSight. Set it to 1 whenever you want the Laser Sight to be shown, and to 0 when you want the Laser Sight to be hidden.
Would you know how I would only apply it to one weapon?
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: [DECORATE] Make weapon have laser sight?

Post by m8f »

If you have to use Decorate, you have to create simple ACS script like here, using SetUserCVar instead of GetCVar(), and call this ACS script from weapon's Select state if you want to enable Laser Sight, and in Deselect state to disable it.

If you can use ZScript, you can set CVars directly. See here.
Post Reply

Return to “Scripting”