Random progs and the next step

For builders to discuss and ask building questions.
Post Reply
Tandria
Sword Grand Master
Sword Grand Master
Posts: 384
Joined: Mon Nov 10, 2003 9:03 pm
Location: Outskirts of Waterdeep
Contact:

Random progs and the next step

Post by Tandria » Fri Aug 26, 2005 6:53 pm

All right. I've been coding a quest for an area I've been working on for some time and would really like to finish, but the quest's been mighty tricky. Here's where it goes afoul (some things were changed so as not to spoil the quest ;)):

Code: Select all

>rand_prog 50~
if questr(101200,0,3,$r) == 7
  mpecho {D0}Something really cool happens{D0}.
  smile
  sayto $r Bleh!
  mposet i8135 short {70}a big fat monkey
  mposet i8135 long {70}A big fat monkey lies here.
  mposet i8135 name big fat monkey i8135
  give monkey $r
  drop monkey
  sayto $r For the next step, go see Bibbledy and he will dance
  sayto $r around the room.
  mpmset $r questr 101200 0 3 8
endif
~
|
PC goes to see Bibbledy, and the following progs do not work:

Code: Select all

>greet_prog 100~
if questr(101200,0,3,$n) == 8
  smile $n
  sayto $n Whee!
  sayto $n Whee whee!
endif
~
>speech_prog yes aye sure~
if questr(101200,0,3,$n) == 8
  grin
  sayto $n Aha!
  sayto $n You have the monkey!
  sayto $n Give it here.
endif
~
>give_prog i8135~
if questr(101200,0,3,$n) == 8
  stuff happens
  mpmset $n questr 101200 0 3 9
endif
~
Why won't my other progs work? I am confused :(.
"May your travels be Wonderful and Mysterious."
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 Aug 26, 2005 7:40 pm

It should work.

Check for typoes in your real programs, make sure the mob can see the PC (if the room is dark, there is no light, and the mob does not have infravision, he might not see $n).

The "sayto $r" right before the "mpmset $r" work, do they?
Image
Tandria
Sword Grand Master
Sword Grand Master
Posts: 384
Joined: Mon Nov 10, 2003 9:03 pm
Location: Outskirts of Waterdeep
Contact:

Post by Tandria » Fri Aug 26, 2005 7:55 pm

Yep, all the sayto $r worked. As far as I can see, there are no typoes or extra spaces, so I'm really not sure what could be wrong with it. On the testport I tried giving the mob a light and it still won't do anything, and it doesn't work when I manually mpmset myself rather than letting the quest go through.
"May your travels be Wonderful and Mysterious."
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 Aug 26, 2005 8:52 pm

Ah, found it.

1 quest bit -> values can be 0 or 1.
2 quest bits -> values can be 0, 1, 2, or 3.
3 quest bits (what you have) -> values can be 0, 1, 2, 3, 4, 5, 6, or 7.

So, mpmset $r quest ... 0 3 8 does not work (I would guess that it set it to 1).

You need to use a 4 quest bit block (at least).
Image
User avatar
Tempus
Staff
Staff
Posts: 669
Joined: Fri Jul 18, 2003 9:34 pm
Location: Warrior's Rest

Post by Tempus » Fri Aug 26, 2005 9:02 pm

You can't count to 8 on 3 bits, you need 4. A check on a number 3 bits wide comes to a maximum of binary 111 which is 7.

Dal beat me to it - but the mpmset DOES work (you can try it and check, it just spills over into the 4th bit), its the 'if questr()' check that can never succeed.
Tempus does not win battles - Tempus helps the deserving warrior win battles.
User avatar
Andreas
Sword Grand Master
Sword Grand Master
Posts: 720
Joined: Fri Aug 01, 2003 4:55 am
Location: Mobile, Alabama
Contact:

RE: Random Progs & Quest Generation

Post by Andreas » Sun Oct 23, 2005 5:51 pm

Something I was thinking about...

Is it possible to create a program that will allow a mob to choose from X number of random quests to give a PC? (*cries* I've been corrupted by statistics and probability!!)

i.e.

PC John Doe goes to MOB. MOB has 3 quests, but will randomly choose 1 to assign every time a PC comes in. MOB assigns Q1 to John. Then PC Jane Doe comes in and MOB randomly chooses to assign Q3 to her.

My reasoning behind this is to prevent PCs from loading up on what they know they need for "fetch and carry" or "hunt and kill" quests. They'll go and never know which quest they'll be assigned.
Helm keep thee.
Gwain

Post by Gwain » Sun Oct 23, 2005 7:04 pm

I've been thinking about this, would it possible to have the quest generator randomly choose based on the skills and guild? like a large fill in the blank for various statistics. For example an evil pigeon tamer of Loviatar could be given a quest to save or gather something based on her stats.
User avatar
Kregor
Sword Grand Master
Sword Grand Master
Posts: 1474
Joined: Sun Jul 11, 2004 6:14 am
Location: Baldur's Gate

Random progs and the next step

Post by Kregor » Sun Oct 23, 2005 10:01 pm

Andreas wrote:Something I was thinking about...

Is it possible to create a program that will allow a mob to choose from X number of random quests to give a PC? (*cries* I've been corrupted by statistics and probability!!)

My reasoning behind this is to prevent PCs from loading up on what they know they need for "fetch and carry" or "hunt and kill" quests. They'll go and never know which quest they'll be assigned.
I think this would be possible, you could put each possible quest in its own little block of qbits, and then have the mob's check for qbits check for any and or all of the completed quests in the initial greet prog (this is in simplest form):

Code: Select all

>greet_prog 100~
if quest(0,2,$n) == 3
or quest(2,2,$n) == 3
or quest(4,2,$n) == 3
  mob acts as if quest is complete.
else
  if quest(0,2,$n) > 0
  or quest(2,2,$n) > 0
  or quest(4,2,$n) > 0
  else
    if rand(33)
      offer quest A
    else
      if rand(50)
        offer quest B
      else
        offer quest C
      endif
    endif
  endif
endif
Note, the second > 0 strings cause the prog to not only check that none of the quests have been completed, but also none are in progress, else you could come back to the same mob during one quest, and would be offered another.

So with this model, the mob would ask a char with all the above quest bits at 0 to complete only one of the quests, each with an equal chance of being the quest assigned, therefore randomizing the necessary tasks to complete.

This same kind of randomization could be really good in Q&A quests to randomize the questions asked and their answers. Even more irritating for a quest writer probably, besides those who go and hunt items in advance to take to a mob for an item fetching quest, are the Q&A quests in which the answers start being passed around on chat, or OOCly between alts of the same player
"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
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

Post by Kelemvor » Sun Oct 23, 2005 10:59 pm

I'm not a coder by any means. Well, not unless you count being able to put colour in a quest :)

The best way I've found to prevent folks storing up the items ready for a quest is to make them go to a mob and ask for an item they dont stock.

Or send them to a mob that does not exist until they get to the relevant place and only stays long enough to take part in the quest.

What else.. hmm. have them search for items that similarly dont exist until they go to the right place.

Question/Answer quests are more vulnerable to OOC info swapping unfortunately. Randomising them as above would be a neat way to combat this.

Making three random questions similar in phrasing but the answers very different would put a nice spanner in the OOC brigades works.
...never send to know for whom the bell tolls,
it tolls for thee.
User avatar
Andreas
Sword Grand Master
Sword Grand Master
Posts: 720
Joined: Fri Aug 01, 2003 4:55 am
Location: Mobile, Alabama
Contact:

RE: Random Progs & Quest Generation

Post by Andreas » Mon Oct 24, 2005 12:11 pm

Thanks for the code snippet, Kregor :) Too bad I'm so code impaired that I don't understand it at all. But glad you guys understand what I'm trying to to and why. I'll give some thought to a random code quest and see what I can come up with :D
Helm keep thee.
Post Reply