[DECORATE] simple akimbo weapons using getplayer input

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
User avatar
DELTAtheDboi005
Posts: 56
Joined: Tue Apr 05, 2022 3:43 am

[DECORATE] simple akimbo weapons using getplayer input

Post by DELTAtheDboi005 »

Here I am with probably my first tutorial.

The weapon has 3 states when firing: fire, altfire, and finally dualfire

Code: Select all

ACTOR DualPlinkers : TAODWeapon
{
  Weapon.SelectionOrder 1800
  Weapon.AmmoUse1 1
  Weapon.AmmoUse2 1
  Weapon.AmmoGive 100
  Weapon.Slotnumber 9
  Weapon.AmmoType1 "Clip"
  Weapon.AmmoType2 "Clip"
  Weapon.BobStyle "InverseSmooth"
  Weapon.BobSpeed 2.9
  Weapon.BobRangeY 0.6
  Weapon.BobRangeX 0.3
  Obituary "$o% was shredded by k%'s Twin Plinkers"
  Inventory.Pickupmessage "$You got the Akimbo plinkers."
  +weapon.Noautofire
  +WEAPON.WIMPY_WEAPON
  States
  {
  Ready:
    DUL1 A 5 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM|WRF_ALLOWUSER1|WRF_ALLOWUSER2|WRF_ALLOWUSER3|WRF_ALLOWUSER4)
	TNT1 A 0 A_Jumpif(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK & BT_ALTATTACK, "DualFire") //if both buttons are pressed, Jump to DualFire state.
	Loop
  Deselect:
    DUL1 A 1 A_Lower
	NULL A 0 A_LOWER
    Loop
  Select:
    DUL1 A 1 A_Raise
	NULL A 0 A_RAISE
    Loop
  Fire:
	TNT1 A 0 A_Jumpif(GetPlayerInput(INPUT_BUTTONS) & BT_ALTATTACK, "DualFire")//If Pressing Mouse 2, jump to DualFire state.
    TNT1 A 0 A_FireCustomMissile("basicbullet",frandom(3.0,-3.0),1,4,0,0,frandom(2.0,-2.0))
    DUL1 F 1 A_Playsound ("PISTOL1", CHAN_OVERLAP)
	DUL1 F 0 A_ZoomFactor(0.95)
	DUL1 F 0 A_Recoil (1)
	DUL1 F 0 A_ZoomFactor(0.97)
    DUL1 G 1
	DUL1 G 0 A_ZoomFactor(0.99)
    DUL1 G 0 A_ZoomFactor(1)
	DUL1 H 1
	DUL1 A 1
    Goto Ready
  AltFire:
	TNT1 A 0 A_Jumpif(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "DualFire")//If pressing Mouse 1, jump to DualFire state
    TNT1 A 0 A_FireCustomMissile("basicbullet",frandom(3.0,-3.0),1,4,0,0,frandom(2.0,-2.0))
    DUL1 B 1 A_Playsound ("PISTOL1", CHAN_OVERLAP)
	DUL1 B 0 A_ZoomFactor(0.95)
	DUL1 B 0 A_Recoil (1)
	DUL1 B 0 A_ZoomFactor(0.97)
    DUL1 C 1
	DUL1 C 0 A_ZoomFactor(0.99)
    DUL1 C 0 A_ZoomFactor(1)
	DUL1 D 1
	DUL1 A 1
    Goto Ready
  DualFire:
    TNT1 A 0 A_FireCustomMissile("basicbullet",frandom(3.0,-3.0),1,4,0,0,frandom(2.0,-2.0))
	TNT1 A 0 A_FireCustomMissile("basicbullet",frandom(3.0,-3.0),1,-4,0,0,frandom(2.0,-2.0))
    DUL1 I 1 A_Playsound ("PISTOL1",CHAN_OVERLAP)
	DUL1 I 0 A_ZoomFactor(0.95)
	DUL1 I 0 A_Recoil (1)
	DUL1 I 0 A_ZoomFactor(0.97)
    DUL1 J 1
	DUL1 J 0 A_ZoomFactor(0.99)
    DUL1 J 0 A_ZoomFactor(1)
	DUL1 K 1
	DUL1 A 1
    Goto Ready
  Spawn:
    PIST A -1
    Stop
  }
}

ACTOR basicbullet
{
  Radius 13
  Height 8
  Speed 100
  Damage 5
  DamageType basic
  Explosiondamage 5
  Explosionradius 5
  Projectile
  Decal Bullethole
  +RANDOMIZE
  +NOGRAVITY
  States
  {
  Spawn:
    PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
	PUFF A 1 Bright A_Spawnitem ("basicTRACER")
    Loop
  Death:
    TNT1 A 0 A_Explode
	TNT1 AAAAAAAAAA 0 A_CustomMissile ("basicspark", 0, 0, random (0, 360), 2, random (0, 360))
    PUFF ABCD 1 Bright
    Stop
  }
}

ACTOR basicTRACER
{
  Radius 13
  Height 8
  Damage 1
  Speed 50
  Projectile
  +RANDOMIZE
  +NOGRAVITY
  States
  {
  Spawn:
    PUFF A 4 Bright
    Goto Death
  Death:
    PUFF ABCD 1 Bright
	TNT1 A 1
    Stop
  }
}

ACTOR basicspark
{
  Radius 13
  Height 8
  Speed 12
  Projectile
  +RANDOMIZE
  -NOGRAVITY
  States
  {
  Spawn:
    PUFF A 4 Bright A_Spawnitem ("basicTRACER")
    Loop
  Death:
    PUFF A 1 Bright
	TNT1 A 1
    Stop
  }
}
Here's an optional zscript actor for the weapon.

Code: Select all

Class TAODWEAPON : Weapon
{
	default
	{
	Weapon.Kickback 150;
	Weapon.BobStyle "InverseSmooth";
	Weapon.BobSpeed 4.2;
	Weapon.BobRangeY 0.8;
	Weapon.BobRangeX 0.6;
	}
}
And that concludes the tutorial... It's easy and quick and you can just about make any combination...
You do not have the required permissions to view the files attached to this post.

Return to “Tutorials”