by msa » Mon Feb 23, 2009 3:47 pm
No, my mapset/chk problems have nothing to do with steps this time. I am trying to add random herb patches to one of my wilderness maps. The herb patches are a space that does the following when you step on them:
1. Add a random herb to the players inventory
2. Decrement a counter for the number of herb patches
3. Replace themselves with a patch of grass
When you enter the worldmap region, the game runs a macro that does the following:
1. If the number of herb patches is less than 10
1. Find x,y coordinates that contain a patch of grass
2. Replace it with an herb patch
3. Increment the counter for the number of patches
4. Goto 1
The problem is that frequently less than 10 herb patches are placed. And after each round of harvesting, less herb patches spawn in the area. Here are my experiences:
1. In a 16x16 world map, with the player entering in the middle, no herbss spawn
2. In a 48x32 world map, with the player entering from the upper left, most (but rarely all) of the herbs will spawn and every time you leave and reenter less patches will spawn than were picked
3. In scenario 2, but with herbs only spawning in the bottom left 16x16 quadrant, all of them will spawn, and all will be replaced upon reentry
Here is the macro code for the respawn:
1: IF Y2 = 0 THEN 14 (no more herbs to place)
2:
3: SET F = RND(13) + 2 (X)
4: SET G = RND(13) + 2 (Y)
5: MAPCHK F G E
6: IF E = 43 THEN 10 (found a patch of grass)
7:
8: GOTO 3
9:
10: MAPSET F G 42 (place patch of herbs)
11: SET Y2 = Y2 - 1
12: IF Y2 > 0 THEN 3
13:
14: STOP
No, my mapset/chk problems have nothing to do with steps this time. I am trying to add random herb patches to one of my wilderness maps. The herb patches are a space that does the following when you step on them:
1. Add a random herb to the players inventory
2. Decrement a counter for the number of herb patches
3. Replace themselves with a patch of grass
When you enter the worldmap region, the game runs a macro that does the following:
1. If the number of herb patches is less than 10
1. Find x,y coordinates that contain a patch of grass
2. Replace it with an herb patch
3. Increment the counter for the number of patches
4. Goto 1
The problem is that frequently less than 10 herb patches are placed. And after each round of harvesting, less herb patches spawn in the area. Here are my experiences:
1. In a 16x16 world map, with the player entering in the middle, no herbss spawn
2. In a 48x32 world map, with the player entering from the upper left, most (but rarely all) of the herbs will spawn and every time you leave and reenter less patches will spawn than were picked
3. In scenario 2, but with herbs only spawning in the bottom left 16x16 quadrant, all of them will spawn, and all will be replaced upon reentry
Here is the macro code for the respawn:
1: IF Y2 = 0 THEN 14 (no more herbs to place)
2:
3: SET F = RND(13) + 2 (X)
4: SET G = RND(13) + 2 (Y)
5: MAPCHK F G E
6: IF E = 43 THEN 10 (found a patch of grass)
7:
8: GOTO 3
9:
10: MAPSET F G 42 (place patch of herbs)
11: SET Y2 = Y2 - 1
12: IF Y2 > 0 THEN 3
13:
14: STOP