Warcraft III resources & community, 2003–2006 · archived

WC3's Random Number Generator

14 posts
#1

WC3's Random Number Generator

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
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
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
VGsatomiThat 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


No, I was playing normally, not thru the test map feature.
#5
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
Well, again, thats a world editor feature.

No, I was playing normally, not thru the test map feature.


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


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
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
VGsatomiOkay, 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


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
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
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
VGsatomiSo 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


No, the variable RaceTerran is an array, and that array uses the integer to determine what player it affects.

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


Thats the idea.
#13
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
VGsatomiThis 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


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.