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

Problem with string commands

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2017
Messages
251
I had an idea of showing the hints in 2 ways. One way is below. Here's an example. The trigger isn't done, as there's more work:
Hint
  • Events
    • Time - Every 80.00 seconds of game time
  • Conditions
  • Actions
    • -------- Here, hints will appear, depending on a chance. --------
    • Set Hint_Number = 20
    • Set Hint_Chance = (Random integer number between 1 and Hint_Number)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Hint_Chance Less than or equal to 20
      • Then - Actions
        • Game - Display to (All players) for 10.00 seconds the text: (String(Hint_Chance...
      • Else - Actions
I think I'm the one who isn't getting this, because some triggers had string commands, just like the one above. Is there something wrong with it?
And as the 2nd way, I wanted to show hints by typing commands, like -hint [number here]. It works up to 20. This is also difficult. Can anyone tell me how to use string commands the right way?
 
because some triggers had string commands, just like the one above.
There's no string command above, what do you mean?

For getting hint by command, you can make a trigger that runs when a player types "-hint" as substring. Then you get the string after "-hint", you have to use the substring function for this. Then convert the substring to the hint index, and display the message.
 
  1. You didn't answer the question.
  2. Again, it's confusing as it seems you mix up string command and the periodic trigger.
  3. Hint[Hint_Chance] should be a string already.
  4. (Entered chat string) Equal to Substring(-hint, 1, 3) does make no sense. You check if entered chat string is "-hi". Why you need a condition there at first?
  5. If you say something is not working, show the trigger.
 
Level 6
Joined
Aug 5, 2017
Messages
251
4. I see what was the idea of that (-hint, 1, 3).
Okay, made the code a bit better, but my problem still persists:
  • Hint
    • Events
      • Player - Player 1 (Red) types a chat message containing -hint as A substring
      • Player - Player 2 (Blue) types a chat message containing -hint as A substring
      • Player - Player 3 (Teal) types a chat message containing -hint as A substring
      • Player - Player 4 (Purple) types a chat message containing -hint as A substring
    • Conditions
    • Actions
      • Set Hint[1] = |cFF0DC25DHint |r|cFFDFBE071/20|r|cFF0DC25D: Before starting the tower defense map, make sure you read the buttons from the Quests icon. You might find some useful info there.|r
      • Set Hint[2] = |cFF0DC25DHint |r|cFFDFBE072/20|r|cFF0DC25D: For fast travelling from one point to the other, every builder has the Ultimate Blink ability. This does save a lot of time! Use it when you wish.|r
      • Set Hint[3] = |cFF0DC25DHint |r|cFFDFBE073/20|r|cFF0DC25D: While building towers, make sure you leave some space for the advanced towers built by the improved builders.|r
      • Set Hint[4] = |cFF0DC25DHint |r|cFFDFBE074/20|r|cFF0DC25D: When advancing further, you may want to start building towers in an organized manner.|r
      • Set Hint[5] = |cFF0DC25DHint |r|cFFDFBE075/20|r|cFF0DC25D: Above the Builder Tavern, you'll find the Research Center. It contains diverse upgrades for some of your towers. While you can purchase all of the upgrades, it's better to think before upgrading.|r
      • Set Hint[6] = |cFF0DC25DHint |r|cFFDFBE076/20|r|cFF0DC25D: Above the Research Tower, there's the Hero Academy. This building allows you to train various heroes for use.|r
      • Set Hint[7] = |cFF0DC25DHint |r|cFFDFBE077/20|r|cFF0DC25D: The Hero Academy has 12 heroes in total. 4 of them have regular attacks, 4 of them have chaos attacks and the final 4 have that new attack that I will specify in a later hint.|r
      • Set Hint[8] = |cFF0DC25DHint |r|cFFDFBE078/20|r|cFF0DC25D: Every hero does comsume |r|cFFFFCC004 |r|cFF0DC25Dfood. While you can research 2 regular heroes, it's wise to check the list further.|r
      • Set Hint[9] = |cFF0DC25DHint |r|cFFDFBE079/20|r|cFF0DC25D: When you reach wave 21, start building Detector Towers. Those excel at spotting hidden units.|r
      • Set Hint[10] = |cFF0DC25DHint |r|cFFDFBE0710/20|r|cFF0DC25D: When you encounter air units, build towers that fend off air units. Those start at wave 15.|r
      • Set Hint[11] = |cFF0DC25DHint |r|cFFDFBE0711/20|r|cFF0DC25D: Certain mechanical units do have |r|cFFCB8055Fortified |r|cFF0DC25Darmor. Those star at wave 26. Once you build the Earth Builder, start constructing earth towers. |r
      • Set Hint[12] = |cFF0DC25DHint |r|cFFDFBE0712/20|r|cFF0DC25D: Except for 1 tower, all earth towers attack ground units. Watch out! |r
      • Set Hint[13] = |cFF0DC25DHint |r|cFFDFBE0713/20|r|cFF0DC25D: For causing fire damage and sometimes, making the enemies explode, once you unlock the Fire Builder, create fire towers.|r
      • Set Hint[14] = |cFF0DC25DHint |r|cFFDFBE0714/20|r|cFF0DC25D: Because certain creeps might move faster than usual, it would be wise to build cold tower, once you built the Ice Builder.|r
      • Set Hint[15] = |cFF0DC25DHint |r|cFFDFBE0715/20|r|cFF0DC25D: Certain towers prove useful for creeps that have higher hit points, but move slower than usual. That would be the time to build lightning towers. You just need the Lightning Builder. That's all.|r
      • Set Hint[16] = |cFF0DC25DHint |r|cFFDFBE0716/20|r|cFF0DC25D: Creatures from different games may show up to head towards the portal. The Future Builder should even the odds here. He can also build the Advanced Arrow Bunker.|r
      • Set Hint[17] = |cFF0DC25DHint |r|cFFDFBE0717/20|r|cFF0DC25D: From wave 50 onward, creeps will have |r|cFFE4E27ADivine |r|cFF0DC25Darmor. You have 2 choices: 1: You will build the only tower with chaose damage from the Future Builder or train the Ultimate Builder.|r
      • Set Hint[18] = |cFF0DC25DHint |r|cFFDFBE0718/20|r|cFF0DC25D: If you want to do extra damage to divine beings, the Ultimate Builder is the way to go. Read the Divine armor text from an enemy for details.|r
      • Set Hint[19] = |cFF0DC25DHint |r|cFFDFBE0719/20|r|cFF0DC25D: The tables of the divine category have changed. Now, spells do full damage to them.|r
      • Set Hint[20] = |cFF0DC25DHint |r|cFFDFBE0720/20|r|cFF0DC25D: Going back to the Hero Academy, the last 4 have a divine attack. Use them against your opponents, especially at the last boss. That was the last hint. Hope you have fun playing my tower defense map!|r
      • -------- Here, hints will appear, depending on a chance. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to Substring(-hint, 1, 5)
        • Then - Actions
          • Set Hint_Chance = (Random integer number between 1 and 20)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hint_Chance Less than or equal to 20
            • Then - Actions
              • Game - Display to (All players) for 15.00 seconds the text: (String(Hint_Chance))
            • Else - Actions
        • Else - Actions
Any idea how can I fix this?
 
You need to learn to explain the situaton and problem better.

What's the goal of this trigger? If you want to display a random hint when writing "-hint", then don't use substring checks. Use exact matches here.

You need substring if you want a trigger with "-hint 1" , that displays the first hint, etc.

The lines where you set up the hints, Hint[1] =, .... can be in an other trigger that runs only once at map start.

Why the Hint_Chance is printed, and not the one hint?

A random number is choosen between 1 and 20, so the condition "Hint_Chance Less than or equal to 20" makes no sense.
 
Status
Not open for further replies.
Top