Most decisions during the game are irrelevant to the endings. Whether you get a good, bad or neutral ending is decided by the last action of the game. (Except for the choice to join the general or not, which changes the outlook of the last scene).
It doesn’t matter if you join the general or not. The only important thing is to kill the monster in the last scene with the gun you got the scene before.
Same here: If you join the general or not is irrelevant, but you have to throw the powder you got from the shaman at the monster in the last scene.
You have to agree to work with the general before to get this ending. In that case you’ll meet Dr. Cocumber again and have a setup of different machinerys in the last scene. Talk to the doctor and then press the red button to kill both shaman and monster and achieve the bad ending.