[decorate] Reload Problems

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
MidoriMan
Posts: 29
Joined: Sun Sep 18, 2005 20:41
Location: Working blunders with Decorate.

[decorate] Reload Problems

Post by MidoriMan »

After obtaining a used computer from my sis, I went for what I was missing in GZDoom, decorate, ect. I tried to create a pistol in decorate, but the only problem I faced was that the gun won't go into the reload sequence.

Code: Select all

ACTOR BerettaAmmo : Ammo
{
   Inventory.MaxAmount 8
   Inventory.Icon BGPUA0
}

ACTOR BerettaClip : Ammo
{
   Inventory.MaxAmount 8
   Inventory.Amount 1
   Inventory.PickupSound "ammo/beretta"
   Ammo.BackpackAmount 1
   Ammo.BackpackMaxAmount 8
   Inventory.Icon BGCPA0
   Inventory.PickupMessage "Picked up a Brigadier clip."
   Scale 0.25
   States
   {
   Spawn:
      BGCP A -1
      Stop
   }
}

ACTOR Brigadier : Weapon replaces Pistol
{
   Weapon.SelectionOrder 400
   Inventory.PickupSound "weapons/pgunout"
   Inventory.PickupMessage "Picked up a Beretta Brigadier"
   Weapon.AmmoType1 "BerettaAmmo" //The guns magazine
   Weapon.AmmoType2 "BerettaClip" //The real ammo
   Weapon.AmmoGive 0
   Weapon.AmmoGive2 1
   Weapon.AmmoUse 1
   Weapon.Kickback 70
   Decal bulletchip1
   AttackSound "beretta/fire"
   +AMMO_OPTIONAL
   +NOAUTOFIRE
   Scale 0.25
   States
   {
   Spawn:
      BGPU A -1 bright
      Loop
   Ready:
      TNT1 A 0 A_JumpIfNoAmmo(10)
      BM9H ABCDEFG 1
      BM9G A 2
      BM9H H 2
      BM9G A 2 A_WeaponReady
      BM9G A 0 A_JumpIfInventory("IsReloading",1,15)
      Goto Ready+10
      BM9E BCDEFGHAI 1
      BM9E A 2 A_WeaponReady
      BM9E A 0 A_JumpIfInventory("IsReloading",1,15)
      Goto Ready+19
   Deselect:
      TNT1 A 0 A_JumpIfNoAmmo(9)
      BM9H GFEDCBA 1
      TNT1 A 1 A_Lower
      Goto Deselect+8
      BM9E HGFEDCB 1
      TNT1 A 1 A_Lower
      Goto Deselect+16
   Select:
      TNT1 A 0 A_Raise
      Goto Select
   Fire:
      TNT1 A 0
      TNT1 A 0 A_JumpIfNoAmmo(14)
      TNT1 A 0 BRIGHT A_GunFlash
      BM9F B 1 BRIGHT A_FireBullets(2,2,-1,10,0,1)
      BM9F C 1 BRIGHT
      BM9F DE 1
      TNT1 A 0 A_JumpIfNoAmmo(10)
      BM9F DCB 1
      Goto Ready+9
      BM9F FGH 1
      Goto Ready+19
      BM9E A 1 A_Playsound("weapons/dryfire")
      Goto Ready+19
   //Reload:
      TNT1 A 0 A_JumpIfNoAmmo(6)
      TNT1 A 0 A_JumpIfInventory("BerettaAmmo",4,2)
      TNT1 A 0 A_JumpIfInventory("BerettaClip",1,2)
      TNT1 A 0
      Goto Ready+9
      TNT1 A 0 A_JumpIfInventory("BerettaAmmo",4,2)
      TNT1 A 0 A_JumpIfInventory("BerettaClip",1,2)
      TNT1 A 0
      Goto Ready+19
      TNT1 A 0 A_JumpIfNoAmmo(46)
      BMR1 ABCDE 1
      BMR1 F 6
      BMR1 G 1 A_PlaySound("weapons/pgunout")
      TNT1 A 0 A_TakeInventory("BerettaAmmo",999)
      BMR1 HIJ 1
      BMR1 K 18
      BMR1 L 1
      BMR1 M 1 A_PlaySOund("weapons/pgunin")
      TNT1 A 0 A_TakeInventory("BerettaClip",1)
      TNT1 A 0 A_GiveInventory("BerettaAmmo",999)
      BMR1 NOPQ 1
      BMR1 FEDCB 1
      BMR1 A 6
      BM9C ACEGIKM 1
      TNT1 A 0 A_PlaySOund("weapons/pguncock")
      BM9C OPQR 1
      Goto Ready+9
      BMR2 ABCDE 2
      BMR2 F 6
      BMR2 G 1 A_PlaySound("weapons/pgunout")
      TNT1 A 0 A_TakeInventory("BerettaAmmo",999)
      BMR2 HIJ 2
      BMR2 K 18
      BMR2 L 2
      BMR2 M 2 A_PlaySound("weapons/pgunin")
      TNT1 A 0 A_TakeInventory("BerettaClip",1)
      TNT1 A 0 A_GiveInventory("BerettaAmmo",999)
      BMR2 NOPQ 2
      BMR2 FEDCB 1
      BMR2 A 4
      BM9C BDFHJLN 2
      TNT1 A 0 A_PlaySound("weapons/pguncock")
      BM9C OPQR 2
      Goto Ready+9
  Flash:
     BM9F A 1 BRIGHT
     stop 
   }
So, where exactly in the code did I do wrong?
User avatar
DoomRater
Posts: 397
Joined: Tue Jul 19, 2005 4:14
Location: Programmer's Room, talking to Will Harvey
Contact:

Post by DoomRater »

To get to the reload states, you need the code to jump to Fire + 15.

Code: Select all

 Ready:
      TNT1 A 0 A_JumpIfNoAmmo(10)
      BM9H ABCDEFG 1
      BM9G A 2
      BM9H H 2
      BM9G A 2 A_WeaponReady
      BM9G A 0 A_JumpIfInventory("IsReloading",1,12)
      Goto Ready+10
      BM9E BCDEFGHAI 1
      BM9E A 2 A_WeaponReady
      BM9E A 0 A_JumpIfInventory("IsReloading",1,1)
      Goto Ready+19 
      TNT1 A 0
      Goto Fire + 15
Try that and tell me what happens.
Locked

Return to “Weapon Modding Help & Resources”