home » builders » builder's lessons » yell for help progs

Yell for help programs

Please note that the new justice system code for a Guard vnum will protect your area. See the lesson about the Justice System for more detail. However, if a mobile has a fight prog, they will not utilise the justice system guard to call for help. The following system, was our old system and is not used for MOST mobiles. It is used for mobiles who have a fight prog for some other reason.

The mobiles in your area come under attack from a PC. Do they fight back, do they run for their lives, do they call for help? It all depends on what is IC for that area. But for many areas, like temples and cities, if someone is attacked, then help will come running. The following are progs that all for help to come.

>fight_prog 100~
if ispc($n)
  if rand(50)
    yell Guards! $N is attacking me!
    yell I am on $b.
    if rand(50)
      if quest(0,3,self) < 3
        mpecho A guard comes rushing to the aid of $I.
        mpmload 22850
        mpforce guardian mpkill $n
        mpmadd self quest 0 3 1
      endif
    endif
  endif
endif
~
|

When the mobile with this prog is attacked, he will yell for the guards. He will state where he is, which is $b. $b will echo the room name. Then 50% of the time a guard will be loaded up. Quest bits are set on the mob each time a guard is loaded. To prevent the room being filled with an unlimited amount of guards, the quest bits will only allow 3 guards maximum to come running to the aid of the mobile.

These progs load up a naked guard. You could get more elaborate with your prog, and load them into a room you have set up for that purpose, and with mpats, force them to load equipment with mpoload and force them to wear it, and then force them to mpgoto to the room where the mobile under attack is. An equiped guard makes them a more formidable foe. To prevent abuse of the fact that equipment is being loaded, it is good to include in the death prog, and mpjunk of the equipment. It can happen all the time or it can happen a percentage of the time.

Note that when you are setting the quest bits on a mob, it sets the quest bits for ALL of the mobs of the same VNUM. So that is why it is good to set the bit back to 0 when the mob dies, so that if another mob is attacked they can call for help and get guards as well.