Garth's Equipment Shop wrote:
The macro runs when it should, the mine is blown in one shot with my Handgun which does 10 dmg [for now anyway, haven't worked out the whole game balance thing yet] and it plays the explode sound [81] and it shows the first mapadd. The second mapadd is ignored completely!
Also strange is that it does not show the explosion before the waitkey is pressed. First it plays the sound of the gun shooting as expected then immediately plays the expode sound but keeps showing the half buried mine unexploded untill the key is pressed, then shows it, but doesn't show the crater that is added after that.
Even after moving the pc around a whole bunch of times the crater never shows up. So just like before I am stuck resorting to leaving out the explosion graphic and just relying on the player's imagination to imagine a big fireball where this is only the sound of one and then just show the crater that is left over.
It seems that macros are limited to only one mapedit at a time, so basically if I wanted this to work I'd have to cut the macro in two and put the first part as the action of the mine and the second part as the action of the fireball that is added so say when the player passes over the fire it disappears and is replaced by a crater. Doesn't make much sense from a players point of view who would be worried they might lose the game or get hurt walking into a ball of fire.
One thing that I have learned through experimentation with the ACK engine is that map edits are not displayed one-by-one as they are made in a macro. Instead, the map is refreshed and all map edits are displayed after the macro completes. So, this basically prevents you from using map edits to perform animations on a single square.
(You can definitely do more than one map edit in a macro and change multiple tiles in different locations.)
However, it is possible to split an action up into two parts by performing one edit in the action macro, and then setting a flag that is recognized by the step macro which completes the edit. You seem to have the 'step on mine' part working ok, so here is my attempt at making the 'mine explodes when shot' bit work correctly.
Mine object: Space, LANDMINE #205
Disappear? IF DESTROYED, run macro 52
Structural strength: 1
Replaced by #206 EXPLOSION
Explosion object: Space, EXPLOSION #206
Empty grass object: Space, GRASS #6
Macro 52:
SET A2 = 1
STOP
So, when you hit the LANDMINE with a weapon, it is destroyed, variable A2 is set to 1, and the tile is replaced with #206 EXPLOSION (which shows a fireball). You might be able to have the 'destroy' macro play a sound at this point too - I haven't tried it.
The tricky bit is replacing the explosion with grass (or a crater, if you prefer). One solution is to have the step macro check to see if the flag (A2) is set indicating a mine was destroyed. If so, it scans the map looking for a #206 EXPLOSION tile. If it finds one, it replaces it with grass. I also animated a separate 'explosion' using an expanding circle (the DRAW command) just to see if it would work.
Code: Select all
Macro 51 (Step Macro):
1: IF A2 = 1 THEN 3
2: STOP
3: SET A2 = 0
4: SET X2 = 1
5: SET Y2 = 1
6: MAPCHK X2 Y2 B2
7: IF B2 = 206 THEN 14 #explosion
8: SET X2 = X2 + 1
9: IF X2 < 17 THEN 6
10: SET X2 = 1
11: SET Y2 = Y2 + 1
12: IF Y2 < 12 THEN 6
13: STOP
14: MAPSET X2 Y2 #6-GRASS #change to grass
15: SET X2 = X2 * 16 # calc circle location
16: SET X2 = X2 - 4
17: SET Y2 = Y2 * 16
18: SET Y2 = Y2 - 4
19: DRAW X2 Y2 TO X2 Y2 OF 15 3
20: PAUSE 1
21: DRAW X2 Y2 TO X2 Y2 OF 14 5
22: PAUSE 1
23: DRAW X2 Y2 TO X2 Y2 OF 15 7
24: PAUSE 1
25: DRAW X2 Y2 TO X2 Y2 OF 14 9
26: PAUSE 1
27: DRAW X2 Y2 TO X2 Y2 OF 15 11
28: PAUSE 1
29: STOP
This seemed to work ok for me - hopefully it will run ok in your adventure alongside your additional 'check if player stepped on mine' step macro.