[Tutorial] How to make a sniper!

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: [Tutorial] How to make a sniper!

Post by amv2k9 »

skib wrote:

Code: Select all

SNPG A 4 A_Quake (1,1,0,0) //This makes it shift a bit!
No, no, no. You do not use A_Quake to simulate recoil. You can use A_Recoil. Also, you could use a combination of Offset on a few frames following the shot & the Actor Property Weapon.Kickback. You'd probably also use Get & SetActorPitch to make the weapon "buck" up a bit, depending on what kind of weapon it was, like an automatic rifle, but that's ACS.

A_Quake looks especially dumb when you put it on a weapon you can fire continously, like a chaingun; the quake won't happen till you've let off the button.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: [Tutorial] How to make a sniper!

Post by wildweasel »

If you want the view to bounce, you can use A_SetPitch, but you'll need to know some stuff about Decorate expressions to work it properly.
User avatar
Z86
Posts: 101
Joined: Mon Jan 24, 2011 5:22 pm

Re: [Tutorial] How to make a sniper!

Post by Z86 »

Code: Select all

Actor ~GaussRifle~ : chaingun
{
	Weapon.AmmoType RifleBullet
	Weapon.AmmoUse 1
	Weapon.AmmoGive 0
	AttackSound "weapons/rifle"
	+WEAPON.NOALERT
	states
	{
	Spawn:
		WRIF A -1
		Stop
	Ready:
		NULL A 0 A_JumpIfInventory("zoom",1,"ReadyScope")
	ReadyNoScope:
		RIFG A 1 A_WeaponReady
		Loop
	ReadyScope:
		SCOP A 1 A_WeaponReady
		Loop
	Deselect:
		NULL A 0 A_TakeInventory("zoom",255)
		NULL A 0 A_ZoomFactor(1,ZOOM_INSTANT)
		NULL A 0 A_Lower
		RIFG A 1 A_Lower
		Loop
	Select:
		NULL A 0 A_TakeInventory("zoom",255)
		NULL A 0 A_ZoomFactor(1,ZOOM_INSTANT)
		NULL A 0 A_Raise
		RIFG A 1 A_Raise
		Loop
	Fire:
		NULL A 0 A_AlertMonsters
		NULL A 0 A_JumpIfInventory("zoom",1,"PowerFire")
		RIFG A 0 bright A_RailAttack (150 , 0 , 1 , "none" , "none" , 0 , 0 , "bulletpuff")
		RIFG A 0 bright A_FireCustomMissile("RifleTrailer",0,0,0,8)
		RIFG CB 3 bright
		RIFG A 4
		RIFG DEFGFED 3
		RIFG A 1
		RIFG A 0 A_ReFire
		Goto Ready
	PowerFire:
		SCOP A 0 bright A_RailAttack (250 , 0 , 1 , "none" , "none" , 0 , 0 , "bulletpuff")
		SCOP A 0 bright A_FireCustomMissile("RifleTrailer",0,0,0,8)
		SCOP CB 3 bright
		SCOP A 4
		SCOP D 21
		SCOP A 1
		SCOP A 0 A_ReFire
		Goto Ready
	AltFire:
		NULL A 0 A_JumpIfInventory("Zoom",1,"Reset")
		Goto AltHold
	Reset:
		NULL A 0 A_TakeInventory("zoom",255)
		SCOP A 10 A_ZoomFactor(1)
		Goto Ready
	AltHold:
		NULL A 0 A_GiveInventory("Zoom",1)
		NULL A 0 A_JumpIfInventory("Zoom",5,"Six")
		NULL A 0 A_JumpIfInventory("Zoom",4,"Five")
		NULL A 0 A_JumpIfInventory("Zoom",3,"Four")
		NULL A 0 A_JumpIfInventory("Zoom",2,"Three")
	Two:
		SCOP A 3 A_ZoomFactor(1.2)
		SCOP A 0 A_ReFire
		Goto Ready
	Three:
		SCOP A 3 A_ZoomFactor(1.6)
		SCOP A 0 A_ReFire
		Goto Ready
	Four:
		SCOP A 3 A_ZoomFactor(2.5)
		SCOP A 0 A_ReFire
		Goto Ready
	Five:
		SCOP A 3 A_ZoomFactor(3.6)
		SCOP A 0 A_ReFire
		Goto Ready
	Six:
		SCOP A 3 A_ZoomFactor(5)
		SCOP A 0 A_ReFire
		Goto Ready
	Flash:
		TNT1 A 1 Bright A_Light1
		TNT1 A 3 Bright A_Light2
		TNT1 A 2 A_Light1
		Goto LightDone
	}
}

Actor Zoom : inventory
{
	Inventory.MaxAmount 5
}
Here's my gauss rifle that works like a sniper gun.
RIFG sprites are the nomal gun
SCOP is the zoomed in scope sight

No hacks, no double weapons, multiple levels of zoom.

If my sprite railgun idea gets implemented the two attack functions (shooting rifle trailer and the rail attack) can be made into one.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [Tutorial] How to make a sniper!

Post by NeuralStunner »

Never put a tilde in actor names. It's evil. :(
Locked

Return to “Editing (Archive)”