Custom Crosshair Not Appearing

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.
Locked
That Blind Guy
Posts: 20
Joined: Fri Mar 10, 2017 8:18 am

Custom Crosshair Not Appearing

Post by That Blind Guy »

I'm trying to make a sniper rifle with 2-stage zoom for my mod. Everything is working perfectly except for the crosshair. I have both files (XHAIRS8.png and XHAIRB8.png) saved immediately below SS_END. I've tried putting them above it, above SS_Start, at the bottom of the wad, in a different folder, nothing I've tried works.

I tried switching to a built-in crosshair on zooming in. Works just fine. Try switching to mine, and there's none to speak of onscreen. I'm obviously missing something here, but I can't place what that is.

Here's the code for the sniper rifle if that will help.

Code: Select all

actor SZ_Rifle : Weapon
{
  obituary "%o was assassinated by %k's sniper rifle."
  attacksound "weapons/rifle"
  inventory.pickupmessage "You got the sniper rifle!"
  radius 25
  height 11
  Tag "Sniper Rifle"
  weapon.selectionorder 1300
  weapon.kickback 100
  weapon.ammotype "SZ_RifleCart"
  weapon.ammotype2 "SZ_RifleCart"
  weapon.ammouse 1
  weapon.ammouse2 0
  +weapon.ammo_checkboth
  weapon.ammogive 10
  Weapon.BobStyle Smooth
  weapon.upsound "weapons/rifleup"
  Decal BulletChip
  states
  {
  Ready:
    SNIG A 0 A_JumpIfInventory("RFZoom", 1, "ReadyScope")
    SNIG A 1 A_WeaponReady
    loop
  ReadyScope:
    TNT1 A 1 A_WeaponReady(WRF_NoBob)
    LOOP
  Deselect:
    TNT1 A 0 A_TakeInventory ("RFZoom", 2)
    TNT1 A 0 A_ZoomFactor(1.0)
    SNIG A 1 A_Lower
    SNIG A 0 A_Lower
    loop
  Select:
    SNIG A 1 A_Raise
    SNIG A 0 A_Raise
    loop
  Fire:
    SNIG A 0 A_JumpIfInventory("RFZoom", 1, "FireScope")
    SNIG B 0 A_FireBullets(12, 12, -1, 40.8, "RiflePuff")
    SNIG B 0 A_SetPitch(pitch - 2)
    SNIG A 1 A_GunFlash
    SNIG AA 1 A_SetPitch(pitch + 1)
    SNIG A 1
    SNIG BCDE 3
    SNIG D 0 A_PlaySound("weapons/riflebolt",CHAN_BODY)
    SNIG FGHB 3
    SNIG A 7
    RFLG D 0 A_ReFire
    goto Ready
  FireScope:
    TNT1 A 0 A_FireBullets(0, 0, 10, 8.1, "RiflePuff")
    TNT1 A 0 A_SetPitch(pitch - 6)
    TNT1 A 1 A_GunFlash
    TNT1 AA 1 A_SetPitch(pitch + 1.5)
    TNT1 AA 1 A_SetPitch(pitch + 1.5)
    TNT1 A 1
    TNT1 AAAA 4
    TNT1 A 0 A_PlaySound("weapons/riflebolt",CHAN_BODY)
    TNT1 AAAA 4
    TNT1 A 20
    TNT1 A 0 A_ReFire
    goto Ready
  AltFire:
    TNT1 A 2 A_WeaponReady(WRF_NoBob)
    TNT1 A 0 A_JumpIfInventory("RFZoom", 2, "ZoomOut")
    TNT1 A 0 A_JumpIfInventory("RFZoom", 1, "Zoom2")
    //fall through
  Zoom1:
    TNT1 A 0 A_SetCrosshair(8)
    TNT1 A 0 A_ZoomFactor(2.0)
    TNT1 A 0 A_GiveInventory ("RFZoom", 1)
    Goto AltFireDone
  Zoom2:
    TNT1 A 0 A_SetCrosshair(8)
    TNT1 A 0 A_ZoomFactor(5.0)
    TNT1 A 0 A_GiveInventory ("RFZoom", 1)
    Goto AltFireDone
  ZoomOut:
    TNT1 A 0 A_SetCrosshair(0)
    TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_TakeInventory ("RFZoom", 2)
    Goto AltFireDone
  AltFireDone:
    TNT1 A 1 A_ReFire
    Goto Ready 
  Flash:
    TNT1 A 0 A_JumpIfInventory("RFZoom", 1, "FlashScope")
    NULL A 0 A_FireCustomMissile("RifCaseSpawn",0,0,2,-4)
    SNIF BA 1 bright A_Light2
    NULL A 2 A_Light1
    RFLF A 0 bright A_Light0
    stop
  FlashScope:
    NULL A 0 A_FireCustomMissile("RifCaseSpawn",0,0,2,-4)
    TNT1 AA 1 bright A_Light2
    NULL A 2 A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    SNIP A -1
    stop
  }
}

actor RFZoom : Inventory
{
  inventory.maxamount 2
}
Thanks in advance!
That Blind Guy
Posts: 20
Joined: Fri Mar 10, 2017 8:18 am

Re: Custom Crosshair Not Appearing

Post by That Blind Guy »

Nevermind, I found a solution. Thank you PillowBlaster for having easy-to-read code. I just used the image as a sprite instead of a custom crosshair. The invisible crosshair is still useful for forcing the player to have none when scoped in. :D
Locked

Return to “Editing (Archive)”