ID:180873
 
Okay, what i want to do is make it so that everytime a player is attacked by a nice little random enemy, he gets warped into a little battle area. What i need is some sort of way to make a new battle area for every battle (i don't want everyone going to the same battle area to fight monsters). I'm sure this is possible (maybe some sort of map generator would be needed). Could someone help me out?
Okay, what i want to do is make it so that everytime a player is attacked by a nice little random enemy, he gets warped into a little battle area. What i need is some sort of way to make a new battle area for every battle (i don't want everyone going to the same battle area to fight monsters). I'm sure this is possible (maybe some sort of map generator would be needed). Could someone help me out?

I put together a little demo of one way you could approach this. In essence, it reserves one level of the map for "battle areas" and creates them as they're needed, building a border around them to prevent people from moving into other battle areas. Anyway, it's not a fully-fleshed-out library, but I think it could give you a good start. Try it out by downloading it here: BattleAreaWorld!
In response to Guy T.
On 1/20/01 12:29 pm Guy T. wrote:
Okay, what i want to do is make it so that everytime a player is attacked by a nice little random enemy, he gets warped into a little battle area. What i need is some sort of way to make a new battle area for every battle (i don't want everyone going to the same battle area to fight monsters). I'm sure this is possible (maybe some sort of map generator would be needed). Could someone help me out?

I put together a little demo of one way you could approach this. In essence, it reserves one level of the map for "battle areas" and creates them as they're needed, building a border around them to prevent people from moving into other battle areas. Anyway, it's not a fully-fleshed-out library, but I think it could give you a good start. Try it out by downloading it here: BattleAreaWorld!


Also, if you run out of space for battle areas on a level, you can just add a new level to the map and use that. My moribund RPG engine loaded zones that way -- when you entered a new zone, it would add a level to the map and read in the zone.

In response to Guy T.
On 1/20/01 12:29 pm Guy T. wrote:
I put together a little demo of one way you could approach this. In essence, it reserves one level of the map for "battle areas" and creates them as they're needed, building a border around them to prevent people from moving into other battle areas. Anyway, it's not a fully-fleshed-out library, but I think it could give you a good start. Try it out by downloading it here: BattleAreaWorld!

Thank you VERY much for that, i would've spent a while getting that. Anyways, the BAmain.dm is simple enough for me to understand, but the BAbattleAreas.dm is a little confusing. Could you stick in a few more comments here and there to help me out? (I don't understand the coordinate stuffs very well...)

Once again, thank you VERY much.
In response to Cinnom
Could you stick in a few more comments here and there to help me out?

No problem. I just uploaded a new version with a few more comments. Here's a way to think of the coordinates. Assume the grid below is a grid of battle areas that are 5 turfs wide and 5 turfs high.

<code>
.---.---.---.
|...|...|...|  maxY = 15; minY = 11; y = 3
|...|...|...|
.---.---.---.
|...|...|...|  maxY = 10; minY = 6; y = 2
|...|...|...|
.---.---.---.
|...|...|...|  maxY = 5; minY = 1; y = 1
|...|...|...|
.---.---.---.
</code>

I think part of the confusion is arising because I'm using "x" and "y" to define the battle area's location in a grid of battle areas rather than its location on the map. Once you see how that works, it should make more sense to you.

Also, keep in mind that this is just one way to do it (and a hastily-thrown-together way at that). In the long run, you might want to take some of the ideas and discard others, or come up with something entirely different. Anyway, good luck!