Monster Index Glitchiness: 13 is 12???

puppydrum64

Active member
I noticed when doing the Brawler module this peculiar situation, where each time a bad guy attacked he cloned himself. I eventually fixed it but in doing so raised even more questions.

A little background info: I wanted to create a second type of bad guy that uses a gun instead of punching. I found that duplicating the original monster and changing its palette for every frame of every animation would take more time than just manually creating a new monster with the same object details and drawing it again with the new palette. So my monsters section looks like this.
12 is 13 Part 1.png
My understanding is that badGuy is #$10, badGuyFist is #$11, GunGuy is #$12, GunGuy_Gun is #$13, and badGuy-Copy is #$14.

Next I went into bank 18 where the punching logic is located.

Code:
LDA #$11
STA tempC ;; the object that should appear.

This is the part of the code that tells the game to put the fist in front of the bad guy.

So I copied and pasted the entire "doEnemyPunch" routine, replacing #$11 with #$13. As stated before, #$13 should be the gun. Emphasis on should. After creating the necessary AI behaviors to call this new routine, dubbed "doEnemyShoot", I playtested the game and found that instead of a the gun spawning in Gun Guy's hand, another Gun Guy was spawning! (index #$12)

Confused, I created a copy of the original badGuy except his AI is the same as Gun Guy's (he goes to doEnemyShoot instead of doEnemyPunch), thinking that I made a mistake somewhere when creating Gun Guy as described in the first paragraph. I chose to leave his palette pink out of laziness, because I just wanted to see if a gun would appear in his hand, not caring that the gun was green and the monster was pink. This ended up working in my favor because I understood precisely what was going on after playtesting. The pink badGuy-Copy was spawning green Gun Guy with every punch! So I determined that the error was coming from the code I showed earlier. I changed the number from #$13 to #$14 just to see what would happen. The pink badGuy-copy was creating more copies of himself, which were pink. I finally got the gun to appear by changing the number to #$12, even though based on the order of my monster section it should be #$13.

TL;DR: in my Monsters section 12 is 13 and vice versa, all others are correct.

EDIT: Something similar is happening when I followed the intermediate tutorial. Despite having only 2 monsters (bad guy and fist) the bad guy creates more bad guys when punching instead of using his fist. The script in bank 18 still calls for object 11.
 

dale_coop

Moderator
Staff member
Sometimes the order the monster objects appear in the list (visually) is not reflecting their ID's order.
The best way to verify that is checking in the MonsterList.txt file (located in your "GameEngineData\GameData" folder)
(in that file, you need to add +16 to all a monsterID to get the objet ID)
 

puppydrum64

Active member
Sometimes the order the monster objects appear in the list (visually) is not reflecting their ID's order.
The best way to verify that is checking in the MonsterList.txt file (located in your "GameEngineData\GameData" folder)
(in that file, you need to add +16 to all a monsterID to get the objet ID)

;;;; 0 GameItem: Player ID=0
;;;; 1 GameItem: playerFist ID=1
;;;; 2 GameItem: Projectile Source ID=2
;;;; 3 GameItem: Projectile ID=3
;;;; 4 GameItem: Health Pickup ID=4
;;;; 5 GameItem: Charge Pickup ID=5
;;;; 6 GameItem: Key Pickup ID=6
;;;; 7 GameItem: Currency Pickup ID=7
;;;; 8 GameItem: Effect 0 ID=8
;;;; 9 GameItem: Effect 1 ID=9
;;;; 10 GameItem: Effect 2 ID=10
;;;; 11 GameItem: Effect 3 ID=11
;;;; 12 GameItem: Effect 4 ID=12
;;;; 13 GameItem: Effect 5 ID=13
;;;; 14 GameItem: Effect 6 ID=14
;;;; 15 GameItem: Effect 7 ID=15
;;;; 0 Monster: MonsterFist ID=0
;;;; 1 Monster: BadGuy1 ID=1

I see the problem now. Is there any way to change this order or will I have to change my scripts?
 

dale_coop

Moderator
Staff member
I don't think you can change the order... you need to modify your scripts.

Or maybe... you could try exporting your "MonsterFist" object as a file.
Remove the object, save and close the project. Reopen and try to import the "MonsterFist" file as a new monster object... Export & test and check again.
 
Top Bottom