• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Random Integer doesnt work

Status
Not open for further replies.
Level 7
Joined
Apr 13, 2012
Messages
110
  • unitisattackedsounds
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to THEUNIT
    • Actions
      • Set randomsoundattck = (Random integer number between 1 and 100)
      • For each (Integer randomsoundattck) from 1 to 10, do (Actions)
        • Loop - Actions
          • Sound - Play MuradinPissed7 <gen>
      • For each (Integer randomsoundattck) from 11 to 20, do (Actions)
        • Loop - Actions
          • Sound - Play MuradinPissed6 <gen>
      • For each (Integer randomsoundattck) from 21 to 30, do (Actions)
        • Loop - Actions
          • Sound - Play MuradinYesAttack3 <gen>
Thats just weird,It keeps playing the MuradinPissed7 wherever I put it 1 to 10,11 to 20,21 to 30,...1 to 2 it just keeps playing that !@#$%in MuradinPissed7

Is something wrong cause she seems to me just fine
 
You sir, do not know how loops work XD

It will only ever use one variable to do it, it just repeats the actions changing the value of the variable for (1 to 10) or (11 to 20) or whatever

in the example of 1 - 10, it basicall means it'll run 10 times, first time it's value being 1, the second time it being 2, third time it being 3, etc.
 
Level 7
Joined
Apr 13, 2012
Messages
110
Ok guys that just weird

  • unitisattackedsounds
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to THEUNIT
    • Actions
      • Set randomsoundattck = (Random integer number between 1 and 30)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • randomsoundattck Less than or equal to 10
        • Then - Actions
          • Sound - Play MuradinYesAttack3 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • randomsoundattck Less than or equal to 20
          • randomsoundattck Greater than 10
        • Then - Actions
          • Sound - Play MuradinPissed6 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • randomsoundattck Less than or equal to 30
          • randomsoundattck Greater than 20
        • Then - Actions
          • Sound - Play MuradinPissed7 <gen>
        • Else - Actions
I did us you both said and (thats amazing) it was still playing only muradinpissed7 then i replaced that haunted sound and didnt play any other sound wtf???
 
If you're using the -test- map button, randomised things in triggers, aren't so random, they're actually almost always consistently the same thing regardless of how random you make them, this also includes things like, random points being consistent, even if they're map wide, test the map by going into the game manually and playing it, should get more random results.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
If you're using the -test- map button, randomised things in triggers, aren't so random, they're actually almost always consistently the same thing regardless of how random you make them, this also includes things like, random points being consistent, even if they're map wide, test the map by going into the game manually and playing it, should get more random results.
That depends whether Use Fixed Random Seed is enabled in preferences.
 
Status
Not open for further replies.
Top