How to Shoot Different Kinds of RPGs

From EDukeWiki
Jump to navigation Jump to search

When the shoot primitive is used for the RPG, it might not work as you expect, because the RPG is hard-coded.

If you already have tried it in your code, you probably have gotten these errors and may have reported them to no avail.

Now, let's explain a little about the RPG specifics:

Player's RPG:                  sizeat 14 14, strength 140~
Devastator:                    sizeat 7 7, strength 140/4~, no SMALLSMOKE trail, spawn small EXPLOSION2
Fat Commander's RPG (default): sizeat 30 30, strength 140/4~
Overlord's RPG:                sizeat 42 42, strength 140~
Cycloid Emperor's RPG:         sizeat 24 24, strength 140~, no SMALLSMOKE trail

Notes:

In EVENT_GAME and EVENT_EGS, setting the strength of hard-coded projectiles will change their damage amount, not their own hitpoint amount.
The Devastator's strength is not set by this block of code:
actor RPG RPG_WEAPON_STRENGTH enda
actor FREEZEBLAST FREEZETHROWER_WEAPON_STRENGTH enda
actor DEVISTATORBLAST FREEZETHROWER_WEAPON_STRENGTH enda
actor COOLEXPLOSION1 COOL_EXPLOSION_STRENGTH enda
actor TRIPBOMB TRIPBOMB_STRENGTH enda
Instead, it is RPG_WEAPON_STRENGTH (defined in USER.CON) divided by 4. DEVISTATORBLAST's tilenum is the second frame of FREEZEBLAST's full tile set, so there is no purpose for this actor.

If you want your actor to shoot the Fat Commander's rocket (not the RPG shot by the player), then just use the default code: shoot RPG. However, if you want your actor to shoot the RPGs shot by the player, Overlord, or Cycloid Emperor, or the Devastator, then put this code into your CONs:

gamevar tilenum 0 0
gamevar picnum 0 2
gamevar spriteid 0 2
gamevar x 0 2

onevent EVENT_GAME
 getactor[THISACTOR].picnum tilenum
 switch tilenum

  case RPG
   ifspawnedby <the name of the actor to fire the Devastator> sizeat 7 7
   ifspawnedby <the name of the actor to fire the player's RPG> sizeat 14 14
   ifspawnedby <the name of the actor to fire the Overlord's RPG> sizeat 42 42
   ifspawnedby <the name of the actor to fire the Cycloid Emperor's RPG> sizeat 24 24
  break

 endswitch
endevent

onevent EVENT_EGS
 getactor[THISACTOR].picnum tilenum
 switch tilenum

  case RPG
   ifspawnedby <the name of the actor to fire the player's RPG>
     {
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
     }
   ifspawnedby <the name of the actor to fire the Overlord's RPG>
     {
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
     }
   ifspawnedby <the name of the actor to fire the Cycloid Emperor's RPG>
     {
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
       addstrength RPG_WEAPON_STRENGTH
     }
  break

  case SMALLSMOKE
   getactor[THISACTOR].owner spriteid
   getactor[spriteid].picnum picnum
   ifvare picnum RPG
     {
       getactor[spriteid].xrepeat x
       ifvare x 24 killit
     }
  break

 endswitch
endevent

Note: Addstrength is used to do the inverse of the default division of RPG_WEAPON_STRENGTH by 4.

Note 2: If the RPG's size is set to 7x7, then the game will automatically kill the SMALLSMOKE trail and the EXPLOSION2 actor will become small.