How do i do this?

I would really like to do this:

I want to create a game that has a murder and a suspect in there and a few innocent people. But i would like to mix them up each time.

And i would like to do the same with objects like some objects kill you but it randomizes each time.


Any ideas how i would do that? :D

You could just add each person/object to a list, then pick one at random.

Sorta like this.


wholist = NewObjectList ()
whatlist = NewObjectList ()

list add (wholist, MissScarlet)
list add (wholist, ColonelMustard)
list add (wholist, MrsWhite)
list add (wholist, ReverendGreen)
list add (wholist, MrsPeacock)
list add (wholist, ProfessorPlum)

list add (whatlist, Candlestick)
list add (whatlist, Dagger)
list add (whatlist, LeadPipe)
list add (whatlist, Revolver)
list add (whatlist, Rope)
list add (whatlist, Spanner)

index = GetRandomInt ( 0, ListCount ( wholist ) )
game.whodidit = ObjectListItem(wholist, index)

index = GetRandomInt ( 0, ListCount ( whatlist ) )
game.whatdidit = ObjectListItem(whatlist, index)

Careful!
index = GetRandomInt ( 0, ListCount ( wholist ) -1)

Huh, is it really Inclusive?

I am used to (int)rand(4) = 0 to 3. :P

dan88891 wrote:I would really like to do this:

I want to create a game that has a murder and a suspect in there and a few innocent people. But i would like to mix them up each time.

And i would like to do the same with objects like some objects kill you but it randomizes each time.


Any ideas how i would do that? :D


That sounds almost identical to my game Sleuth, which is in and of itself a remake of the 1980 game Sleuth by Eric N. Miller ( I remade it with permission.)

You should check it out! http://www.textadventures.co.uk/review/495/