• 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.

Randomizing messages using Integers

Status
Not open for further replies.

kj_

kj_

Level 5
Joined
Aug 1, 2008
Messages
134
Simple thread
Where can I find that actions or whatever where it displays a text to a player out of other text it chooses randomly between them
I can't find it
Like If I click a peasant it will show a text and I click him again he will show something else and then randomize between the strings or whatever
Can someone tell me where to find this?
help apprec
+rep if help
:hohum:
~kj_
 
Level 6
Joined
Sep 13, 2008
Messages
261
just replace insert variables with variable of you choice using array of string variable in the last instance.
You have to set the string array variable before the trigger turns on with 10 custom strings.
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Triggering unit) Equal to insertunithere
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: inserttextvariablehere[(Random integer number between 1 and 10)]
need anymore help with this pm me
 
Last edited:

kj_

kj_

Level 5
Joined
Aug 1, 2008
Messages
134
Ok well this is how my trigger looks
  • Speech
    • Events
    • Player - Player 1 (Red) Selects a unit
      • Conditions
    • (Unit-type of (Triggering unit)) Equal to Mercenaries
      • Actions
    • Set Mercanarie[1] = (Interger(Good day, blah blah))
    • Set Mercanarie[2] = (Interger(sfsgy, blah blah))
    • Set Mercanarie[1] = (Interger(gfgfd day, blah blah))
    • Game - Display to (Triggering player), at offset (0.00, 0.00) for 30 seconds the text: (String(Mercenarie[(Random integer number between 1 and 3))))
Ok here is the attachment this is the response I get , did I do something wrong :p
Edit: Note @ Moderators : I deleted my post , so he didn't technically double post.
 

Attachments

  • f.jpg
    f.jpg
    1.2 KB · Views: 90
Level 16
Joined
Mar 26, 2004
Messages
569
Make one string array.
  • Speech
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Mercenaries
    • Actions
      • Set String[1] = Good day
      • Set String[2] = Fine weather, no?
      • Set String[3] = A beautiful day!
      • Game - Display to (Triggering player), at offset (0.00, 0.00) for 30 seconds the text: String[(Random integer number between 1 and 3)]
 
  • Like
Reactions: kj_
Status
Not open for further replies.
Top