• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Random Numbers

Status
Not open for further replies.
Level 1
Joined
Jun 30, 2007
Messages
4
So, in my game, I have an ability that is basicly russian roulette. I am using triggers to create the ability's affects. I know that there is a random number generator for int variables, but its not random in the least. The gun fires at the same time, every time. Any ideas on how to get an actual random number everytime?
 
Level 7
Joined
Oct 24, 2006
Messages
110
The gun fires at the same time, every time.

Well, you have to base your ability off "Channel". Then set the Art - Animation Names (i dunno the exact name but the field shows up the animation names) to none.

Here. This is a sample trigger

  • Roulette Random Number
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability Being Cast) Equal To Russian Roulette
  • Actions
    • Set RandInt = (Random integer number between 1 and 20)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandInt Less than or Equal To 10
      • Then - Actions
        • ----Do anything here----
      • Else - Actions
        • Do Nothing
Im using code tags just in case accidental trigger typos.
 
Last edited by a moderator:
Level 8
Joined
Sep 15, 2006
Messages
426
No, that would not be what to do. What you WOULD do is:

  • Roulette Random Number
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability Being Cast) Equal To Russian Roulette
  • Actions
    • Set RandInt = (Random integer number between 1 and 6)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandInt Equal To 6
      • Then - Actions
        • Kill Casting Unit (or whatever)
      • Else - Actions
        • Do Nothing
This is assuming you're simulating RR played with a revolver.

And jonadrian619, please use the trigger tags and not the code tags when posting triggers.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Do not worry, this is a BUG with testing in WE, it will not occure in multiplayer since the random number seed is always random then. You can try and fix it by changing the one WE option that influences the random seed generation for map testing but you do not need to worry since it still may occure. This has been asked so many times I am supriesed it can still be asked.
 
Level 1
Joined
Jun 30, 2007
Messages
4
Under the test options, there is a way to FIX random. That is not what I wanted. I tried (Advanced>Cycle Random Groups) and it changed, so I believe the problem was the one mentioned by Dr. Super Good. I just hope that he is right about the randomizing everytime, because if not, this is going to be a really terrible game! lol Thanks for the help everyone.
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
It's not a bug. You probably just haven't turned off fixed seed in WE.
File -> Preferences -> Test Map -> Uncheck "Use Fixed Random Seed"

Simply seed is a number that determines the sequence of random numbers that will be generated in WC3. It's not really random at all but pseudo random. If you use the same seed you will get the same sequence of "random" numbers. The default in WE is to have this debug option on. When playing the map normally from within WC3 it will always use a random seed.
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
It's not a bug. You probably just haven't turned off fixed seed in WE.
File -> Preferences -> Test Map -> Uncheck "Use Fixed Random Seed"

Simply seed is a number that determines the sequence of random numbers that will be generated in WC3. It's not really random at all but pseudo random. If you use the same seed you will get the same sequence of "random" numbers. The default in WE is to have this debug option on. When playing the map normally from within WC3 it will always use a random seed.

That's exactly what I was saying... :/

-Mihai
 
Status
Not open for further replies.
Top