multi layer random gen

sinamas
10-05-2009, 09:23 AM
ok so im trying to write a customized loot table for my buddy to use while playing D&D so what i would like is to click a button and it would random 1 to 100 and and show the type inside that and automaticaly roll again with the properties.
So i will have like for minor items random 1 to 100 first to see what kind, from there its kinda like a 5 way split each of which needs to do another random 100 now thefirst 95 pct of each of the second rolls will be just a standard mix of items but the last 5 pct will be roll twice on the 100 table again. now how if the roll twice was hit would i get the first catagory name there and then both of the secondary items on there aswell?

ex first roll is random 73 which would come out weapon, for the property phase i roll a 18 so its just a plus one so how would i get both names to pop up like sword +1
ex2 a random 34 came up so its a full plate and then i got a 99 so i would have to roll twice, so now i want a display to come up and say full plate +2 of greater defense any clues?
i cant seem to get the multiple name to pop up in a message window any clue you guys could give me would be great thanks

vb5prgrmr
10-05-2009, 09:37 PM
Are you using some sort of database? Textfile, access etc? If so, then as part of your information within table/file you should have a field/zone that defines the need for such actions...

(hold on moment/goes and digs out DMG from v2)

Okay, DMG from v2 shows a longer process than what you have described but the function for random determination of dice rolls is the Rnd Function to be used in conjunction with the randomize statement...

Program starts and whether it is sub main or form load you use the keyword Randomize...

Sub Main()
Randomize
Form1.Show
End Sub

Public Function Roll100() As Integer
Roll100 = Int((100 * Rnd) + 1) 'returns 1 to 100, if want 0 to 99 then remove +1
End Function



Good Luck

sinamas
10-06-2009, 12:00 AM
ty for replying but maybe it wasnt clear, i understand how to do the random number and no i am not using it off a database i havent figured out how to link an excell sheet in yet, but i am learnin lol now i was gonna type it all in its only like 80 items to random between

something like

random 1-100
if 1-25 then a
if 26-50 then b
is 51-75 then c
is 76-96 then d
is 97-100 then roll twice more

but thats not necisarily the hard part i want each roll to show up in a message box like for each time it randoms 100 so it would put the name from the roll one and property of roll two both in the same message box or if the roll twice would be rolled then all three rolls

vb5prgrmr
10-06-2009, 08:37 AM
Okay, three fields needed

1-25, a, 0
'....
97-100, , 2

So program does random, check first column, checks 2nd and goes does it thing if it finds a value if not checks third column which tells program to do x number of time.



Good Luck

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum