A_ReFire Question(Solved)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

A_ReFire Question(Solved)

Postby MrToots » Fri Jan 12, 2018 9:01 pm

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 allExpand view
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 6:01 pm, edited 1 time in total.
User avatar
MrToots
 
Joined: 22 Sep 2017

Re: A_ReFire Question

Postby wildweasel » Sat Jan 13, 2018 12:02 am

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
wildweasel
「お前はもうトースト」[you are already toast.]
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: A_ReFire Question

Postby MrToots » Mon Jan 15, 2018 6:01 pm

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)
User avatar
MrToots
 
Joined: 22 Sep 2017


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest