Creating a projectile

From Eternity Wiki
Jump to navigationJump to search

In this tutorial, we will look at the projectile we made during creating a monster in greater detail.

First off we need to define two files, EDFROOT and EPRJCTLS (or any other name of your choosing). EDFROOT should look like this.

stdinclude("root.edf")

// New projectiles:
lumpinclude("EPRJCTLS") // Change this based on whatever you're calling your equivalent of EPRJCTLS.

Now we'll create a new projectile that replaces the rockets entirely, using solely IWAD assets, within EPRJCTLS.

thingtype DriftingEnergyNuke        // This name is given due to it lazily drifting along before exploding.
{
   basictype PlayerProjectile       // Flags: NOBLOCKMAP | NOGRAVITY | DROPOFF | MISSILE | NOCROSS | SPACMISSILE
   dehackednum 34                   // This tells the engine that this thing type has the same dehackednum as the rocket,
                                    // meaning that players and Cyberdemons will shoot this instead. You can still access
                                    // RocketShot by summoning it though.
   radius 13.0
   height 8.0
   speed 4.0                        // As this is a projectile, this value is used as a constant speed.
   damage 10                        // Damage dealt uses the formula damage*random(1,8).
   seesound keenpn                  // Keen pain sound.
   deathsound keendt                // Keen death sound.
   addflags TRANSLUCENT             // Makes the projectile translucent.

   States
   @"
   Spawn:
      BAL1 AB 1 Bright A_Tracer    // The projectile doesn't have the SEEKERMISSILE flag set so it can't actually
      BAL2 AB 1 Bright A_Tracer    // trace our target, but we're only placing it here for the trail anyways.
      APLS AB 1 Bright A_Tracer
      PLSS AB 1 Bright A_Tracer
      Loop
   Death:
      BAL1 CDE 5 Bright A_Mushroom // A_Mushroom is what gives the explosive property of our projectile.
                                   // It spawns an explosion, and then a number of MancubusShot projectiles.
      Stop                         // As the previous frame has a finite duration, this function is called and
                                   // the projectile will disappear.
   "@
}

Simply going into the game and firing a rocket launcher, being fired at by a Cyberdemon, or using "summon DriftingEnergyNuke" will create this new projectile that we've created. For the projectile we will be using new assets. Like the prior tutorial, we want to import the entries from SS_START to SS_END from the aracnorb from the Realm667 bestiary by James Paddock (Jimmy).

thingtype AracnorbBall
{
   basictype Seeker // This uses a predefined set of flags for this object. basictype FlyingMonster is equivalent
                    // to setting cflags as NOBLOCKMAP | NOGRAVITY | DROPOFF | MISSILE | NOCROSS | SEEKERMISSILE.
                    // SEEKERMISSILE is the flag that allows this to trace targets.
   radius 13.0
   height 8.0
   speed 8.0
   damage 3
   seesound plasma
   deathsound firxpl
   addflags TRANSLUCENT|SPACMISSILE  // This adds the flags so that the projectile is translucent and can activate
                                     // generalised linedefs marked with the MISSILE special activation flag.
   States
   @"
   Spawn:
      ACNF AABB 1 Bright A_GenTracer // This causes the projectile to trace its target. Not calling this would mean that
                                     // the projectile travels in a straight line.
      Loop
   Death:
      ACNF CDEFG 5 Bright
      Stop
   "@
}

We can now put "summon AracnorbBall" in the console to create this projectile, and if we were to create a monster that uses this (which we did in Creating a monster, we would find that it traces our movement.