home » builders » builder's lessons » greed progs

Greed programs

You have a mobile that sells a variety of very good items. Sometimes, he will only allow the PC to shop with him at the end of a hard quest, but you do not want the PC to buy every item on offer, and more importantly buy every item for all his friends. You would like to limit the PC to choosing just one or two of the items on offer. You can do this with an intercept_prog on buy, and a buy prog on each of the vnums for sale that sets up a quest bit on the player. There is no real way to do this without using quest bits.

The sample below is for a mobile that sells special shields. He wants the PC to only choose one of his shields and then he will sell no more of them.

>intercept_prog buy~
if quest(0,1,$n) == 1
  sayto $n No more shields for you.
else
  mpunintercept
endif
~
>buy_prog i17227~
mpmset $n quest 0 1 1
~
>buy_prog i17226~
mpmset $n quest 0 1 1
~
>buy_prog i17225~
mpmset $n quest 0 1 1
~
>buy_prog i17224~
mpmset $n quest 0 1 1
~
>buy_prog i17223~
mpmset $n quest 0 1 1
~
>buy_prog i17222~
mpmset $n quest 0 1 1
~
>buy_prog i17221~
mpmset $n quest 0 1 1
~

First off the intercept_prog on buy checks to make sure that the quest bit has not been reached for purchasing at the shop. If it has he tells the PC's he has no more stock for them. If it hasn't then mpunintercept allows them to buy the item. If they do not have enough money, because of the way this has been done, the quest bit will not be set up.

For each item that the mobile sells that the mobile only wants to sell one of, there is a buy prog. When the item is purchased a quest bit is set up on the PC. The PC buys the item normally. If you wanted, you could have the mobile say something about the qualities of the item.