I am looking through he code, and I see where it is defined, but the commenting is poor, and the documentation doesnt exist, so where is the function for it?
You have MF_SMELLS, which you give to monsters, but where do you adjust it?
I would like to make it so each mob has different levels of senses.
For example, there is no reason a Zombie should be able to smell you as well as a wolf.
The only reference I can FIND is in monmove.cpp about them tracking it.
[i]point monster::scent_move(game *g)
{
plans.clear();
std::vector<point> smoves;
int maxsmell = 1; // Squares with smell 0 are not eligable targets
int minsmell = 9999;
point pbuff, next(-1, -1);
unsigned int smell;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
smell = g->scent(posx + x, posy + y);
int mon = g->mon_at(posx + x, posy + y);
if ((mon == -1 || g->z[mon].friendly != 0 || has_flag(MF_ATTACKMON)) &&
(can_move_to(g->m, posx + x, posy + y) ||
(posx + x == g->u.posx && posx + y == g->u.posy) ||
(g->m.has_flag(bashable, posx + x, posy + y) && has_flag(MF_BASHES)))) {
if ((!is_fleeing(g->u) && smell > maxsmell) ||
( is_fleeing(g->u) && smell < minsmell) ) {
smoves.clear();
pbuff.x = posx + x;
pbuff.y = posy + y;
smoves.push_back(pbuff);
maxsmell = smell;
minsmell = smell;
} else if ((!is_fleeing(g->u) && smell == maxsmell) ||
( is_fleeing(g->u) && smell == minsmell) ) {
pbuff.x = posx + x;
pbuff.y = posy + y;
smoves.push_back(pbuff);
}
}
}
}
if (smoves.size() > 0) {
int nextsq = rng(0, smoves.size() - 1);
next = smoves[nextsq];
}
return next;
} [/i]
So, I am guessing what needs to be done is 3 levels of MF_SMELLS
Like say a MF_SMELLSSHARP (High sense of smell) MF_SMELLSNORMAL and MF_SMELLSLOW (Poor sense of smell)
int maxsmell = 1 is Obviously the key, but I need to read through some more of the code and see how it tracks how long a “scent” stays in a square…
Anyone look into this yet? Its more of an issue of figuring out WHERE stuff is located…