ID:149944
 
I have a random combat system by Zagreus on it only has one mob being created when it starts but i want to know how to make only some mobs appear in different areas like in a forest you would find bears but in the mountains no bears and something else
Elreon wrote:
I have a random combat system by Zagreus on it only has one mob being created when it starts but i want to know how to make only some mobs appear in different areas like in a forest you would find bears but in the mountains no bears and something else

A lot depends on the type of random combat you're looking for. Do you want DWO-style combat, where the monsters are assumed to be lurking about and you just randomly battle one from time to time, or do you want them wandering around the main game map?

If you want them on the game map itself, then for monster spawning, there are a few ways to go. You could have several monster spawn points, each set up to deliver only certain kinds of monsters and only if there are too few in the area. Or, you could spawn monsters at purely random points in the area; all you need to do is loop through turfs and find one that 1) is not dense, and 2) has no contents.

Lummox JR
In response to Lummox JR
im not that good at coding but if you could give me a example it would help alot.
Wow, someone uses my combat system? :)

Anyway, all you gotta do is define another area for the different monster.

Heres a brief copy of three different battle areas that I used in my old mud... I'd add it to the demo I put up if I could remember my password. :)




//Main Combat file
mob

//Check battlearea of usr and run randomencounter proc for that area when move
Move()
switch(onbattlefield)
if ("battlearea1")
randomencounter1()
return ..()
if ("battlearea2")
randomencounter2()
return ..()
if ("battlearea3")
randomencounter3()
return ..()
else
return ..()


mob/var/turf/battlearea
//randomly encounter enemies on battlearea1
mob/proc

randomencounter3()
var/turf/battlearea/T
if (prob(25))
for(T in world)
if(!T.occupied)
T.occupied = 1
usr.oldlocx = usr.x
usr.oldlocy = usr.y
usr.oldlocz = usr.z
usr.battlearea = T
spawn(1)usr.Move(usr.battlearea)
usr.oldbattlefield = usr.onbattlefield
usr.onbattlefield = null
usr << "Fight!"
usr << sound('Mus11.mid', 1)
usr << "Click on the monster you wish to attack to start"
spawn(1)new /mob/Monster3(locate(usr.battlearea.x,usr.battlearea.y+4,usr. battlearea.z))
return 1
return 0


randomencounter2()
var/turf/battlearea/T
if (prob(10))
for(T in world)
if(!T.occupied)
T.occupied = 1
usr.oldlocx = usr.x
usr.oldlocy = usr.y
usr.oldlocz = usr.z
usr.battlearea = T
spawn(1)usr.Move(usr.battlearea)
usr.oldbattlefield = usr.onbattlefield
usr.onbattlefield = null
usr << "Fight!"
usr << sound('Mus11.mid', 1)
usr << "Click on the monster you wish to attack to start"
spawn(1)new /mob/Monster2(locate(usr.battlearea.x,usr.battlearea.y+4,usr. battlearea.z))
return 1
return 0

randomencounter1()
var/turf/battlearea/T
if (prob(10))
for(T in world)
if(!T.occupied)
T.occupied = 1
usr.oldlocx = usr.x
usr.oldlocy = usr.y
usr.oldlocz = usr.z
usr << "Old location saved as [usr.oldlocx], [usr.oldlocy], [usr.oldlocz]"
usr.battlearea = T
spawn(1)usr.Move(usr.battlearea)
usr.oldbattlefield = usr.onbattlefield
usr.onbattlefield = null
usr << "Fight!"
usr << sound('Mus11.mid', 1)
usr << "Click on the monster you wish to attack to start"
spawn(1)new /mob/Monster1(locate(usr.battlearea.x,usr.battlearea.y+4,usr. battlearea.z))
return 1
return 0


area
battlearea1
Enter()
spawn()usr.onbattlefield = "battlearea1"
return 1
Exit()
usr.onbattlefield = null
return 1
battlearea2
Enter()
spawn()usr.onbattlefield = "battlearea2"
return 1
Exit()
usr.onbattlefield = null
return 1
battlearea3
Enter()
spawn()usr.onbattlefield = "battlearea3"
return 1
Exit()
usr.onbattlefield = null
return 1


So, as you can see from all that, it's really simple, just add a different area for a different monster. I abandoned that project awhile ago to switch to a text mud, so feel free to use it as you wish. Have fun.