RNG the same every game.

emootootoo

Top Banana
Reaction score
51
My random number generator is getting the exact same seed every game (using test map AND on Battle.net).

What's meant to happen is RANDOM units are supposed to spawn in RANDOM parts of different rects.
But no, units are spawning as the exact same units and in the exact same spots when it should be completely random at the start of each game.

I can guarentee I haven't seeded it at any point in my maps script, I checked by ctrl-fing the war3map.j.

If I do seed it some number, obviously the units get spawned differently, however there is no way that I know of to seed it a value based off real time in wc3.

Got a clue anyone?
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
This might help.
File -> Preferences -> Test Map tab -> Uncheck "Use Fixed Random Seed"

Also post your RNG so we can "spot" things that might need fixing.
 

emootootoo

Top Banana
Reaction score
51
I didn't think I'd have to post any code since it works if I seed the generator a different number every time.

Oh well, can I get this moved to jass help then?

(global block isn't there)
JASS:
    function SpawnUnit takes nothing returns nothing
        local integer i = 5
        local unit u
        loop
            exitwhen i < 0
            if GroupCountUnits(i) < zoneMax then
                set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),GetUnitTypeId(GroupPickRandomUnit(GetUnitsInRectAll(pokePit<i>))),GetRandomReal(GetRectMinX(spawnZones<i>),GetRectMaxX(spawnZones<i>)),GetRandomReal(GetRectMinY(spawnZones<i>),GetRectMaxY(spawnZones<i>)),GetRandomReal(1,360))
                call GroupAddUnit(spawnGroups<i>,u)
            endif
            set i = i - 1
        endloop
        set u = null
    endfunction

    function SpawnInitActions takes nothing returns nothing
        local integer i = 10
        local integer playerCount = 0
        loop
            exitwhen i &lt; 0
            if GetPlayerController(Player(i)) == MAP_CONTROL_USER then
                set playerCount = playerCount+1
            endif
            set i = i - 1
        endloop
        call SetSpawnInterval(playerCount)
        set i = zoneMax/2
        loop
            exitwhen i &lt;= 0
            call SpawnUnit()
            set i = i - 1
        endloop
    endfunction

    function InitTrig_Spawn_Unitz takes nothing returns nothing
        set gg_trg_Spawn_Unitz = CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_Spawn_Unitz,1.00)
        call TriggerAddAction(gg_trg_Spawn_Unitz,function SpawnInitActions)
    endfunction</i></i></i></i></i></i>
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top