Page 1 of 1

A_ReFire Question(Solved)

Posted: Fri Jan 12, 2018 8:01 pm
by MrToots
I'm trying to figure out holding attacks and i'm having a problem I can't seem to figure out

When I hit the fire button it should only take 1 Ammo but it takes 2 instead

Code: Select all

Spawn:
      TNT1 A -1
      loop
   Ready:
      BKNF A 10 A_WeaponReady
	  TNT1 A 0 A_GiveInventory("StaminaAmmo",1)
	  TNT1 A 0 A_TakeInventory("AdrenalineAmmo",1)
      Loop
   Deselect:
      TNT1 A 1 A_Lower
      Loop
   Select:
      BKNF A 1 A_Raise
	  loop
   Fire:
      TNT1 A 0 A_JumpIf(CountInv("StaminaAmmo")<1,"Ready")
	  BKNF B 4 
	  TNT1 A 0 A_TakeInventory("StaminaAmmo",1)
	  TNT1 A 0 A_PlayWeaponSound("Knife/Slash")
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-35,0,-35)
	  BKNF C 2 
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-35,0,-35)
	  BKNF D 2 A_FireCustomMissile("KnifeAttack")
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-35,0,-35)
	  TNT1 A 0 A_WeaponReady(WRF_NOSWITCH)
	  BKNF E 4 
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashGuard",-35,0,-35)
      TNT1 A 0 A_WeaponReady(WRF_NOSWITCH)
	  TNT1 A 0 A_Refire("FireHold")
	  Goto Ready
	FireHold:
	  BKNF B 4
	  TNT1 A 0 A_Refire("FireHold")
	  GoTo FireRelease
	FireRelease:
	  TNT1 A 0 A_TakeInventory("StaminaAmmo",3)
	  TNT1 A 0 A_PlayWeaponSound("Knife/Slash")
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-35,0,-35)
	  BKNF C 2 
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-35,0,-35)
	  BKNF D 2 A_FireCustomMissile("KnifeAttack2")
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-35,0,-35)
	  BKNF E 4 
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",35,0,35)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",20,0,20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",0,0)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-20,0,-20)
	  TNT1 A 0 A_FireCustomMissile("SlashReflect",-35,0,-35)
	  GoTo Ready
the other which I don't have the code for atm is I have a hold for a weapons primary fire and when i tap the button it goes straight to the ReFire instead

I tried fallowing the Wiki page but I can't seem to figure it out

Re: A_ReFire Question

Posted: Fri Jan 12, 2018 11:02 pm
by wildweasel
A_Refire doesn't get cleared until it runs into another A_Refire to check the fire button's pressed status again. If you need to clear it without it responding to the button, try A_ClearRefire at the end of the state.

Re: A_ReFire Question

Posted: Mon Jan 15, 2018 5:01 pm
by MrToots
figured out both problems
the ammo problem was weird,it wasn't using the ammouse at first and thats why I have TakeInventory, but now its using both I got rid of take inventory and it take nothing so I set Ammouse to 0 and that works

the second problem was my mouse was sticking so it thought the button was still held down

man this stuff baffles me sometimes, fun to learn, but baffling(looks at acs...faints)