Eliminate Shrunk Enemies Attacking Bug

From EDukeWiki
Revision as of 17:30, 14 July 2012 by Hendricks266 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
A screenshot of the "Shrunk Enemies Attacking" bug.

You probably have seen this bug before.

If you shoot an shrunken enemy, and it activates the hitting animation, it will start processing the normal enemy code, but still remain small and not go back to the original size.

To fix that bug, you need to find the main ifhitweapon statement in the enemy code, which is in GAME.con by default. You will find that code many times, but probably all them will be already in the if condition from the main ifhitweapon or you have confused ifhitweapon with ifwasweapon.

All you have to do to fix this bug is add an ifai AI<enemyname><SHRUNK\SHRINK> break statement before the main ifhitweapon. Remember to search at the beginning of the enemy code for name of their shrunk artificial intellegence, as the Assault Trooper's (actor LIZTROOP) is AITROOPSHRUNK while the Pig Cop's (actor PIGCOP) is AIPIGSHRINK.

Sample:
In the Assault Trooper's (actor LIZTROOP) code, there will be the state state checktroophit where there are many ifhitweapon primitives, but they are all before ifhitweapon state checktroophit, so all them are already under that main tag.

Here is the actual code described above:

  ifhitweapon
    state checktroophit
  else
    state checksquished

Change it to this:

  state checksquished

  ifai AITROOPSHRUNK break
  ifhitweapon
    state checktroophit

It is necessary to rearrange the code to prevent more bugs, as shown here.

In v1.5, the LIZTROOP is the only enemy that requires this fix, as all of the others already have a ifai AI<enemyname><SHRUNK\SHRINK> break statement before the hit state is called, or at the very top of the hit state.

Do you remember what happens when you shoot an Assault Captain before he teleports? Only when he comes back will he fall dead / explode / et cetera. With this code this is exactly what will happen with the shrunken enemy; only when he grows back will he be able to take hits and get shot once more. Also, fixing this bug prevents another from happening: Normally, on the Damn I'm Good skill level or if you're playing respawning multiplayer, if you exploit this bug and kill him, when he respawns he will stay shrunken.