Page 1 of 1

Help for zooming in on a Weapon

PostPosted: Fri Feb 19, 2021 2:43 pm
by ChaingunnerSlayer
it helps I want my assault rifle to have a zoom to shoot, like in brutal Doom, but I don't know how, please help me :D

Re: Help for zooming in on a Weapon

PostPosted: Fri Feb 19, 2021 3:01 pm
by Jarewill
If you are using DECORATE, you will have to first make a dummy inventory item:
Code: Select allExpand view
ACTOR RifleZoomed : Inventory {} 

This will be used to check if the rifle is currently zoomed in or not.
Then make an altfire state which will give or take this item and use the A_ZoomFactor function:
Spoiler:

Then with the ready state, you should also make a RifleZoomed check jump to change the ready state.
This can be skipped if you don't want to change the sprites.
Code: Select allExpand view
Ready:
    TNT1 A 0 A_JumpIfInventory("RifleZoomed",1,2)
    PISG A 1 A_WeaponReady //Replace with unzoomed rifle sprite
    Loop
    PISG B 1 A_WeaponReady 
//Replace with zoomed rifle sprite
    Loop

This should be enough to make a toggle zoom on a weapon.

Re: Help for zooming in on a Weapon

PostPosted: Fri Feb 19, 2021 5:27 pm
by ChaingunnerSlayer
Thanks It served me as WONDERFUL, I just wanted to ask how I do it so that when it is in Zoom, the Animation of the shot is different, that is, with the sprites that "Supposedly" are for when you have zoom.

Beforehand thank you very much!.

Re: Help for zooming in on a Weapon

PostPosted: Sat Feb 20, 2021 10:56 am
by Jarewill
If you are talking about the Fire state while zoomed, it should be done like with the Ready state:
Code: Select allExpand view
    Fire:
        TNT1 A 0 A_JumpIfInventory("RifleZoomed",1,"FireZoomed")
        (....) //Rest of Fire state
    FireZoomed:
        (....) //Fire state while zoomed  

Re: Help for zooming in on a Weapon

PostPosted: Sat Feb 20, 2021 1:14 pm
by ChaingunnerSlayer
Thanks brother, your help has helped me a lot, I did something that (for me) was a problem.
Thanks!