Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Doomsday

Doom Weapon Reloading

Question

How do I make a weapon reload like in Duke Nukem 3D were after shooting a certain amount of bullets it would play an animation of you reloading your gun?

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 0

You should use an inventory item wich counts as "fake clip" bullets.
Let's say your "clip" has 15 bullets, so you could add to the player one of these fake bullets every time you shoot one.
So if you had enough fake bullets already you could check with "A_JumpIfInventory" to check if your fake clip was completely depleted, and the "A_JumpIfInventory" allows you to jump to another weapon state if it checks as true.
For example:

 

Fire:
TNT1 A 0 A_JumpIfInventory("FakeBullet",15,"FakeReload")

// Before firing it checks if you fired enough bullets to deplete a "clip", if true jumps to FakeReload, if not continues below

 

TNT1 A 0 A_GiveInventory("FakeBullet",1)         //This add a fake bullet to the player to work as a counter everytime you shoot
FIRE A 5
FIRE A 1 A_Refire
Goto Ready

 

FakeReload:
RELO ABCDE 5                                                        //Your reload animation
TNT1 A 0 A_TakeInventory("FakeBullets",15)    // This take your fake bullets to reset the counter
Goto Ready

Share this post


Link to post
  • 0

Of course you need to create the actor first which would act as the counter, something like this should do:

Actor FakeBullets : Inventory
{
Inventory.MaxAmount 15
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×