Weird random number issue.

Grags_1977

Ultra Cool Member
Reaction score
32
Searchers. If you're having random number problems. 2 possible solutions.

A, File/Preferences/Test Map: Uncheck Fixed Random Seed.

B, Obviously a bug in the wc3 engine. Try Converting a random real to an integer.

Example: Set RandomNumber = (Integer((Random real number between 1.00 and 4.00)))




Original Message
This just stopped working out of nowhere and I have no idea why.


This part runs at Initialization.
Code:
        Set Region_HostileToDie[1] = HostileToDie01 <gen>
        Set Camera_HostileToDie[1] = HostileToDie01 <gen>
        Set Region_HostileToDie[2] = HostileToDie02 <gen>
        Set Camera_HostileToDie[2] = HostileToDie02 <gen>
        Set Region_HostileToDie[3] = HostileToDie03 <gen>
        Set Camera_HostileToDie[3] = HostileToDie03 <gen>
        Set Region_HostileToDie[4] = HostileToDie04 <gen>
        Set Camera_HostileToDie[4] = HostileToDie04 <gen>
        Set Unit_HostileToDies[1] = Bounty (Level 1)
        Set Unit_HostileToDies[2] = Bounty (Level 2)
        Set Unit_HostileToDies[3] = Bounty (Level 3)
        Set Unit_HostileToDies[4] = Bounty (Level 4)
        Set Unit_HostileToDies[5] = Bounty (Level 5)
        Set Unit_HostileToDies[6] = Bounty (Level 6)
        Set Unit_HostileToDies[7] = Bounty (Level 7)
        Set Unit_HostileToDies[8] = Bounty (Level 8)
        Set Unit_HostileToDies[9] = Bounty (Level 9)
        Set Unit_HostileToDies[10] = Bounty (Level 10)
        Set Unit_HostileToDie = No unit

This part runs when talking to a quest giver.
Code:
        Set Integer_RandomNumber = (Random integer number between 1 and 4)
        Set TempPoint[20] = (Center of Region_HostileToDie[Integer_RandomNumber])
        Unit - Create 1 Bounty (Level 1) for Neutral Hostile at TempPoint[20] facing Default building facing degrees
        Custom script:   call RemoveLocation( udg_TempPoint[20] )
        Set Unit_HostileToDie = (Last created unit)
        Camera - Apply Camera_HostileToDie[Integer_RandomNumber] for Player 1 (Red) over 5.00 seconds
        Wait 3.00 seconds
        Special Effect - Create a special effect attached to the overhead of Unit_HostileToDie using Abilities\Spells\Other\Aneu\AneuCaster.mdl
        Set SpecialEffect_HostileToDie = (Last created special effect)


For some reason the hostile unit is ALLWAYS placed at HostileToDie03. What am I missing?!?!


These are the full triggers

Trigger:
  • Variables
    • Events
    • Conditions
    • Actions
      • Set Real_InfernoAOE = 400.00
      • Set Real_FireBoltDamage = 6.00
      • Set Integer_SpinAttackMax = 2
      • Set Region_HostileToDie[1] = HostileToDie01 &lt;gen&gt;
      • Set Camera_HostileToDie[1] = HostileToDie01 &lt;gen&gt;
      • Set Region_HostileToDie[2] = HostileToDie02 &lt;gen&gt;
      • Set Camera_HostileToDie[2] = HostileToDie02 &lt;gen&gt;
      • Set Region_HostileToDie[3] = HostileToDie03 &lt;gen&gt;
      • Set Camera_HostileToDie[3] = HostileToDie03 &lt;gen&gt;
      • Set Region_HostileToDie[4] = HostileToDie04 &lt;gen&gt;
      • Set Camera_HostileToDie[4] = HostileToDie04 &lt;gen&gt;
      • Set Unit_HostileToDies[1] = Bounty (Level 1)
      • Set Unit_HostileToDies[2] = Bounty (Level 2)
      • Set Unit_HostileToDies[3] = Bounty (Level 3)
      • Set Unit_HostileToDies[4] = Bounty (Level 4)
      • Set Unit_HostileToDies[5] = Bounty (Level 5)
      • Set Unit_HostileToDies[6] = Bounty (Level 6)
      • Set Unit_HostileToDies[7] = Bounty (Level 7)
      • Set Unit_HostileToDies[8] = Bounty (Level 8)
      • Set Unit_HostileToDies[9] = Bounty (Level 9)
      • Set Unit_HostileToDies[10] = Bounty (Level 10)
      • Set Unit_HostileToDie = No unit
      • Set TempUnitGroup[1] = (Units of type Bob)
      • Set Unit_Hero = (Random unit from TempUnitGroup[1])
      • Custom script: call DestroyGroup ( udg_TempUnitGroup[1] )
      • Trigger - Add to Death Bring Reset Cam and Movement &lt;gen&gt; the event (Unit - Unit_Hero Takes damage)
      • Trigger - Add to In range &lt;gen&gt; the event (Unit - A unit comes within 1800.00 of Unit_Hero)
      • Hero - Modify unspent skill points of Unit_Hero: Subtract 1 points
      • Set Sound_SpinAttack[1] = SpinAttackHit1 &lt;gen&gt;
      • Set Sound_SpinAttack[2] = SpinAttackHit2 &lt;gen&gt;
      • Set Sound_SpinAttack[3] = SpinAttackHit3 &lt;gen&gt;
      • Set Integer_GoldRewardCaptain = 200
      • Set Sound_Music = Music_Human &lt;gen&gt;

Trigger:
  • Captain Back
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Talk
      • (Unit-type of (Selling unit)) Equal to Desert Guard Captain
      • ((Selling unit) belongs to an enemy of Player 1 (Red)) Equal to False
      • Unit_HostileToDie Equal to No unit
      • (Unit_Hero has an item of type Murlocs Head) Equal to False
    • Actions
      • Set Integer_HostileToDie = (Integer_HostileToDie + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_HostileToDie Greater than 10
        • Then - Actions
          • Set Integer_HostileToDie = 10
        • Else - Actions
      • Special Effect - Destroy SpecialEffect_QuestCaptain
      • Trigger - Turn off (This trigger)
      • Trigger - Run Cinematic Mode On &lt;gen&gt; (ignoring conditions)
      • Camera - Apply Captain 01 &lt;gen&gt; for Player 1 (Red) over 0.00 seconds
      • Camera - Apply Captain 02 &lt;gen&gt; for Player 1 (Red) over 3.00 seconds
      • Cinematic - Send transmission to (All players) from Unit_Talk named (Name of Unit_Talk): Play Voice_Captain_Back_01 &lt;gen&gt; and display Welcome back!. Modify duration: Add 0.00 seconds and Wait
      • Set Integer_RandomNumber = (Random integer number between 1 and 4)
      • Set TempPoint[20] = (Center of Region_HostileToDie[Integer_RandomNumber])
      • Unit - Create 1 Unit_HostileToDies[Integer_HostileToDie] for Neutral Hostile at TempPoint[20] facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_TempPoint[20] )
      • Set Unit_HostileToDie = (Last created unit)
      • Camera - Apply Camera_HostileToDie[Integer_RandomNumber] for Player 1 (Red) over 5.00 seconds
      • Wait 3.00 seconds
      • Special Effect - Create a special effect attached to the overhead of Unit_HostileToDie using Abilities\Spells\Other\Aneu\AneuCaster.mdl
      • Set SpecialEffect_HostileToDie = (Last created special effect)
      • Camera - Set Player 1 (Red)&#039;s camera Distance to target to 950.00 over 3.00 seconds
      • Cinematic - Send transmission to (All players) from Unit_Talk named (Name of Unit_Talk): Play Voice_Captain_Back_02 &lt;gen&gt; and display This guy is your ne.... Modify duration: Add 0.00 seconds and Wait
      • Cinematic - Send transmission to (All players) from Unit_Talk named (Name of Unit_Talk): Play Voice_Captain_Back_03 &lt;gen&gt; and display Bring me his head, .... Modify duration: Add 0.00 seconds and Wait
      • Neutral Building - Add Give Head to (Selling unit) with 1 in stock and a max stock of 1
      • Set TempPoint[21] = (Position of Unit_Hero)
      • Camera - Pan camera for Player 1 (Red) to TempPoint[21] over 0.00 seconds
      • Custom script: call RemoveLocation( udg_TempPoint[21] )
      • Trigger - Run Cinematic Mode Off &lt;gen&gt; (ignoring conditions)
      • Trigger - Turn on Captain Return Hostile Dead 02 &lt;gen&gt;
      • Trigger - Turn on Captain Return Hostile Alive &lt;gen&gt;
      • Special Effect - Create a special effect attached to the overhead of (Selling unit) using Objects\RandomObject\RandomObject.mdl
      • Set SpecialEffect_QuestCaptain = (Last created special effect)



EDIT: Hmmm why aint my spoiler tags working? It is [spoiler.][/spoiler.] right? (without the . of course)

EDIT2: Fixed random seed is unchecked btw.


EDIT3: So I went ahead and added this line.

Game - Display to (All players) the text: (String(Integer_RandomNumber))

And every time it displays 3wtf is going on?!?!

EDIT4: Going to uninstall and reinstall. I think my warcraft is bugged.

EDIT5: I like editing.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
sometimes individual actions on wc3 can be bugged, iv run into this before, i think the solution was to create a random real and convert it to an integer, but dont quote me on it : /
 

Grags_1977

Ultra Cool Member
Reaction score
32
I'm in the middle of reinstalling now. See if that helps.

EDIT: Reinstalling didn't work.

But
Set Integer_RandomNumber = (Integer((Random real number between 1.00 and 4.00)))

Worked. How !@?% stupid.

Gah, owe you a rep GFreak.
 
Reaction score
456
Well, first thing to do is not to reinstall.

I don't remember this quote by AceHart word to word, but it goes somewhat like this:
"When random fails to meet your expectations, it is random indeed."

If the Fixed Random Seed is truly unchecked, you could've tried to restart computer. Or maybe run the trigger it many times on same run, and see if it's always 3.

EDIT: It does not matter whether you use random integer/random real. Both work.
 

Grags_1977

Ultra Cool Member
Reaction score
32
Well, first thing to do is not to reinstall.

I don't remember this quote by AceHart word to word, but it goes somewhat like this:
"When random fails to meet your expectations, it is random indeed."

If the Fixed Random Seed is truly unchecked, you could've tried to restart computer. Or maybe run the trigger it many times on same run, and see if it's always 3.


Trust me. It was allways 3. I did a full test of my map and in my LONG list of things to fix, that was one of them. As the player needs to visit this guy 10 times to recieve one of the end game hidden power ups. And it was ALLWAYS the same spot. Thats 10 times in a row a 1 in 4 chance resulted in 3.

Furthermore. Once I tried to fix the problem. It was still 3 everytime. Perhaps a good 30 trys before I posted. And then I tried with the string conversion message a good 10 times before I edited it.

Once I converted it from a random real to an integer it worked. It's obviously a bug in the wc3 engine.


EDIT: Thanks for the reply nonetheless +rep. And with that +rep I managed to get 1 of the 90 gazillion reps I owe you GFreak.

EDIT2: I would like to add, that I have random integers all over the place that are working as they should. It's just this occasion it refused to. There is definately a rare bug somewhere in the wc3 engine that disallowed this to be random. As once I changed it from...

Set Integer_RandomNumber = (Random integer number between 1 and 4)

To

Set Integer_RandomNumber = (Integer((Random real number between 1.00 and 4.00)))

It worked fine. Law of averages argues a 1 in 4 chance can't be 3 everytime around 50 times. More chance of taking a dump in the queens handbag :p
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
thats more of a 1 in 10 :D where as 1 in 4 50 times in a row is 1 in 4^50, not even gonna do the math on that
 

Grags_1977

Ultra Cool Member
Reaction score
32
FFS! Now it's 2 everytime...

Balls to it, i'm just going to rotate the regions from 1 to 4. Instead of make it random. I cba with this bull...

EDIT:

Trigger:
  • Set Integer_RegionHostile = (Integer_RegionHostile + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Integer_RegionHostile Greater than 4
      • Then - Actions
        • Set Integer_RegionHostile = 1
      • Else - Actions


If this doesn't work, i'm throwing my pc at the wall.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
damn lol -.-

you could just try running another trigger and that trigger could have the action in it, and just use that to set your random numbers
 

Grags_1977

Ultra Cool Member
Reaction score
32
Rotating works. I'm just going to stick with that. It's not worth the stress lol

Meanwhile, if someone could shed some light on wtf is going on here, i'd be very happy to find out.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top