A_ReFire Question(Solved)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
MrToots
Posts: 77
Joined: Fri Sep 22, 2017 11:56 am
Contact:

A_ReFire Question(Solved)

Post 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
Last edited by MrToots on Mon Jan 15, 2018 5:01 pm, edited 1 time in total.
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: A_ReFire Question

Post 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.
User avatar
MrToots
Posts: 77
Joined: Fri Sep 22, 2017 11:56 am
Contact:

Re: A_ReFire Question

Post 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)
Post Reply

Return to “Scripting”