bit of a crosspost
[quote=“pisskop”]Is this the proper thread to cry tears into?
I have a chunk of c++ here. The former
// Generate bodies / zombies
rn = rng(15, 20);
for (int i = 0; i < rn; i++) {
int zx = rng(0, SEEX * 2 - 1), zy = rng(0, SEEY * 2 - 1);
if (passable(zx, zy)) {
if (furn(zx, zy) == f_bed || one_in(3)) {
add_item( zx, zy, item::make_corpse() );
} else {
mtype_id zom = mon_zombie;
if (one_in(6)) {
zom = mon_zombie_spitter;
} else if (!one_in(3)) {
zom = mon_boomer;
}
add_spawn(zom, 1, zx, zy);
}
} else {
//This is a wall: try again
i--;
}
}
Works
this:
// Generate bodies / zombies
rn = rng(50, 70);
for (int i = 0; i < rn; i++) {
int zx = rng(0, SEEX * 2 - 1), zy = rng(0, SEEY * 2 - 1);
if (passable(zx, zy)) {
if (furn(zx, zy) == f_bed || one_in(3)) {
add_item( zx, zy, item::make_corpse() );
} else {
mtype_id zom = mon_zombie;
} if (one_in(50)) {
zom = mon_zombie_child_scorched;
} else if (one_in(25)) {
zom = mon_zombie_gasbag;
} else if (one_in(20)) {
zom = mon_zombie_snotgobbler;
} else if (one_in(10)) {
zom = mon_zombie_spitter;
} else if (one_in(10)) {
zom = mon_zombie_child;
} else if (one_in(6)) {
zom = mon_zombie_acidic;
} else if (one_in(3)) {
zom = mon_boomer;
}
add_spawn(zom, 1, zx, zy);
}
} else {
//This is a wall: try again
i--;
}
}
Throws errors about zom not being defined. I dont know. If I add a mtype_id before zom they read (and then the line add_spawn(zom, 1, zx, zy); fails to read ‘zom’), but I shouldnt have to? zom is simply shorthand for a specific group of monsters. I am sure Ive otherwise defined the specific critters.
all Im doing is extending the concept of spawning a specified set of critters based upon a dice-roll, correct?[/quote]
in case you wanna know where I got this