How to Shoot Different Kinds of RPGs: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
When the [[shoot]] primitive is used for the RPG, it doesn't work correcly, because the RPG is hard-coded.
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.
If you already have tried it in your code, you probably have gotten these errors and may have reported them to no avail.
Line 23: Line 23:
  actor TRIPBOMB TRIPBOMB_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.
: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 (it is not the RPG shot by player), then just use the default code: <code>shoot RPG</code>. 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:
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: <code>shoot RPG</code>. 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 GAMEFLAG 0 0
  gamevar tilenum 0 0
gamevar EGSFLAG 0 0
  gamevar picnum 0 2
  gamevar picnum 0 2
  gamevar spriteid 0 2
  gamevar spriteid 0 2
Line 34: Line 33:
   
   
  onevent EVENT_GAME
  onevent EVENT_GAME
   getactor[THISACTOR].picnum GAMEFLAG
   getactor[THISACTOR].picnum tilenum
   switch GAMEFLAG
   switch tilenum
   
   
   case RPG:
   case RPG
     ifspawnedby '''<the name of the actor to fire the Devastator>''' { sizeat 7 7 }
     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 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 Overlord's RPG>''' sizeat 42 42
     ifspawnedby '''<the name of the actor to fire the Cycloid Emperor's RPG>''' { sizeat 24 24 }
     ifspawnedby '''<the name of the actor to fire the Cycloid Emperor's RPG>''' sizeat 24 24
   break
   break
   
   
Line 48: Line 47:
   
   
  onevent EVENT_EGS
  onevent EVENT_EGS
   getactor[THISACTOR].picnum EGSFLAG
   getactor[THISACTOR].picnum tilenum
   switch EGSFLAG
   switch tilenum
   
   
   case RPG:
   case RPG
     ifspawnedby '''<the name of the actor to fire the player's RPG>'''
     ifspawnedby '''<the name of the actor to fire the player's RPG>'''
       {
       {
Line 72: Line 71:
   break
   break
   
   
   case SMALLSMOKE:
   case SMALLSMOKE
     getactor[THISACTOR].owner spriteid
     getactor[THISACTOR].owner spriteid
     getactor[spriteid].picnum picnum
     getactor[spriteid].picnum picnum
Line 78: Line 77:
       {
       {
         getactor[spriteid].xrepeat x
         getactor[spriteid].xrepeat x
         ifvare x 24 { killit }
         ifvare x 24 killit
       }
       }
   break
   break
Line 87: Line 86:
'''Note:''' Addstrength is used to do the inverse of the default division of RPG_WEAPON_STRENGTH by 4.
'''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.
'''Note 2:''' If the RPG's [[sizeat|size]] is set to 7x7, then the game will automatically kill the SMALLSMOKE trail and the EXPLOSION2 actor will become small.


[[Category: Tutorials]]
[[Category: Tutorials]]

Latest revision as of 22:05, 31 July 2009

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.