Jump to content

Trying to make a reload animation


Recommended Posts

so i have been trying to make a reload animation for a ported 10MM pistol from fallout i used Weasel tutorial but it doesn't function ive follow the guide to everything said but the reload is buggy before it let me reload the gun even with a full clip and succedetly it didn't reload at all and had infinite ammo for some reason ill leave the code here so that some one can tell me where i got wrong the tutorial

 

Actor Vaultdweller : doomplayer

{
Player.WeaponSlot 2, 10mmPistol

        Player.StartItem "10mmPistol"
        Player.StartItem "ReloadAni10mm", 15
        Player.StartItem "fist"
}

actor 10mmPistol : Weapon
{
     Weapon.SelectionOrder 1900
     Weapon.AmmoType1 "ReloadAni10mm"
     Weapon.AmmoUse1 0
     Weapon.AmmoType2 "10MMClip"
     Weapon.AmmoUse2 0
     Weapon.AmmoGive 20
     Inventory.Pickupmessage "Picked up a pistol."
     +Weapon.Ammo_Optional
     +Weapon.Ammo_CheckBoth
     
     States
     {
     Ready:
     10MM A 1 A_weaponready(WRF_ALLOWRELOAD)
     Loop
     
     Deselect:
     10MM A 1 A_Lower
     Loop
     
     Select:
     10MM A 1 A_Raise
     Loop
     
     Fire:
     10MM A 0  A_JumpIfNoAmmo("Reload")
     10MM A 4
     10MM B 6 A_FireBullets(4,4,-1,6,"BulletPuff",1)
     10MM B 1
     10MM C 5 A_ReFire
     Goto Ready
     
      Reload:
      10MM A 0 A_JumpIfInventory("ReloadAni10mm", 12, 2) // If the gun's full, jump 2 states.
      10MM A 0 A_JumpIfInventory("10mmClip", 1, "ReloadWork") // If there's extra ammo, reload.
      10MM A 1 // Here's where that first line ends up - the gun does nothing and returns to Ready.
      goto ready
     
     ReloadWork:
     10MM A 1
     10MM D 3
     10MM E 3
     10MM E 0 A_GiveInventory("ReloadAni10mm",12)
     10MM G 8 A_TakeInventory("10mmClip", 1)
     10MM E 6
     10MM D 4
     10MM A 3
     ReloadLoop: // Here's where the magic happens!
     TNT1 A 0 A_TakeInventory("10mmClip", 1)
     TNT1 A 0 A_GiveInventory("ReloadAni10mm", 1) // Only give ONE bullet at a time)
     TNT1 A 0 A_JumpIfInventory("ReloadAni10mm", 12, "ReloadFinish") // If it's full, finish up.
     TNT1 A 0 A_JumpIfInventory("10mmClip", 1, "ReloadLoop") // If it's NOT full, keep it rolling.
     Goto ReloadFinish // And if it's not full but there's no reserve ammo, finish up anyway.
     ReloadFinish:
     TNT1 A 8
     10MM A 1 Offset(0,82)
     10MM D 1 Offset(0,72)
     10MM E 1 Offset(0,62)
     10MM F 1 Offset(0,52)
     10MM G 1 Offset(0,44)
     10MM F 1 Offset(0,38)
     10MM E 1 Offset(0,35)
     10MM D 1 Offset(0,32)
     Goto Ready
     
     Flash:
     10MM A 3 Bright A_Light2
     10MM A 3 Bright A_Light1
     10MM A 0 Bright A_Light0
     Goto LightDone
     
     Spawn:
     10MM A -1
     Stop
 }
}

Actor 10MMClip : Ammo replaces Clip
{
 Inventory.Amount 10 // You'll get half this if a monster drops it.
 Inventory.MaxAmount 150
 Ammo.BackpackAmount 30 // How much you'll get out of backpacks or equivalent.
 Ammo.BackpackMaxAmount 300 // The new max amount if player has a backpack.
 Inventory.Icon "CLIPA0" // This displays on the fullscreen HUD.
 Inventory.PickupMessage "Picked up some 10mm ammo."
 States
 {
 Spawn:
  CLIP A -1
  Stop
 }
}

ACTOR ReloadAni10mm : Ammo
{
 Inventory.MaxAmount 12
 +IGNORESKILL
}

Edited by monkeymaster69

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...