Random PC or MOB

For builders to discuss and ask building questions.
Post Reply
Vibius
Sword Grand Master
Sword Grand Master
Posts: 433
Joined: Mon Nov 12, 2007 12:35 pm
Location: Waterdeep

Random PC or MOB

Post by Vibius » Fri May 17, 2013 8:32 am

Hi!

Does anyone knows if there is any way of targetting one mob or character between all the mobs and PCs in the room? (Not just a pc, which I would be it would be with $r, it could be a mob or pc) And just a random mob?

Thanks!
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Random PC or MOB

Post by Harroghty » Fri May 17, 2013 11:03 am

What specifically are you trying to accomplish?
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Vibius
Sword Grand Master
Sword Grand Master
Posts: 433
Joined: Mon Nov 12, 2007 12:35 pm
Location: Waterdeep

Re: Random PC or MOB

Post by Vibius » Fri May 17, 2013 11:07 am

Rubble falling over someone's head (be either a pc or a mob)
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Random PC or MOB

Post by Harroghty » Sun May 19, 2013 1:48 pm

Sorry for the delay; I was travelling.

If you have fixed mobiles in the room (mobiles whose reset location is that room and which are set with ACT_SENTINEL) then you could do something like this:

Code: Select all

>greet_prog 100~
if rand(50)
  if mobinroom(1234) > 0
    mpecho Rocks fall on the first mobile, generically given the VNUM 1234.
    mpmadd m1234 currhp -5
  else
    if mobinroom(5678) > 0
      mpecho Rocks fall on the second mobile, generically given the VNUM 5678.
      mpmadd m5678 currhp -5
    endif
  endif
else
  if dex($n) > 18
    mpechoat $n Rocks fall around you!
    mpechoaround $n Rocks fall all around @N!
  else
    mpechoat $n Rocks fall upon you!
    mpechoaround $n Rocks fall upon @N!
    mpmadd $n currhp -5
  endif
endif
~
I am not sure if a rand_prog will accept the mobiles VNUM as a target. I feel that it probably will not because they are notoriously single-minded in their search for an $r target.
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Vibius
Sword Grand Master
Sword Grand Master
Posts: 433
Joined: Mon Nov 12, 2007 12:35 pm
Location: Waterdeep

Re: Random PC or MOB

Post by Vibius » Tue May 21, 2013 2:39 pm

Lot of thanks Harroghty.
Post Reply