• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Help with Variables

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I'm making a game that uses Dialogs with sounds, but I want some of them to be random, like this:

String[1] = Hi!
Sound[1] = Hi!
String[2] = Hello!
Sound[2] = Hello!

JASS:
// I use
                       call AddLineToDialog(udg_String[2])
                       call AddSoundToDialog(udg_Sound[2])
// The sound is played at the same time that the line is displayed

I want to set all the Strings and Sound in one trigger, and make them be 'called' as random, but same random for both, string and sound....

So far I do this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random integer number between 1 and 2) Equal to 1
    • Then - Actions
      • Custom script: call AddLineToDialog( "Hello")
      • Custom script: call AddSoundToDialog(gg_snd_Hello)
    • Else - Actions
      • Custom script: call AddLineToDialog( "Hello there")
      • Custom script: call AddSoundToDialog(gg_snd_HelloThere)
EDIT: Idea
Setting 'I = Random Integer between 1 and MaxStringAndSounds'
  • Custom script: call AddLineToDialog(udg_String[I])
  • Custom script: call AddSoundToDialog(udg_Sound[I]")
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Omg... it works... I can't believe I managed to do this... xD I'm so excited haha! It's amazing! I can't way to publish the map for you and the others to review :p
 
Status
Not open for further replies.
Top