How to make a mob yell when attacked?

For builders to discuss and ask building questions.
Post Reply
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

How to make a mob yell when attacked?

Post by Dalvyn » Wed Aug 06, 2003 12:17 pm

Most citizens, when attacked, will yell and have guards come to help them. Here is how that can be done.

Code: Select all

>fight_prog 20~
yell Help! Guards! $N is attacking me on $b!
if rand(40)
  if quest(0,3,self) < 3
    mpecho {70}A guard comes to help $I.
    mpmload 2007
    mpforce m2007 mpkill $n
    mpmadd self quest 0 3 1
  endif
endif
~
>death_prog 100~
mplog WITNESS: $n has killed $I on $b (room vnum $v)
mpmset self quest 0 3 0
~
The first program makes the mob yell for help. There is then a chance (40%) that a guard will come. The mob cannot summon more than 3 guards though (the number of guards already summoned by this mob is stocked in the mob's quest bits 0,3). The number 2007 is the vnum of the guard to be called.

The second program resets the 'number of guards called'.
Post Reply