(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Modding > World Editor Help Zone

World Editor Help Zone Need help with Blizzard's World Editor? Ask general questions about its features and use in this forum. README!

Reply
 
LinkBack Thread Tools Display Modes
Old 11-20-2008, 12:18 AM   #1 (permalink)
 
ShadowHunter291's Avatar

Revolution
 
Join Date: Jul 2008
Posts: 82

ShadowHunter291 has little to show at this moment (3)


Random Number... isn't random at all?

So yeah as if my map doesn't have enough wrong with it already, something that is normally incredibly simple to me is giving me a hard time.

I have this variable, RandomBase, and I have it triggered to be a random number between 1 and 8.

But it always comes out 3.
Always.

So I rename it to RandomBaseP1 (to specifically handle player 1) and make another variable RandomBaseP2 (to specifically handle player 2).

RandomBaseP1 always comes out to 3 still,
and RandomBaseP2 always comes out to 8.

Any ideas?
ShadowHunter291 is offline   Reply With Quote
Old 11-20-2008, 12:34 AM   #2 (permalink)
 
Day-Elven's Avatar

User
 
Join Date: Apr 2008
Posts: 347

Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)


Post your triggers. I never had such bug with this random numbers.
Day-Elven is offline   Reply With Quote
Old 11-20-2008, 01:46 AM   #3 (permalink)
 
ShadowHunter291's Avatar

Revolution
 
Join Date: Jul 2008
Posts: 82

ShadowHunter291 has little to show at this moment (3)


Okay I'm not really sure how to go about getting my triggers into text here. but I'll try.
Okay so I make this trigger run at the start.
Events
Conditions
Actions
Trigger - Run Base Randomizer P1
Wait until (RandomBaseFinishedP1 Equal to True), checking every 0.10 seconds)
Trigger - Run Base Randomizer P2
Wait until (RandomBaseFinishedP2 Equal to True), checking every 0.10 seconds)

And it goes on like that up to P8

Base Randomizer P1
Events
Conditions
Actions
Set NEWRandomBase = (Random integer number between 1 and 8)
Wait 0.10 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomBaseFinishedP1 Equal to False
NEWRandomBase Equal to 1
BTaken1 equal to 9
Then - Actions
Set BTaken1 = (Player number of Player 1 (Red))
Set RandomBaseFinishedP1 = True
Skip Remaining Actions

Then I have the If part repeat for all 8 bases.
With a
Trigger - Run (This trigger) (checking conditions)
at the end.

NEWRandomBase is the variable I'm having the issues with, as its randomization result constantly comes out the same number. I made sure I don't use this variable in any other trigger prior to this one's activation.

BTaken is an integer value I apply to the individual bases, representing what number player should be getting the base. 9 means no player has been assigned to this base (the game crashes from player 0 so I chose 9)
ShadowHunter291 is offline   Reply With Quote
Old 11-20-2008, 05:49 AM   #4 (permalink)
 
Day-Elven's Avatar

User
 
Join Date: Apr 2008
Posts: 347

Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)


It won't work, you just repeat actions for the 1st player several times. And how BTaken1 can be equal to 9 if you have 8 players? try this trigger, and (replace the values of variables if they're wrong in it)
Actions
Custom script: local integer i=-1
Wait 0.10 seconds
Custom script: loop
Set NewRandomBase = (Random integer number between 1 and 8)
Custom script: set i=i+1
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomBaseFinishedP1 Equal to False
NewRandomBase Equal to 1
BTaken1 Equal to 9
Then - Actions
Custom script: set udg_BTaken1 = GetConvertedPlayerId(Player(i))
Set RandomBaseFinishedP1 = True
Skip remaining actions
Else - Actions
Custom script: exitwhen i==7
Custom script: endloop
Day-Elven is offline   Reply With Quote
Old 11-20-2008, 06:05 AM   #5 (permalink)
 
ShadowHunter291's Avatar

Revolution
 
Join Date: Jul 2008
Posts: 82

ShadowHunter291 has little to show at this moment (3)


Ehh your custom scripts are jibberish to me.
Could you explain 'em a bit?
I mean I understand loop and endloop, but why is the local integer -1 instead of 0?
And why two = in the exitwhen?

I'm probably understanding it wrong but it looks like it just loops itself 8 times.

There are 8 players, player 9 is an empty spot but the game at least is meant to recognize a player 9 so it prevents it from crashing.
ShadowHunter291 is offline   Reply With Quote
Old 11-20-2008, 06:10 AM   #6 (permalink)
 
Day-Elven's Avatar

User
 
Join Date: Apr 2008
Posts: 347

Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)


Custom script: loop
Custom script: set i=i+1
<actions>
Custom script: exitwhen i==7
Custom script: endloop
Means that actions will repeat before variable i will become equal to 7,
local variable i=-1
Sets the variable. You need "-1" because in jass player 1 (red) == player(0)

If you want this function to affect on 9th player, write not "exitwhen i==7" but "exitwhen i==8"
Day-Elven is offline   Reply With Quote
Old 11-20-2008, 08:40 AM   #7 (permalink)
 
Dagguh's Avatar

WorldEditor Lame'O
 
Join Date: May 2008
Posts: 101

Dagguh has little to show at this moment (10)Dagguh has little to show at this moment (10)


DUDE!
Go to WorldEditor -> File -> Preferences -> Test Map -> Use Fixed Random Seed has to be OFF!!

BTW There is no random thing in the whole universe.
It might seem random to us.
Dagguh is offline   Reply With Quote
Old 11-20-2008, 09:49 PM   #8 (permalink)
 
darkrider's Avatar

Sacred War Editor
 
Join Date: Dec 2007
Posts: 569

darkrider has little to show at this moment (40)darkrider has little to show at this moment (40)darkrider has little to show at this moment (40)darkrider has little to show at this moment (40)darkrider has little to show at this moment (40)


@dagguh is correct

@day-elven why are you driving nuts our guy here... why dont you just use the normal gui loop for him not to have an schizophrenic attack?
darkrider is offline   Reply With Quote
Old 11-20-2008, 10:08 PM   #9 (permalink)
 
Day-Elven's Avatar

User
 
Join Date: Apr 2008
Posts: 347

Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)Day-Elven has little to show at this moment (39)


You don't need to know jass to use custom scripts with loops. And GUI have no good loop functions.
Y, The way Dagguh suggested must work. Didn't know that such things can be set in preferances. +rep.
Day-Elven is offline   Reply With Quote
Old 11-21-2008, 02:59 AM   #10 (permalink)
 
Big Dub's Avatar

AegisFang@USWest
 
Join Date: Aug 2007
Posts: 432

Big Dub has little to show at this moment (20)Big Dub has little to show at this moment (20)Big Dub has little to show at this moment (20)


lol Might work? There is no way to get a random number if the fixed generator is on. Its FIXED!
__________________
Please remember to give reputation peoples!
If you use my resources in a game give credits to AegisFang@USWest
Really Cool Stuff!
Get your Starcraft 2 resources here!
Big Dub is offline   Reply With Quote
Old 11-21-2008, 03:36 PM   #11 (permalink)
 
ShadowHunter291's Avatar

Revolution
 
Join Date: Jul 2008
Posts: 82

ShadowHunter291 has little to show at this moment (3)


Dude Dagguh, you save the day yet again lol.
<3
I would rep you again, but I can't rep you again recently lol.

Anyways about the custom scripts, I understand that its supposed to make it loop so many times, but I fail to see whats random about it.

The issue is in the
Set Variable Random
piece.

EDIT: After more trials... its still bugging up.
I put in a trigger to make the game immediately tell me what every random roll's outcome is, and the first number always turns out to be the same.

I put in another test trigger to manually randomize the number, and the outcomes are random each time. So I'm not sure why this is, but the game is absolutely determined to make the first roll always the same.

And it has nothing to do with the rest of the trigger. Just that first part REFUSES to randomize, or even give a different outcome.

EDIT 2: I made a 2nd integer variable to randomize parallel to the first variable, and it also always comes out to the same number.

I made the first variable randomize during initialization, then again during base randomization... both times the outcome STILL was the same number.

SOLUTION: After several hours of gazing at my triggers, baffled at what could possibly be causing this. At long last, all that was left that I hadn't tried was turning off the map's starting cinematic mode. I did this... and finally the number outcomes were random. HOW THIS IS SO I HAVE NO IDEA, but cinematic mode seems to stop the randomization process.

Several tests have confirmed this.
Man I would have never guessed.

Last edited by ShadowHunter291; 11-21-2008 at 04:27 PM..
ShadowHunter291 is offline   Reply With Quote
Old 11-22-2008, 01:49 AM   #12 (permalink)
 
Big Dub's Avatar

AegisFang@USWest
 
Join Date: Aug 2007
Posts: 432

Big Dub has little to show at this moment (20)Big Dub has little to show at this moment (20)Big Dub has little to show at this moment (20)


Hmm, I never knew!
__________________
Please remember to give reputation peoples!
If you use my resources in a game give credits to AegisFang@USWest
Really Cool Stuff!
Get your Starcraft 2 resources here!
Big Dub is offline   Reply With Quote
Old 11-22-2008, 07:27 AM   #13 (permalink)

User
 
Join Date: Sep 2008
Posts: 5

HarblMan is an unknown quantity at this point (0)


I had a similar problem in my map. Figured Warcraft III has a really shitty seed method, so I added a trigger which generates random numbers and doesn't use them whenever players take certain actions (typing, selecting units, issuing orders, etc...) this way, I'll get a psuedo-random amount of rolls so when a trigger does anything with random numbers, it won't roll the same thing every time.

Not sure if that would work for you, but it solved an issue I had.
HarblMan is offline   Reply With Quote
Old 11-22-2008, 07:37 AM   #14 (permalink)
 
ShadowHunter291's Avatar

Revolution
 
Join Date: Jul 2008
Posts: 82

ShadowHunter291 has little to show at this moment (3)


Quote:
Originally Posted by HarblMan View Post
I had a similar problem in my map. Figured Warcraft III has a really shitty seed method, so I added a trigger which generates random numbers and doesn't use them whenever players take certain actions (typing, selecting units, issuing orders, etc...) this way, I'll get a psuedo-random amount of rolls so when a trigger does anything with random numbers, it won't roll the same thing every time.

Not sure if that would work for you, but it solved an issue I had.
It wouldn't work because the bases are given out right before players can do anything. I had thought about it though.
ShadowHunter291 is offline   Reply With Quote
Old 11-22-2008, 07:48 AM   #15 (permalink)

User
 
Join Date: Sep 2008
Posts: 5

HarblMan is an unknown quantity at this point (0)


You could make something based on several factors like the number of players in the game, the lengths of their names, the position in the alphabet of each letter in their names, etc, etc, etc...

Just find as much variable data as you can and use it to generate variable amounts of junk random numbers.

Could work, yes? :S
HarblMan is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] random integer number (detecting that number) jooster World Editor Help Zone 4 11-08-2008 09:18 PM
Random Number of units Mun'ki World Editor Help Zone 3 03-14-2007 04:48 PM
[JASS] random number problem... map-maker Triggers & Scripts 5 12-18-2005 08:01 AM
WC3's Random Number Generator IHATEHIPPIES Map Development 13 10-21-2005 01:35 AM
Maths - Random Number doesn't work! AtleriK Map Development 3 09-18-2004 08:48 PM

All times are GMT. The time now is 05:28 AM.






Your link here 
Remortgages | Guitar Lessons | Debt Consolidation | Novela historica | Pacotes Reveillon Salvador
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle