Eliminate Shrunk Enemies Attacking Bug: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
No edit summary
Fixed English\Grammar, Added Category, Added Image Formatting
Line 1: Line 1:
[[Image:Shrunkattack.gif]]
[[Image:Shrunkattack.gif|frame|A screenshot of the “Shrunk Enemies Attacking” bug.]]
You probably have seen this bug before.


Probably you already have seen this bug.
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.
If you shoot an shrunk enemy, and it activates the hitting animation, it will become the normal enemy code, but still small and not coming back to the original size.


To fix that bug, you need to find the main <b>[[ifhitweapon]]</b> in the enemy code at GAME.con. It means that you will find that code many times, but probably all them will be already in the if condition from the main <b>ifhitweapon</b>. Sample: At Assault Trooper / actor LIZTROOP code will have the <b>state checktroophit</b> where there are many <b>ifhitweapon</b> tags, but before you can find <b>ifhitweapon state checktroophit</b>, so all them are already under that main tag.
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 '''AITROOP<u>SHRUNK</u>''' while the Pig Cop's (actor PIGCOP) is '''AIPIG<u>SHRINK</u>'''.
 
'''Sample:'''<br />
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
   ifhitweapon
     state checktroophit
     state checktroophit


Just add a <b>ifai AIENEMYSHRUNK break</b> (remember to search at enemy code's top for "AI" name of the shrunk state, as Assault Trooper is called <b>AITROOP<u>SHRUNK</u></b> but Pig Cop / actor PIGCOP is <b>AIPIG<u>SHRINK</u></b>) before the main <b>ifhitweapon</b>.
Change it to this:


<b>  ifai AITROOPSHRUNK
  '''ifai AITROOPSHRUNK'''
     break</b>
     '''break'''
   ifhitweapon
   ifhitweapon
     state checktroophit
     state checktroophit


More than fix that code, it will works as like the Assault Captain Teleport (only when he appers again it will fall dead / explode on jibs / whatever). With this code only when the enemy come back to the original size it will be show its weapon shoots reason, and no longer fall and die at the small size (as if it can respawn it would ressurect as the small enemy attacking bug).
In addition to fixing the shrunk enemy bug, this will also fix numerous issue with the Assault Captain's teleporting code. That is one of the reasons that the authors of this tutorial selected the Assault Trooper\Captain to be our example.
 
It may take a bit of work, but in the end, you will receive the fruits of your labor. [[Image:Wink.gif]]

Revision as of 16:55, 17 November 2006

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

Change it to this:

  ifai AITROOPSHRUNK
    break
  ifhitweapon
    state checktroophit

In addition to fixing the shrunk enemy bug, this will also fix numerous issue with the Assault Captain's teleporting code. That is one of the reasons that the authors of this tutorial selected the Assault Trooper\Captain to be our example.

It may take a bit of work, but in the end, you will receive the fruits of your labor.