[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Couldnt find help on my last topic, so I'll try this approach instead.

Couldnt find help on my last topic, so I'll try this approach instead.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Spike   (27 posts)  [Biography] bio
Date Tue 02 Nov 2004 06:22 AM (UTC)
Message
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.
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #1 on Tue 02 Nov 2004 07:02 AM (UTC)

Amended on Tue 02 Nov 2004 07:05 AM (UTC) by Robert Powell

Message
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.



Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Mirrodan   USA  (28 posts)  [Biography] bio
Date Reply #2 on Tue 02 Nov 2004 09:18 AM (UTC)
Message
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

Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #3 on Tue 02 Nov 2004 04:07 PM (UTC)
Message
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.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #4 on Tue 02 Nov 2004 10:40 PM (UTC)
Message
Here's what I would do.

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.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Spike   (27 posts)  [Biography] bio
Date Reply #5 on Tue 02 Nov 2004 11:41 PM (UTC)
Message
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.
[Go to top] top

Posted by Spike   (27 posts)  [Biography] bio
Date Reply #6 on Thu 04 Nov 2004 01:55 AM (UTC)
Message
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.
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #7 on Thu 04 Nov 2004 02:32 AM (UTC)

Amended on Thu 04 Nov 2004 02:33 AM (UTC) by Nick Cash

Message
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:

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.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Spike   (27 posts)  [Biography] bio
Date Reply #8 on Thu 04 Nov 2004 02:08 PM (UTC)
Message
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.
[Go to top] top

Posted by Spike   (27 posts)  [Biography] bio
Date Reply #9 on Thu 04 Nov 2004 05:22 PM (UTC)
Message
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.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


25,040 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]