random hints

Status
Not open for further replies.
Level 8
Joined
Jul 7, 2013
Messages
141
Something like this?

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set string_var[1] = blabla
      • Set string_var[2] = blabla
      • Set string_var[3] = blabla
      • Set string_var[4] = blabla
      • Set string_var[5] = blabla
      • Set string_int = 5
  • Periodic Hint
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: string_var[(Random integer number between 1 and string_int)]
string_var are your hints
string_int is the total number of hints
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
Alternatively, you could get X messages and choose random message between 1 and (X-1). Then swap that chosen message with last message in the list. That will prevent showing same messages as well.

e.g. 5 messages, so you choose random message between 1 and 4. Say message 3 has been chosen, then show that message and swap it with message 5. Now message 5 text is saved as Message3 and vice versa.
 
Alternatively, you could get X messages and choose random message between 1 and (X-1). Then swap that chosen message with last message in the list. That will prevent showing same messages as well.

e.g. 5 messages, so you choose random message between 1 and 4. Say message 3 has been chosen, then show that message and swap it with message 5. Now message 5 text is saved as Message3 and vice versa.

the problem with this is the same 2 messages can be shown over and over again.
 
ya i know what you mean it's just more complicated than you posted.

basically you store all hints from lets say 1 to 10.

then you have an integer array thats empty and an integer array with integers from 1 to 10 and a max index integer

you then use a loop to store the integers from the integer array with integers into the empty integer array and de-index the old integer.
then you use the old array that used to be empty as the index for the hint.
 
Status
Not open for further replies.
Top