Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Zulk RS

How to make A weapon's secondary fire not be effected by autoaim?


So, I've made a custom sniper rifle weapon and it works well enough. "Fire" fires the weapon and "Alt fire" controls zoom-in and zoom-out. In my most recent map, I've noticed a problem with autoaim messing with the weapon's targeting. I want to disable the autoaim for this weapon only. I know I can add the flag +WEAPON.NOAUTOAIM in the decorate to disable autoaim on the sniper rifle but that's not exactly what I want.


What I want is that when the weapon is fired without the scope, it will be effected by the player's autoaim settings. However, when the weapon is fired from scope, it will not be effected by autoaim. Anyone know how to do this?


Here's the current code of the weapon:


Actor DtexSniperRifle : Weapon 20048
	Obituary "%o was extremely confused by the Dretex Sniper"
	Radius 20
	Height 16
	Inventory.PickupMessage "Got the mechanically confusing Dretex Sniper"
	Weapon.SelectionOrder 3 
	Weapon.KickBack 60
	Weapon.AmmoGive 20
	Weapon.AmmoType "Clip"
	Weapon.AmmoUse 20
	Weapon.SlotNumber 2
	Decal BulletChip
		DSNP A -1
		DSRP A 0 A_JumpIfInventory("SZoom", 1, "ReadyScope")
		DSRP A 1 A_WeaponReady
		DSCP A 1 A_WeaponReady(WRF_NoBob)
		DSRP D 0 A_TakeInventory("SZoom", 1)
		DSRP D 0 A_ZoomFactor(1.0)
		DSRP D 1 A_Lower
		DSRP D 1 A_Raise
		DSCP A 0 A_JumpIfInventory("SZoom", 1, "FireScope")
		DSRP B 1 Bright A_Light1
		DSRP B 0 A_AlertMonsters
		DSRP A 0 A_PlaySound("weapons/sshotf")
		DSRP C 1 Bright A_FireBullets(0,0,1,175,"BulletPuff")
		DSRP D 35
		DSRP A 1 A_Weaponready
		Goto Ready
		DSCP A 0 A_AlertMonsters
		DSCP A 0 A_PlaySound("weapons/sshotf")
		DSCP A 1 Bright A_FireBullets(0,0,1,175,"BulletPuff")
		DSCP A 35
		Goto ReadyScope
		DSCP A 5 A_WeaponReady(WRF_NoBob)
		DSCP A 0 A_JumpIfInventory ("SZoom", 1, "Zoomout")
		DSCP A 0 A_ZoomFactor(6.0)
		DSCP A 0 A_GiveInventory("SZoom", 1)
		Goto "AltFireDone"
		DSCP A 0 A_ZoomFactor(1.0)
		DSCP A 0 A_TakeInventory("SZoom", 1)
		Goto "AltFireDone"
		DSCP A 5 
		Goto "Ready"

Actor SZoom : Inventory
	Inventory.maxamount 1




Share this post

Link to post

1 answer to this question

Recommended Posts

  • 0

Try using A_ChangeFlag to set the WEAPON.NOAUTOAIM flag when the weapon zooms, and again to clear the flag when the weapon unzooms.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now