1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Welcome to the new Hive! Be advised that we're still working on the site. There are still many rough edges, so please bear with us.
    Dismiss Notice
  3. The 14th Icon Contest is still in progress (and may be extended). You can still make it in time.
    Dismiss Notice
  4. The 25th Texturing Contest has started! Contestants are to create a skin representing a dark elf person/being or any construct related to it using the vanilla models or the custom ones found on the site.
    Dismiss Notice
  5. Buy it, use it, break it, fix it, trash it, change it, mail - upgrade it. Join (Optionally) Paired Techtree Contest #11 - Techno Magic now!
    Dismiss Notice
  6. Voting squad, line up! Cast your vote on the poll for Modeling Contest #29 - Squads!
    Dismiss Notice
  7. Hero Contest #8 is up and running! This time it's a joint contest between artists and coders. Go here for team matchmaking.
    Dismiss Notice
  8. The poll for the theme of our StarCraft II Terraining Contest is up. Cast your note now!
    Dismiss Notice
  9. The ninth Concept Art Contest has launched. Enter now!
    Dismiss Notice
  10. The member Kam is making HIVE coasters. Take a look. For every coaster you buy, Hive gets $1.
    Dismiss Notice

WC3's Random Number Generator

Discussion in 'Map Development' started by IHATEHIPPIES, Oct 19, 2005.

  1. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    I'm having a hard time using WC3's random number generator. Everytime I test the map, it spurts out the same numbers, and therefore the same results. I've re-written my triggers 3 times, and it has become clear that they are not to blame.

    The map used to be quite random. Does anyone have any ideas about what might cause this? I can post the triggers, but I don't think they caused it.
     
  2. Claudz

    Claudz
    Joined:
    Dec 7, 2004
    Messages:
    133
    It just happnes.. happened to me many times to. Just like random names on heroes get's the same! It's somthing with the test map in editor, i dosent happen when u play map for real! :lol:
     
  3. VGsatomi

    VGsatomi

    Webmaster's Council

    Joined:
    May 11, 2004
    Messages:
    3,160
    That only happens when you play the map through the "test map" feature in the world editor. It will always generate the same variables, even if random. If you really want to test triggers with random variables/numbers, play the map normally by opening wc3 and selecting the map in-game.
    -VGsatomi
     
  4. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    No, I was playing normally, not thru the test map feature.
     
  5. N00byStance

    N00byStance
    Joined:
    Jul 4, 2005
    Messages:
    1,074
    You can turn off generating constant random numbers in editor. Go to File -> Preferences, then to Map testing (or something near, I have localized Wc3) tab and uncheck "Use blahblahblah".
     
  6. VGsatomi

    VGsatomi

    Webmaster's Council

    Joined:
    May 11, 2004
    Messages:
    3,160
    Well, again, thats a world editor feature.

    If its happening in game after launching normally, then something is messed up with your triggering. Try posting the triggers.
    -VGsatomi
     
  7. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    I'm pretty sure it's not the triggers, but I shall post them. There are 10 triggers (One for every player in the map). They are slightly different, but they all follow this basic code, shown below.

    Events
    : Is activated by another trigger via the "run trigger" function.

    Conditions
    : None

    Actions
    : Set PlayerSlotCaptain = RaceTerran(Random Integer between 1 and 10)
    : If (All Conditions are true) Then do (Actions) Else (Actions)
    : If - Conditions
    : PlayerSlotCaptain slot status != to is playing
    : Then - Actions
    : Trigger Run (This Trigger)
    : Else - Actions
    : Trigger Run (Next Random Trigger)

    Note: I have used several RND triggers, and these are the latest.
     
  8. VGsatomi

    VGsatomi

    Webmaster's Council

    Joined:
    May 11, 2004
    Messages:
    3,160
    Okay, here's your problem: You are setting your "PlayerSlotCaptain" variable to be a random intiger...but you are not using random intiger variables in your if/then/else conditions...and instead using player position status. It wont work that way. Here's how what trigger would work:

    Set PlayerSlotCaptain = RaceTerran(Random Integer between 1 and 10)

    If: PlayerSlotCaptain = 1
    Then: actions
    Else: actions

    If: PlayerSlotCaptain = 2
    Then: actions
    Else: actions

    (Actions would be assigning the payer captain status, however you plan to do that. repeat until all 10 possible random actions are covered)
    -VGsatomi
     
  9. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    I don't think that will work because PlayerSlotCaptain isn't an integer variable, it is a player variable, which means it can't equal a number. I could, of course, create another variable just for that. I'll try that tommorow, but I remember doing something like that, and it didn't work.

    Anyway, to make sure its clear, the variables PlayerSlotCaptain, and RaceTerran [Array] are player variables. The trigger is designed to give the "Captain Rank" to 1 random player, out of 10 players.
     
  10. VGsatomi

    VGsatomi

    Webmaster's Council

    Joined:
    May 11, 2004
    Messages:
    3,160
    So you are setting a player variable as a random intiger? Still won't work, because player variables don't use intigers. You need to fix your triggering.
    -VGsatomi
     
  11. N00byStance

    N00byStance
    Joined:
    Jul 4, 2005
    Messages:
    1,074
    Doesn't he want to spawn creeps for random player? I think he tries to assign a random player from array and then spawn creeps for him. So then:

    RaceTerran is a player array
    RaceTerran[Random integer number between 1 and 10] returns random player
     
  12. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    No, the variable RaceTerran is an array, and that array uses the integer to determine what player it affects.

    Thats the idea.
     
  13. VGsatomi

    VGsatomi

    Webmaster's Council

    Joined:
    May 11, 2004
    Messages:
    3,160
    This is the last time I am going to point your error out to you, then I am just going to ignore you.

    : Set PlayerSlotCaptain = RaceTerran(Random Integer between 1 and 10) <----is setting an intiger variable
    : If (All Conditions are true) Then do (Actions) Else (Actions)
    : If - Conditions
    : PlayerSlotCaptain slot status != to is playing <----player slot status comprison has nothing to do with intigers.

    That is whats called a "conflictance". It wont work. You are setting up the wrong conditions for the variable.

    -VGsatomi
     
  14. IHATEHIPPIES

    IHATEHIPPIES
    Joined:
    Aug 26, 2005
    Messages:
    13
    I acutally figured it out. It has nothing to do with the variables. While the trigger is running I have cinematic mode activated for all palyers. I tried turning off cinematic mode, and the triggers worked perfectly. Appearently Cinematic mode uses the same random numbers. I suppose Blizzard did this because they were worried the RND would mess with the cinematic.

    BTW, that is not a conflictance, the RND is affecting the Array number (which is an integer) not the player variable.