Bribe program not working

For builders to discuss and ask building questions.
Post Reply
User avatar
Kelemvor
Sword Grand Master
Sword Grand Master
Posts: 2295
Joined: Mon Apr 11, 2005 6:14 pm
Location: The Fugue Plain within the Crystal Spire

Bribe program not working

Post by Kelemvor » Fri Dec 07, 2007 12:30 pm

Code: Select all

>bribe_prog 500~
mpecho {70}$I carefully slips the money into his purse before bowing humbly.
mpechoat $n {70}You enjoy a long, relaxing bath and emerge from it feeling refreshed.
cast refresh $n
mpechoaround $n {70}$N indulges in a long bath, emerging after a time looking refreshed.
sayto $n Thank you, kind patron. Do please come again.
~
>bribe_prog 1000~
mpecho {70}$I carefully slips the money into his purse before bowing humbly.
mpechoat $n {70}$I leads you to a bed in a side room before proceeding to massage your muscles thoroughly, relieving your accumulated tension. When he eventually comes to a stop, you are feeling relaxed and limber.
cast refresh $n
cast refresh $n
mpechoaround $n {70}$I leads $N off to a side room purposefully. After a while they return, bringing a relaxed looking $N with them.
sayto $n Thank you, kind patron. Do please come again.
~
|
When given 10 gold or 2 platinum, the mob still carries out the bribe prog 500.

Do I need to put these the other way around?

Or is there somethign else whihc is making it ignore the bribe 1000
...never send to know for whom the bell tolls,
it tolls for thee.
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Fri Dec 07, 2007 4:24 pm

Bribe progs are examined in the order in which they are given.

And giving more than the stated value also triggers the bribe_prog.

So, when you give them 2 platinum, the first bribe_prog always trigger. As a rule of thumb, yes, you need to always put the bribe_progs with the highest values first, then the others in decreasing order.

Note that, since a relatively recent code update, in the text of a mpechoaround, you need to replace $N with @N:

Code: Select all

mpechoaround $n {70}$I leads @N off to a side room purposefully.
Image
User avatar
Kregor
Sword Grand Master
Sword Grand Master
Posts: 1474
Joined: Sun Jul 11, 2004 6:14 am
Location: Baldur's Gate

Post by Kregor » Sat Dec 08, 2007 1:14 am

As a note, this is conversely the case with most progs based on a random factor, if you wish to have more than one of them on a mobile, and actually have a chance for all of them to trigger. This is because bribe progs work on a condition of "if amount >= amount", while random progs operate on a condition of "if percent roll <= amount".

For example, if you want to put a fight prog that triggers 50% of the time on a mobile, as well as another fight prog that triggers 30%, you would put the 30% prog first, and the 50% prog second, because the same rand roll is made for the entire prog, and courses down the program, so if it hits the <=50% first, it never has a chance to hit the <=30%.

So, for bribes, load the progs on a mobile top down, largest to smallest. For progs with random argument, smallest to largest.

http://webhome.idirect.com/~helspawn/sm ... grams.html

Is a really good page that explains the inner workings of the Smaug mobile prog code, most of which still pertains to writing them on FK, even though FK has far surpassed the basic workings.
"There is no safety for honest men except by believing all possible evil of evil men."

Kregor - Ranger of Tangled Trees
Rozor - Lady Luck's Duelist
Tygen - Ranger-Bard of Mielikki
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Sat Dec 08, 2007 3:05 pm

Actually, I disagree.

If you want two events to randomly happen during combat, you should put both inside the same fight_prog, to get a clearer code.
Image
User avatar
Kregor
Sword Grand Master
Sword Grand Master
Posts: 1474
Joined: Sun Jul 11, 2004 6:14 am
Location: Baldur's Gate

Post by Kregor » Sat Dec 08, 2007 6:17 pm

or, you can do it that way too :)
"There is no safety for honest men except by believing all possible evil of evil men."

Kregor - Ranger of Tangled Trees
Rozor - Lady Luck's Duelist
Tygen - Ranger-Bard of Mielikki
Post Reply