How to check an area name?

Posted by Rash on Sun 07 Mar 2004 04:25 PM — 3 posts, 14,753 views.

United Kingdom #0
Okay this may sound dumb but...

How do you check an area name in the code?

For example;

I want vassagos quest system to check area names to make sure it does NOT use limbo.are arena.are and a few others...
im not quite sure how to do it.

Rash
USA #1
This is a rather simplistic view, but you'll get what I mean I think.


AREA_DATA *tarea;

for ( tarea = first_area; tarea; tarea = tarea->next )
{
  if ( !str_cmp(tarea->filename,"limbo.are") )
  {
     generate_quest( again ); // Don't know the syntax :P
     return;
  }

  if ( !str_cmp(tarea->filename,"arena.are") )
  {
     generate_quest( again ); // Don't know the syntax :P
     return;
  }
}


Of course you'll have to correct the generate_quest statements since I had no clue what the syntax for that is. Just add an extra if statement for each area. I think that will work, and at least give you something to to go off of.
USA #2
Hah, now that I think about it that really wouldn't work. The questmaster mob finds an object/mob randomly right? So looping through the areas wouldn't really do much..so that code isn't really doing anything, though it represents the right idea.

An if check some thing likes might work, and you'd need one per area:

Note: Suppose limbo's ranges were 10000 11000

-In the object quest code-

if (questitem->vnum >= 10000 && quesitem->vnum <= 11000 )
{
   generate_quest( ch, questman ); 
   return;
}

-In the mob quest code-

if (victim->vnum >= 10000 && victim->vnum <= 11000 )
{
   generate_quest( ch, questman );
   return;
}

Alternatively, instead of generating a new quest you could just use find_quest_mob and find_quest object respectively.