home » builders » builder's lessons » give prog

Give programs

Give programs are activated when a mobile is given a certain object.

>give_prog i8140~
if quest(10, 4, $n) == 2
  mpecho Jonathon grabs a rag and starts to polish the shield.
  sayto $n This will do nicely!
  sayto $n While you were gone I had another order.
  sayto $n An adventurer in town for a short time is
  sayto $n in need of a hardened leather helm.
  sayto $n I hear Rebeleigh stocks it.
  mpecho Jonathon turns back to polishing his shield assuming you will get him what he asks.
  mpmset $n quest 10 4 3
  mpjunk i8140
endif
~
|

This is one of the give programs on Jonathon the Armour in Waterdeep. Note that there is an i before the vnum of the item that he wants. This is important or the give program will not work. This program activates when the player gives Jonathon a polished shield, it then checks that the quest bits on the player are right before proceeding with the rest of the program. He talks to the player a little before setting their quest bits up another step. He then junks the item. Most of the time it is necessary for items to be junked. For instance the mob could then be killed for an item, or they would sell it in the shop and so on. Leaves too much room for cheating not to junk the item in most cases.

>give_prog i28428~
if quest(6, 4, $n) == 1
  mpjunk i28428
  sayto $n Ahhhhhhhhhhhhhhhh.
  mpecho The Moonclaw Leader carresses the gem reverently.
  sayto $n This makes you worthy of becoming a member of our guild.
  mpoload 28423
  mpgive badge $n
  mpechoat $n The guild leader hands you a badge.
  mpechoaround $n The guild leader hands $N a badge.
  sayto $n Wear this with pride as we are the superior Theives
  sayto $n Guild in the city of Faerdale.
  mpmset $n quest 6 4 2
  if class($n) == Rogue
    if guild($n) != Bards
      if guild($n) != Thieves
        mpmset $n guild Thieves
        mpechoat $n You have joined the guild of thieves.
      endif
    endif
  endif
  mpmadd $n lawful -100
  mpmadd $n good -100
  mpmadd $n exp 1000
  mpmadd $n qp 1
endif
~

This give program is a bit more complicated. This is the give program on the Moonclaws leader in Faerdale. The PC gives the leader a gem hes been asked to steal. The program checks that the quest bits are correct and then executes the rest of the program. Note that if the quest bits are not right the leader will just keep the gem and nothing will happen. If you wish you could put an else before the last endif of the prog handing the gem back to the PC, or keep it saying something to the effect of Thanks for the goodies. If the quest bits are correct the program junks the gem, talks the player and loads the badge. Note that we use mpgive to give the badge to the player. If you use normal give, and the players hands are full then they cannot give the item to the player. Mpgive bypasses this. The player gets the item reguardless of if they are maxed out on what they can hold and their carry weight. However there is NO echo for mpgive so you have to do the echo, which you can see we have done here. It is often good to do a echo around the player getting the object too, so other players in the room can see that the PC was given an object. The prog then sets the players quest bit up.

After this point the program gets a little more complicated and starts checking the base class of the PC, and if they are NOT in the bards or the thieves guilds. If they are not in any of these guilds it then sets them into the thieves guild. If you are wanting to place a PC in one of the guilds as a result of your quest RUN IT BY US first. Do not do so without asking permission. The program then goes on to give experience, change the players lawful and good and give them a glory point.