mob/proc
Initiate_Battle(level) //monster is the type of monster generated when entering turf
var/tmp/tm = rand(1,3)
var/list/order
var/list/monsters
usr<<"[tm]" //lets me know how many monsters are supposed to spawn
for(var/x = 1, x < tm, x++)
monsters += AssignMon(level) // level is the monster's level group, its defined when the turf is entered
Create_Order(monsters,order,src)
Create_Order(list/monsters,list/mob/order,mob/player)
var/mob/monster = monsters[1]
usr<<"[player.name]"
usr<<" [monster.name]"
if(player.haste > monster.haste) //if player has higher haste
order = monsters.Copy(1,0)
order.Insert(1,player)
if(player.haste == monster.haste) //if equal haste
if(prob(50)) //50/50 who goes first
order = monsters.Copy(1,0)
order.Insert(1,player)
else
order = monsters.Copy(1,0)
order += player
else
order = monsters.Copy(1,0)
order += player
AssignMon(level)
switch(level)
if("level1")
var/choice = rand(1,3)
if(choice >= 1 && choice <= 4)
var/mob/y = new /mob/Monsters/Level1/Red_Slime
return y
else if(choice >=5 && choice <= 8)
var/mob/y = new /mob/Monsters/Level1/Goblin
y.loc = locate(23,21-x,4)
return y
else
var/mob/y = new /mob/Monsters/Level1/White_Tiger
y.loc = locate(23,21-x,4)
return y
Problem description:I'm trying to make a random multiple monster spawn (like in a final fantasy game) This is what i came up with. Monsters is the list of monsters (to be used for players ie: var/choice = input(...) in list monsters. order is the order of the turns. who goes first is based off of the mob's haste. I figured out that the list is full of nulls. I'm not sure how to correct this. The error i get in case it helps is:
runtime error: type mismatch: Red Slime (/mob/Monsters/Level1/Red_Slime) += Red Slime (/mob/Monsters/Level1/Red_Slime)
proc name: Initiate Battle (/mob/proc/Initiate_Battle)
source file: BattlePrep.dm,10
usr: the test (/mob)
src: the test (/mob)
call stack:
the test (/mob): Initiate Battle("level1")
Level1 (276,253,1) (/turf/CombatGrass/Level1): Entered(the test (/mob), Level1 (275,253,1) (/turf/CombatGrass/Level1))
please help! thanks in advance. (yes i know i'm a blond)
I will show you an example of some code that is fairly flexible from a game I am creating right now that might help you re-code your system, or help you spot something wrong in yours.
This won't work as a straight up copy paste into your system for various reasons, I only posted it to maybe give you a new way to create your monsters, or help you some other way.