DECORATE. Creating hitscan weapons.

This lesson was made by the requisite 'Mansur Novikov' ,you can leave your requissters in the comments on the site,or in the VKgroup.

This lesson is a continuation of the DECORATE lesson. We make weapons.

Introduction

In Doom there are 2 types of weapons, that shoots shells (missiles, plasma), and that shoots bullets (pistol, shotgun). Guns firing bullets hit the target instantly, so I'll call them hitscan weapons.

Create BulletPuff.

When using a machine gun, a smoke appears at the site of the shot, in the code it is called BulletPuff.

First, let's create BulletPuff for our weapons. To do this, copy the following code to yourself in DECORATE.

actor myPuff
{
	+NoBlockmap 
	+NoTeleport
	+NOGRAVITY
	states 
	{
		Spawn:
		  IFOG AB 2
		Melee:
		  IFOG CDE 4
		  Stop
	}
}

Run through the flags.

  • +NoBlockmap – disables actor collision
  • +NoTeleport – prevents the actor from teleporting.
  • +NoGravity – turns off gravity

Moving on.

Add bulletPuff to Hitscan weapons.

Add the following code to your Decorate:

ACTOR coolGun : Weapon
  {
     Weapon.SelectionOrder 350
     Inventory.PickupSound "misc/usgpickup"
     Weapon.AmmoGive 200
     Weapon.AmmoUse 1
     Weapon.SlotNumber 3
     Weapon.AmmoType "Cell"
     +Floatbob
     AttackSound "weapons/ubersgf" 
     States
     {
     Spawn: 
        SHTG A -1
        Stop
     Ready: 
        SHTG A 1 A_WeaponReady
        Loop 
     Deselect: 
        SHTG A 1 A_Lower
        Loop 
     Select: 
        SHTG A 1 A_Raise
        Loop 
     Fire: 
        SHT2 I 1 A_FireBullets(10, 10, 1, 45, "myPuff")
	SHT2 C 2
	SHT2 DE 5 A_ReFire
        Goto Ready
     }
  }

Amidst all this, we are interested in this line:

Fire: 
  SHT2 I 1 A_FireBullets(10, 10, 1, 45, "myPuff")

Namely, the command A_FireBullets,let's analyze its syntax:

A_FireBullets(scatter_on_axis_x, scatter_on_axis_y, number_of_ammo consumed, minimum_damage, "BulletPuff")
  • scatter_on_axis_x, scatter_on_axis_y – set the deflection of bullets, along the x-axes,y
  • number_of_consumed_cartridges – sets the number of cartridges consumed per shot.
  • minimum_damage – sets the damage from hitting the enemy (multiplied by a random number from 1 to 3)
  • BulletPuff – sets the name of the actor who will appear at the place of the shot.

More on wiki.

Thus, in this line:

SHT2 I 1 A_FireBullets(10, 10, 1, 45, "myPuff")

We have installed:

  • bullet scattering 10 degrees along the x,y,axes,
  • Damage in 45 health units
  • spawn actor myPuff, at the site of the shot.

As a result, the following should be obtained.

Final result.

Пожалуйста отключи блокировщик рекламы, или внеси сайт в белый список!

Please disable your adblocker or whitelist this site!