How to Shoot Different Kinds of RPGs: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
New page: When the command shoot is used for RPG it doesn't work correcly, because the actor RPG is hard-coded. If you already have used it, probably you have got problems, and you report or no...
 
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
When the command [[shoot]] is used for RPG it doesn't work correcly, because the actor 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 used it, probably you have got problems, and you report or not it.
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:


Now, let's explain a little about:
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


RPG shot by player RPG weapon:              sizeat 14 14, strength 140~
'''Notes:'''
RPG shot by player Devastator weapon:        sizeat 7 7, strength 140/4~, no SMALLSMOKE trail, spawn small EXPLOSION2
RPG shot by Commander and any other actor:  sizeat 30 30, strength 140/4~
RPG shot by Overlord:                        sizeat 42 42, strength 140~
RPG shot by Cycloid Emperor:                sizeat 24 24, strength 140~, no SMALLSMOKE trail
<b>Notes:</b>


[[strength]] in case become the projectile damage, original Duke projectiles aren't like the ones from [[defineprojectile]] command.
:In EVENT_GAME and EVENT_EGS, setting the [[strength]] of hard-coded projectiles will change their damage amount, not their own hitpoint amount.


Devastator strength is not set by actor DEVISTATORBLAST FREEZETHROWER_WEAPON_STRENGTH as you can see in GAME.CON, it is RPG_WEAPON_STRENGTH (defined in USER.CON) divided by 4.
: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


So, what you need to do is:
: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: <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:


* If you want to one actor shoot the Commander rocket (that isn't the RPG from player) just use default [b]shoot RPG[/b].
gamevar tilenum 0 0
 
gamevar picnum 0 2
* If you want to one actor shoot the player RPG:
gamevar spriteid 0 2
gamevar x 0 2
  onevent EVENT_GAME
  onevent EVENT_GAME
   ifactor RPG
  getactor[THISACTOR].picnum tilenum
    ifspawnedby MYACTOR
  switch tilenum
      sizeat 14 14
   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
  endevent
   
   
  onevent EVENT_EGS
  onevent EVENT_EGS
   ifactor RPG
  getactor[THISACTOR].picnum tilenum
    ifspawnedby MYACTOR
  switch tilenum
    {
      addstrength RPG_WEAPON_STRENGTH
   case RPG
      addstrength RPG_WEAPON_STRENGTH
    ifspawnedby '''<the name of the actor to fire the player's RPG>'''
      addstrength RPG_WEAPON_STRENGTH
      {
    }
        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
  endevent
Note: Addstrength used to opposite the default RPG_WEAPON_STRENGTH/4. Change the [[sizeat]] if you want the Overlord like rocket - nothing can be done about Cycloid Emperor rocket, because you cannot kill the SMALLSMOKE trail with sizeat)


* If you want one some actor shoot Devastators:
'''Note:''' Addstrength is used to do the inverse of the default division of RPG_WEAPON_STRENGTH by 4.
onevent EVENT_GAME
 
  ifactor RPG
'''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.
    ifspawnedby MYACTOR
 
      sizeat 7 7
[[Category: Tutorials]]
endevent
Note: If sizeat is set to 7 7, automatically kill the SMALLSMOKE trail and EXPLOSION2 become small.

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.