Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
Bing

Members: 0
Guests: 35
Stats
Files
Topics
Posts
Members
Newest Member
489
3,792
19,647
597
Aileenutz

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Get Mob A to check whether Mo...
Forum Rules | Mark all | Recent Posts

Get Mob A to check whether Mob B has an item?
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 29, 2009 9:50 pm   
Go to the top of the page
Go to the bottom of the page

irbobo
Fledgling
GroupMembers
Posts16
JoinedApr 8, 2009

 
I know this is probably simple but for some reason I'm having the worst of luck getting it to work.

Basically Mob A randomly checks the room for a random MOB lets say Mob B and then checks to see if Mob B is wearing item with vnum xxx and if so Mob A attacks Mob B

Oh and Mob B can either be a NPC or PC...

Is this possible?

Post is unread #2 Apr 29, 2009 10:03 pm   
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

 
You should probably specify if you're looking for this to be done via code or OLC.

Post is unread #3 Apr 29, 2009 10:13 pm   
Go to the top of the page
Go to the bottom of the page

irbobo
Fledgling
GroupMembers
Posts16
JoinedApr 8, 2009

 
OLC preferably

Post is unread #4 Apr 29, 2009 11:08 pm   
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

 
> speech_prog bobo
if mobinroom(101) >= 1
 mpecho Mob Here!
 if ovnumhere(100) >= 1
  mpecho Object Here!
  else
  mpecho No object!
 endif
else
mpecho No mob!
endif


Edit as you please. Note that you can't detect an object another player has using a program like this. It can:

definitions:
... room - in the room the mobile is in
... wear - worn by the mobile as equipment
... inv - in the mobile's inventory
... carry - worn or in inventory
... here - all of the above

That program will detect the object if the actor(the mob the program is on) is holding the object, not another mob. At the moment, I can't think if there is another way to do what you want, but if not, it wouldn't be hard to add in.

Post is unread #5 Apr 30, 2009 12:09 pm   
Go to the top of the page
Go to the bottom of the page

Hanaisse
Magician
GroupMembers
Posts196
JoinedNov 25, 2007

 
I don't think I'd use a speech prog... there's no indication the PC is going to say anything to trigger it.

I'd be inclined to use a greet prog (if Mob A is stationary) or an entry prog (if Mob A is a wanderer). Another possibility is a rand prog and have Mob A teleport to the PC.

Is there any reason you want it to trigger on NPC's? My opinion but I find creating fights between mobs that no one will see kind of unnecessary.

Post is unread #6 Apr 30, 2009 1:19 pm   
Go to the top of the page
Go to the bottom of the page

irbobo
Fledgling
GroupMembers
Posts16
JoinedApr 8, 2009

 
Well I was converting the hood.are from Rom 2.4 area format over and was wondering if I could do the gang actions via olc instead of hardcoding them as specials... I opted to hardcoding the patrolmans code..

Post is unread #7 Apr 30, 2009 1:21 pm   
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

 
It's pretty difficult to create truly dynamic and interesting behavior in mudprog; oftentimes coding up a spec_fun routine is the easier option. The downside is of course that to modify it, you have to recompile and re/hotboot the game.

Post is unread #8 Apr 30, 2009 2:00 pm   Last edited Apr 30, 2009 2:02 pm by irbobo
Go to the top of the page
Go to the bottom of the page

irbobo
Fledgling
GroupMembers
Posts16
JoinedApr 8, 2009

 
For those of you who were wondering what the spec_patrolman code conversion might be (this worked):



#define OBJ_VNUM_WHISTLE 18516
#define MOB_VNUM_PATROLMAN 18206

bool spec_patrolman(CHAR_DATA *ch)
{
    CHAR_DATA *vch,*victim = NULL;
    OBJ_DATA *obj;
    char *message;
    int count = 0;

    if (!IS_AWAKE(ch) || ch->in_room == NULL
    ||  IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL)
        return FALSE;

    /* look for a fight in the room */
	// for( victim = ch->in_room->first_person; victim; victim = v_next ) // example
    /* for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) // old */
	for(vch = ch->in_room->first_person; vch; vch = vch->next_in_room)
    {
		if (vch == ch)
			continue;

		if (vch->fighting != NULL)  /* break it up! */
		{
			victim = vch;
			/* // old
				if (number_range(0,count) == 0)

				victim = (vch->level > vch->fighting->level) 
				? vch : vch->fighting;

			*/
			count++;
		}
	}

    if (victim == NULL || (IS_NPC(victim) && victim->spec_fun == ch->spec_fun))
		return FALSE;

    if ( ((obj = get_eq_char(ch,WEAR_NECK_1)) != NULL &&   
	         obj->pIndexData->vnum == OBJ_VNUM_WHISTLE) ||  
		 ((obj = get_eq_char(ch,WEAR_NECK_2)) != NULL && 
             obj->pIndexData->vnum == OBJ_VNUM_WHISTLE) )
    {

/* // OLD!
		act("You blow down hard on $p.",ch,obj,NULL,TO_CHAR);
		act("$n blows on $p, ***WHEEEEEEEEEEEET***",ch,obj,NULL,TO_ROOM);
*/

        act( AT_ACTION, "You blow down hard on your whistle.", ch, NULL, victim, TO_VICT );
        act( AT_ACTION, "$n blows on $s whistle, ***PHE-WHEEEEEEEEEEEET***", ch, NULL, victim, TO_NOTVICT );

    	for ( vch = first_char; vch != NULL; vch = vch->next )
    	{
            if ( vch->in_room == NULL )
            	continue;

            if (vch->in_room != ch->in_room &&  vch->in_room->area == ch->in_room->area)
            	send_to_char( "You hear a shrill whistling sound.\n\r", vch );
    	}
    }

    switch (number_range(0,6))
    {
		default:	
			message = NULL;		
			break;
		case 0:	
			message = "$n yells 'All roit! All roit! break it up!'";
			break;
		case 1: 
			message =  "$n says 'Society's to blame, but what's a bloke to do?'";
			break;
		case 2: 
			message = "$n mumbles 'bloody kids will be the death of us all.'";
			break;
		case 3: 
			message = "$n shouts 'Stop that! Stop that!' and attacks.";
			break;
		case 4: 
			message = "$n pulls out his billy and goes to work.";
			break;
		case 5: 
			message = "$n sighs in resignation and proceeds to break up the fight.";
			break;
		case 6: 
			message = "$n says 'Settle down, you hooligans!'";
			break;
    }

    if (message != NULL)
		act( AT_SAY, message, ch, NULL, NULL, TO_ROOM );
	/* act(message,ch,NULL,NULL,TO_ALL); // OLD */

    multi_hit(ch,victim,TYPE_UNDEFINED);
	

    return TRUE;
}

Post is unread #9 Apr 30, 2009 7:30 pm   
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

 

Hanaisse said:

I don't think I'd use a speech prog... there's no indication the PC is going to say anything to trigger it.

I'd be inclined to use a greet prog (if Mob A is stationary) or an entry prog (if Mob A is a wanderer). Another possibility is a rand prog and have Mob A teleport to the PC.

Is there any reason you want it to trigger on NPC's? My opinion but I find creating fights between mobs that no one will see kind of unnecessary.

A speech prog is easier to trigger when you're testing it. It can be so easily converted into an allgreet prog that I don't see the point in your post.

Pages:<< prev 1 next >>