First, you need the sprites, you can download my zip with basic sprites (very basic)!
Now we add Important factors
Code: Select all
Actor Sniper : weapon replaces shotgun
{
Game Doom
+WEAPON.NOALERT
SpawnID 27
Weapon.SelectionOrder 1300
Weapon.AmmoUse 1
Weapon.AmmoGive 8
Weapon.AmmoType "Clip"
Inventory.PickupMessage "$You got the sniper!”
Obituary "%o was sniped %k."
Code: Select all
States
{
Ready:
SNPG A 1 A_WeaponReady
Loop
Deselect:
SNPG A 1 A_Lower
Loop
Select:
SNPG A 1 A_Raise
Loop
Now we add the fire state
Code: Select all
Fire:
SNPG A 3
SNPG B 7 A_FireBullets (0,0,1,12) //Horizontal angle - 0, Vertical angle - 0 Init. Bullets - 1, Damage - 12
SNPG C 5 A_TakeInventory ("Clip",1) //This is to make it use clips
SNPG C 0 A_PlaySound ("weapons/shotgf", CHAN_WEAPON) //It sounds like the shotgun
SNPG A 4 A_Quake (1,1,0,0) //This makes it shift a bit!
SNPG A 7 A_ReFire
Goto Ready
Code: Select all
actor SniperScope : DoomWeapon 2001
{
Game Doom
+WEAPON.NOALERT
SpawnID 27
Weapon.SelectionOrder 1300
Weapon.AmmoUse 1
Weapon.AmmoGive 8
Weapon.AmmoType "Clip"
Inventory.PickupMessage "$GOTSHOTGUN" // "You got the shotgun!"
Obituary "$OB_MPSHOTGUN" // "%o chewed on %k's boomstick."
States
{
Ready:
SNPS A 1 A_WeaponReady
SNPS A 1 A_ZoomFactor (4) //This decides how far it zooms!
SNPS A 1 Bright A_Light1
Loop
Deselect:
SNPS A 1 A_Lower
Loop
Select:
SNPS A 1 A_Raise
Loop
Fire:
SNPS A 3
SNPS A 7 A_FireBullets (0,0,1,12)
SNPS A 0 A_PlaySound ("weapons/shotgf", CHAN_WEAPON)
SNPS A 0 A_TakeInventory ("Clip",1)
SNPS A 2 A_Quake (1,1,0,0)
SNPS A 7 A_ReFire
Goto Ready
AltFire:
SNPS A 3
SNPS A 3 A_SelectWeapon ("Sniper") //This makes it switch to the sniper!
Goto Ready
Flash: //Not needed!
SHTF A 4 Bright A_Light1
SHTF B 3 Bright A_Light2
Goto LightDone
}
}
Code: Select all
AltFire:
SNPG A 3
SNPG A 3 A_GiveInventory ("SniperScope") //Gives the Scope
SNPG A 3 A_SelectWeapon ("SniperScope") //Selects the Scope
Goto Ready