Hey guys, well my last attempt was to change how track found a mob, instead I guess I'm trying to give the player extra information on wich mob they want. Ok so you know how somtimes you have to track 3.mobname, track 2.mobname, etc, etc. How would I get the number...the number being the '(#).mobname' to show in the mob desc...well better yet I know how to get it to show in the mob desc...but how do I figure out the number. Is there a value I'm not aware of that states wich # mob it is so I could place it before the mob desc string.
Couldnt find help on my last topic, so I'll try this approach instead.
Posted by Spike on Tue 02 Nov 2004 06:22 AM — 10 posts, 38,671 views.
Without looking at how track works, wouldnt it be easiest to make track find the closest mob to the players position, that way you will never have them tracking a mob thats in a part of the area that is not connected, and if it is not the mob of that name they require they can kill it and track the next one and kill it too. I dont think as a player that i would like to see mobs named 1.soldier, 2.soldier. Plus part of the fun with tracking anything is not knowing wether you are tracking the right creature, remember you find some tracks or droppings or something and follow the clues to finaly reach a mob, you might have been following the wrong foot prints, or tracks that look simular to the creature toyr tracking.
Take a look at how objects are grouped that might help unless i'm miss interpeting what it is you want. Are you looking for a specific mob with that name or a different version of the mob that's been invoked or system loaded?
Give us some more info on exactly how you want track to function and i'm sure we can better help you resolve your issue :)
-Mirrodan
Give us some more info on exactly how you want track to function and i'm sure we can better help you resolve your issue :)
-Mirrodan
The way track and system loaded mobs work, the default tracking target is the oldest mob with the given name. As for how to know which mob is which - as an immortal mwhere *should* sort oldest mobs first but adding that info to the mobs in a way thats accessable to players could be....... difficult.
Here's what I would do.
In order to assign them numbers (1.creature, 2.creature), simply run through the list.
Something such as that. Note that you should run through the area's full list. Of course, I have no idea if that would work and what not. And when they actually try one (track 1.target) have it loop to find #1.
Spark an idea? Maybe? I dunno, just a thought.
In order to assign them numbers (1.creature, 2.creature), simply run through the list.
int i = 0;
CHAR_DATA *mob;
for ( mob = area->first_mob; mob; mob = mob->next_in_area )
{
if ( !str_cmp(mob->name, desired_target) && IS_NPC(mob))
{
i++;
sprintf( buf, "%d.%s Description: %s\n\r", i, mob->name, mob->short_desc) );
send_to_char( buf, ch );
}
}
Something such as that. Note that you should run through the area's full list. Of course, I have no idea if that would work and what not. And when they actually try one (track 1.target) have it loop to find #1.
Spark an idea? Maybe? I dunno, just a thought.
Thanks guys, been drinking a bit...dont think any of this will sink in atm so I'll read it when I sober up a little.
Ahhh, a tad bit more sober. Thanks for the ideas guys. I wish I could have it so find_first_step naturally went for the closest mob to the charecter executing it, but it just doesnt seem possible. This idea doesnt seem to possible either, I'm facinated by your idea whitenight, but not quite sure how I would implement it in the show_char_to_char so a player could see the number next to it. I'd rather not have it this way...but having track work right is -very- -very- essential to my mud.
Well, you could modify it a little bit. Instead of doing it exactly the way i have it, you can make a macro or function to check to see if the person has a bounty. If they do, then you can show a number for them.
Of course, you could make an item with a specific name (kind of like the helmet thing in star wars: bounty hunter) that allows you to use a function to "scan" someone or an area to see if a character that resides there has a bounty.
Then the code would be more like:
Of course those loops wouldn't reall work, considering I didn't look at the code (might be disintigration, i dunno, I haven't looked through the bounty stuff for my mud in a while). But I think you all can figure what i mean.
Of course, you could make an item with a specific name (kind of like the helmet thing in star wars: bounty hunter) that allows you to use a function to "scan" someone or an area to see if a character that resides there has a bounty.
Then the code would be more like:
int i = 0;
CHAR_DATA *mob;
for ( mob = area->first_mob; mob; mob = mob->next_in_area )
{
if ( !str_cmp(mob->name, desired_target) && IS_NPC(mob) && has_bounty(mob->name))
{
i++;
sprintf( buf, "%d.%s Description: %s\n\r", i, mob->name, mob->short_desc) );
send_to_char( buf, ch );
}
}
bool has_bounty( char *name)
{
BOUNTY_DATA *bounty;
bool bountied = FALSE;
/* compare name against disintigration list here */
for ( bounty = first_bounty; bounty; bounty = bounty->next)
{
if ( !str_cmp( name, bounty->name ) )
{
bountied = TRUE;
break;
}
}
return bountied;
}
Of course those loops wouldn't reall work, considering I didn't look at the code (might be disintigration, i dunno, I haven't looked through the bounty stuff for my mud in a while). But I think you all can figure what i mean.
Hrmm thanks for the idea whiteknight, it gave me another one to try to have a function before track, that goes through the arg being the mobs name and 1-30 maybe before it, and if it finds the mob and the distance is good it returns that mob to track...well it's an idea for now.
Hrmm I'm making some progress, I now have it so it goes through a list of all the mobs of the given name and checks to see if they can be tracked, if the mob can be tracked it returns that mob to track. There for they never have to type 3.bob 2.bob etc...it works for now thou I'm not sure if there are any bugs in it.