Action_reload problem

Do you have a question about making weapon mods, or do you just need some tutorials and resources? Ask about all of that here.

Moderator: wildweasel

Locked
User avatar
DuduKrazy
Posts: 402
Joined: Sun Dec 25, 2005 18:59

Action_reload problem

Post by DuduKrazy »

I read the tutorial about the action_reload system and i managed to make it work with a concept wad i'm working on. but i got a problem. i bound the reload button to the R key but when i press it, the weapon doesn't reload at all. when i shoot until the ammo magazine ends, the weapon reloads normally.

Code: Select all

ACTOR Glock19 : Weapon replaces Pistol
{
   Inventory.PickupMessage "Glock 19"
   Inventory.PickupSound "misc/w_pkup"
   Weapon.AmmoGive 0
   Weapon.AmmoGive2 1
   Weapon.AmmoType1 "Glock19Ammo"
   Weapon.AmmoType2 "Glock19Clips"
   Weapon.Ammouse 1
   Weapon.Kickback 40
   +NOAUTOFIRE
   +AMMO_OPTIONAL
   Scale 0.10
   States
   {
   Spawn:
      GL19 A -1
      LOOP
   Ready: 
      GLCK A 1 A_WeaponReady
      GLCK A 0 A_JumpIfInventory("IsReloading",1,18)
      LOOP
   Deselect: 
      GLCK A 1 A_Lower
      LOOP
   Select: 
      GLCK A 1 A_Raise
      LOOP
   Fire:
      GLCK B 0 A_JumpIfNoAmmo(11)
      GLCK B 0 A_Light1
      GLCK B 0 A_PlayWeaponSound("weapons/glock19fire")
      GLCK B 1 Bright A_FireBullets(2,2,-1,5.2,1,1)
      GLCK C 0 A_Light2
      GLCK C 1 Bright
      GLCK D 0 A_Light0
      GLCK D 0 ACS_Execute(287,0,20,random(2,4),0)
      GLCK EFG 1
      Goto Ready
      GLEM A 1 A_Playsound("weapons/dryfire") 
      GLEM BCD 1 
      GLEM A 2
   Reload: 
      TNT1 A 0 A_JumpIfInventory("Glock19Ammo",6,2) 
      TNT1 A 0 A_JumpIfInventory("Glock19Clips",1,2) 
      TNT1 A 0 
      Goto Ready 
      TNT1 A 0 A_TakeInventory("Glock19Ammo",999) 
      GLCR A 2 
      GLCR A 0 A_PlaySound("weapons/glockmagout")  
      GLCR BCDEFGHIJ 2  
      GLCR K 1 A_PlaySound("weapons/glockmagin") 
      GLCR K 0 A_TakeInventory("Glock19Clips",1) 
      GLCR K 0 A_GiveInventory("Glock19Ammo",999) 
      GLCR LMNOP 2
      Goto Ready   
   }
}

Code: Select all

weaponsection dudukrazysguns4

SetSlot 0 Glock19

addkeysection "DuduKrazy's Guns 4" dkgunskeys                    
addmenukey "Reload" +dkguns_reload                    
alias +dkguns_reload "use Action_Reload" 
alias -dkguns_reload "use Action_ReloadCancel" 
defaultbind r +dkguns_reload
User avatar
Lioyd_Irving
Posts: 122
Joined: Sun Dec 30, 2007 15:44
Location: Where ?

Re: Action_reload problem

Post by Lioyd_Irving »

DuduKrazy wrote:I read the tutorial about the action_reload system and i managed to make it work with a concept wad i'm working on. but i got a problem. i bound the reload button to the R key but when i press it, the weapon doesn't reload at all. when i shoot until the ammo magazine ends, the weapon reloads normally.
You could try this...

Code: Select all

      GLCK A 1 A_WeaponReady
      GLCK A 0 A_JumpIfInventory("IsReloading",1,1)
      LOOP
      GLCK A 0
      Goto Reload
Jack the Ripper, Charles Manson and Adolf Hitler all drank water. You criminal scum !
User avatar
wildweasel
DRD Team Admin (Inactive)
Posts: 2132
Joined: Wed Jun 29, 2005 22:00
Location: the Admincave!
Contact:

Post by wildweasel »

Better yet:

Code: Select all

GLCK A 0 A_JumpIfInventory("IsReloading",1,"Reload")
GLCK A 1 A_WeaponReady
Loop
No extra wasted lines making it look dirty.
User avatar
Lioyd_Irving
Posts: 122
Joined: Sun Dec 30, 2007 15:44
Location: Where ?

Post by Lioyd_Irving »

Never heard of that layout...I'll use it.
Jack the Ripper, Charles Manson and Adolf Hitler all drank water. You criminal scum !
Locked

Return to “Weapon Modding Help & Resources”