Jump to content

The reload button reloads my weapon even if I haven't used it.


Panda

Recommended Posts

I managed to make a weapon that reloads, but even though it doesn't need to reload, if I press the reload button, it reloads again and again no matter how many times I press the button. What can I do so that it only reloads when it needs to refill ammunition, and that it has at least fired a miserable bullet to reload?

 

Spoiler

Actor WPistol_Phantom : Weapon  11025//Rename this!!!
{
  Scale 0.75
  Obituary "%o was splattered by %k pistol"
  Radius 20
  Height 16
  AttackSound "WPSTL10" // "Weapon/PistolFire"
  Inventory.pickupmessage "You got the Pistol"
  Weapon.SelectionOrder 500
  Weapon.SlotNumber 2
  Weapon.kickback 100
  Weapon.ammotype "CLIP"
  Weapon.ammouse 1
  Weapon.ammogive 25
  States
  {
  Spawn:
    3PIS E -1
    Loop
  Ready:
    3PIS A 2 A_WeaponReady(WRF_ALLOWRELOAD)
    3PIS A 0 A_JumpIfInventory("PhantomReload",10,"Reload")
    Loop
  Deselect:
    3PIS A 1 A_Lower
    Loop
  Select:
    3PIS A 1 A_Raise
    Loop
  Fire:
    3PIS A 0 A_JumpIfInventory("PhantomReload",10,"Reload")
    3PIS A 0 A_TakeInventory("Waiting",10)
    3PIS A 1
    3PIS B 1 bright A_FireBullets(3.5, 3.5, -1, 15, "BulletPuff", FBF_NORANDOM,0,0,3,3)
    3PIS CD 1
    3PIS E 1 A_GiveInventory("PhantomReload",1)
    3PIS A 3
    //3PIS A 4 A_ReFire
    Goto Ready
  Reload:
    3PIS JKLMNOPQRS 1
    3PIS T 15 A_PlaySound("9MPKUP10")
    3PIS T 15 A_PlaySound("9MPKUP9")
    3PIS T 10
    3PIS T 2 A_TakeInventory("PhantomReload",12)
    3PIS T 5
    3PIS SRQPONMLKJ 1
    3PIS J 0 A_ReFire
    Goto Ready
  }
}

actor PhantomReload : Inventory
{
  inventory.amount 0
  inventory.maxamount 10
  +INVENTORY.INVBAR
}

 

Share this post


Link to post

Because you're not checking if you have ammo left, the game doesn't automatically know when you run out of ammo, so, as long as the weapon is "ready", if you press the reload key, you'll be able to reload.

I suggest you to check this tutorial, even if outdated, otherwise, I'll show you how I did it.

Share this post


Link to post
19 hours ago, Kan3 said:

Because you're not checking if you have ammo left, the game doesn't automatically know when you run out of ammo, so, as long as the weapon is "ready", if you press the reload key, you'll be able to reload.

I suggest you to check this tutorial, even if outdated, otherwise, I'll show you how I did it.

Thank you very much, it helped me a lot!

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...