• 🏆 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!

WC3's Random Number Generator

Status
Not open for further replies.
Level 2
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.
 
Level 2
Joined
Aug 26, 2005
Messages
13
VGsatomi said:
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

No, I was playing normally, not thru the test map feature.
 
Level 2
Joined
Aug 26, 2005
Messages
13
VGsatomi said:
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.
 
Level 22
Joined
May 11, 2004
Messages
2,863
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
 
Level 2
Joined
Aug 26, 2005
Messages
13
VGsatomi said:
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

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.
 
Level 2
Joined
Aug 26, 2005
Messages
13
VGsatomi said:
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

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.
 
Level 22
Joined
May 11, 2004
Messages
2,863
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
 
Level 2
Joined
Aug 26, 2005
Messages
13
VGsatomi said:
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

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.
 
Status
Not open for further replies.
Top