[Request]: Reloading weapons in Decorate tutorial.

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

[Request]: Reloading weapons in Decorate tutorial.

Post by DuduKrazy »

could someone make a tutorial or just tell me what do i do to make a weapon reload in Decorate?
User avatar
wildweasel
DRD Team Admin (Inactive)
Posts: 2132
Joined: Wed Jun 29, 2005 22:00
Location: the Admincave!
Contact:

Post by wildweasel »

I have been meaning to do this anyway...I'll put something together as soon as I can. It's going to be a little difficult to explain how it works though, since it's such a hack.
User avatar
TheDarkArchon
Posts: 1000
Joined: Wed Jul 06, 2005 11:58
Location: What's that fucking smell
Contact:

Post by TheDarkArchon »

I'll do it since I was the first one to make such a hack.
TheDarkArchon presents:
Load those Shellz

This tutorial assumes basic DECORATE weapons knowledge.

Define an ammo type which will define the size of the clip. For Example:

Code: Select all

ACTOR AssaultClip : Ammo
{
     Inventory.MaxAmount 30
     Ammo.BackpackAmount 0
     Ammo.BackpackMaxAmount 30 
     Inventory.Icon TNT1A0 //See endnote [1]
}
Now make this the primary ammo type for your weapon and make your reserve ammo type the secondary ammo. Also add the +AMMO_OPTIONAL flag or instead of reloading, your weapon will switch when it's clip is dry. Example:

Code: Select all

 Weapon.AmmoType1 "AssaultClip" //The weapons clip
 Weapon.AmmoType2 "Clip" //Doom's bullets. 
 Weapon.AmmoGive1 0 //See footnote's [2] and [3]
 Weapon.AmmoGive2 30 //Gives a clips worth of reserve ammo
 +AMMO_OPTIONAL 
Now we get to the state defining. Define your primary fire sequence and make the first state a 0 length, A_JumpIfNoAmmo codepointer which lands on the start of the AltFire sequence.

Code: Select all

  Fire:
    ASRG A 0 BRIGHT A_JumpIfNoAmmo(6)
    ASRF A 0 BRIGHT A_GunFlash
    ASRF A 2 BRIGHT A_FireBullets(2,2,1,8,"BulletPuff",1)
    ASRF B 2 BRIGHT
    ASRG A 2
    ASRG A 0 A_Refire
    Goto Ready
  AltFire:
Now define your reloading sequence:

Code: Select all

  AltFire:
    ASRR ABCD 2
    ASRR E 10 A_PlayWeaponSound("weapons/assaultout")
    ASRR E 8 A_PlayWeaponSound("weapons/assaultin")
    ASRR DCBA 2
    Goto Ready
Now we start adding the stuff that makes the reloading work. First add jump states that check for reserve ammuntion and full clips so reloading doesn't happen if the player has no reserve ammo and/or a full clip.

Code: Select all

  AltFire:
      ASRG A 0 A_JumpIfInventory("AssaultClip",30,2) //Clip check
      ASRG A 0 A_JumpIfInventory("Clip",1,2) //Reserve Check
      ASRG A 1
      Goto Ready
    ASRR ABCD 2
    ASRR E 10 A_PlayWeaponSound("weapons/assaultout")
    ASRR E 8 A_PlayWeaponSound("weapons/assaultin")
    ASRR DCBA 2
    Goto Ready
Then add two 0-length states after the checks during the animation that takes 1 reserve ammo and puts it into the clip.

Code: Select all

  AltFire:
      ASRG A 0 A_JumpIfInventory("AssaultClip",30,2) //Clip check
      ASRG A 0 A_JumpIfInventory("Clip",1,2) //Reserve Check
      ASRG A 1
      Goto Ready

    ASRR ABCD 2
    ASRR E 10 A_PlayWeaponSound("weapons/assaultout")
    ASRR E 0 A_GiveInventory("AssaultClip",1)
    ASRR E 0 A_TakeInventory("Clip",1)
    ASRR E 8 A_PlayWeaponSound("weapons/assaultin")
    ASRR DCBA 2
    Goto Ready
Then add 0-length checks for reserve ammo and a full clip. If the clip is full, skip the check for reserve ammo and does the rest of the animation. If the reserve ammo is checked and there is at least 1 available, make it skip to a 0-length state below the reloading animation which then has a goto back to the 0-length state thattakes 1 reserve ammo and puts it into the clip. This is complicated so I will comment the code as best as possible:

Code: Select all

  AltFire:
      ASRG A 0 A_JumpIfInventory("AssaultClip",30,2) //Clip check
      ASRG A 0 A_JumpIfInventory("Clip",1,2) //Reserve Check
      ASRG A 1
      Goto Ready
    ASRR ABCD 2
    ASRR E 10 A_PlayWeaponSound("weapons/assaultout")
    ASRR E 0 A_GiveInventory("AssaultClip",1)
    ASRR E 0 A_TakeInventory("Clip",1)  //Fill clip by 1
    ASGR E 0 A_JumpIfInventory("AssaultClip",30,2) //If clip is full, play rest of animation
    ASGR E 0 A_JumpIfInventory("Clip",1,6) //If reserve is present, jump to   bottom state.
    ASRR E 8 A_PlayWeaponSound("weapons/assaultin")
    ASRR DCBA 2
    Goto Ready
    ASRR E 0 //Reserve jumps lands here
    Goto AltFire+5 //Goes to the part where the clip is incremented
And now you're done making a reloading weapon. Note that the code does not work properly on "I'm Too Young To Die" or "Nightmare"
Locked

Return to “Weapon Modding Help & Resources”