How to Shoot Different Kinds of RPGs: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Jblade (talk | contribs)
No edit summary
(No difference)

Revision as of 21:58, 31 July 2009

When the shoot primitive is used for the RPG, it doesn't work correcly, 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 the purpose of this actor is unknown.

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

gamevar GAMEFLAG 0 0
gamevar EGSFLAG 0 0
gamevar picnum 0 2
gamevar spriteid 0 2
gamevar x 0 2

onevent EVENT_GAME
 getactor[THISACTOR].picnum GAMEFLAG
 switch GAMEFLAG

  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 EGSFLAG
 switch EGSFLAG

  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 sizeat is set to 7 7, then the game will automatically kill the SMALLSMOKE trail and EXPLOSION2 will become small.