ID:158785
 
So I want to make my game so that the player gets to battle multiple enemies, 5 or 6 at least, at a time? I'm guessing I would use a list and store the enemies in it and then set their locations? Am I on the right track?
Very simple to do. Just add more enimies to your map or spawn them over an amount of time.
In response to Gamemakingdude
I think Sandlight is working on a turn-based game, like Final Fantasy (it probably isn't a fangame, just an example) where multiple enemies can exist in the same battle.
In response to Vic Rattlehead
Yes, it's a turn based, I forgot to mention it earlier.
In response to Sandlight
In that case, you should use a sleep proc.

If the battles nto over by the time the sleep proc finishes, it should excute a random variable, whether if a monster will join or not join.

You can override this for bosses by simply putting.
if(Boss) break


Hopefully this will help you a bit and give you an idea of what u need to do.
Doing this depends entirely on how your system works. Generally, yes, it's going to involve a list of enemies, and anywhere you might've referred specifically to the enemy, you'd now be using that list.
In response to Gamemakingdude
just do

mob
enemy_name
monster code
enemy_name
monster code


and you should just be able to keep them on your map,


and as for a respawn, i would add a player and a monster variable to your mob variables.

every monster should have monster = 1 and player = 0 in their stats.
player should be set to 1 in the var list.

then your deatch check should be an if else statement

if player == 1
respawn code
else
monster respawn code.
I assume this is essentially virtually a continuation of your question in this thread, but man, you really need to supply more info with your questions. As Garthor correctly said, how to do this depends on how your existing system is built, and on how you want this addition to work (BTW, it looks like the rest of the replies here, well, mostly wouldn't be of help, though).
Going with the example from the linked thread, in which you begin battle with enemies by approaching next to them on the map, you simply need to look for multiple enemies near you instead of only one, then initiate the battle with all of them. The example code I posted there (pretty much a basic battle framework) is in fact already suitable for multiple enemies, if you've went with something like that (and you should - at least have a battle datum) then all you need to change is the part that actually looks for the enemy and starts the battle, which in the example is there in turf/Entered(). I used locate() to only find one enemy (even if there are more) to simplify it, but you can change that part into a for() loop that looks for multiple enemies, puts them in a list*, then starts the battle with that list as the enemies.
*:Of course, if you wanted to limit the maximum number of enemies, you could stop adding enemies to that list after it already has that amount (or trim it after populating it, but I'd prefer the former).
In response to Kaioken
My game is a rpg where u get into battle by random encounter on a turf; I want the turf to define what the enemies and how many of them the player will be fighting.

Here's my framework, I just want to focus on the important and hard parts for now, all the small details I can do later.

var/list/enemylist = list()

turf
battlestart
grass
icon = 'grass.dmi'
battlegrass
icon = 'battlegrass.dmi'
Entered()
if(istype(usr,/mob/player))
var/ene = rand(1,15)
switch(ene)
if(1 to 3)
enemylist.Add(/mob/enemy/enemysoldier)
usr.combatt()

mob/proc
combatt()
var/location
for(var/turf/battlestart/B in world)
usr.oldloc = usr.loc
usr.olddir = usr.dir
usr.frozen = 1
sleep(10)
location = B
usr.loc = location
usr.dir = NORTH
frozen = 0
usr.inbattle = 1
usr << "\n==============BATTLE START=============="
break

//in this part, i want it so the contents of enemylist will be given their locations on the field,
//so I'm guessing they have to extracted out of the list and be made into variables, but I'm not too sure.
In response to Sandlight
First things first: ungh, no usr in proc. In Entered(), use its argument instead. In your combatt() object proc, refer to the proc's source object instead.

Sandlight wrote:
My game is a rpg where u get into battle by random encounter on a turf

So, for this one, you want it to work essentially like the Pokemon Gameboy games?

I want the turf to define what the enemies and how many of them the player will be fighting.

Of course, for the available enemies, you'd use a list (it could contain the type paths of the enemies). But you should do this preferably on a per-area basis instead, and let the current /area decide which enemies are present - or at the very least, if you do it per-turf then share lists between turfs when possible (i.e. when turfs have the same enemies available). Giving every turf a new list of its own will quickly end up creating a LOT of lists and also being in risk of hitting the list limit.
Similarly, whether you do it per-area or per-turf, only give the atoms a list if it's needed. So if there are no enemies to fight on a turf or area, give it no list at all (instead of an empty list).