random not unique

exge

New Member
Reaction score
15
for some reason this trigger doesnt give me uinque random heroes...

Code:
hero arr
    Events
        Map initialization
    Conditions
    Actions
        Set hero[1] = Shaman
        Set hero[2] = Lich
        Set hero[3] = Shadow Priest
        Set hero[4] = Teeveseth
        Set hero[5] = Hydromancer
        Set hero[6] = Fire Revenant
        Set hero[7] = Night Assasin
        Set random_count = 7
        For each (Integer A) from 1 to 7, do (Actions)
            Loop - Actions
                Set random_data[(Integer A)] = (Integer A)

Code:
random
    Events
        Player - Player 2 (Blue) types a chat message containing -random as An exact match
    Conditions
    Actions
        Set random_data[random_hero] = random_count
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                random_count Greater than or equal to 1
            Then - Actions
                Set random_hero = (Random integer number between 1 and random_count)
                Unit - Create 1 hero[random_data[random_hero]] for (Triggering player) at ((Triggering player) start location) facing Default building facing (270.0) degrees
                Game - Display to (All enemies of (Triggering player)) the text: (playername[(Player number of (Triggering player))] + ( has randomed  + (Proper name of (Last created unit))))
                Set random_count = (random_count - 1)
                Player Group - Pick every player in (All players) and do (Actions)
                    Loop - Actions
                        Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
            Else - Actions
 
D

deathtomato

Guest
What you mean doesnt give u unique trigger?? Wat does it do....


I'd try makin it simpler

Code:
hero ar
    Events
        Map initialization
    Conditions
    Actions
        Set hero[1] = Shaman
        Set hero[2] = Lich
        Set hero[3] = Shadow Priest
        Set hero[4] = Teeveseth
        Set hero[5] = Hydromancer
        Set hero[6] = Fire Revenant
        Set hero[7] = Night Assasin

Code:
random
    Events
        Player - Player 2 (Blue) types a chat message containing -random as An exact match
    Conditions
    Actions
       Unit - Create 1 hero[random number between 1 and 7] for (Triggering player) at ((Triggering player) start location) facing Default building facing (270.0) degrees
             Player Group - Pick every player in (All players) and do (Actions)
                    Loop - Actions
                        Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
            Else - Actions
Couple more things need adding ofcourse ^^
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
exge said:
for some reason this trigger doesnt give me uinque random heroes...

Code:
random
    Events
        Player - [B]Player 2 (Blue)[/B] types a chat message containing -random as An exact match
    Conditions
    Actions
        Set random_data[random_hero] = random_count
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                random_count Greater than or equal to 1
            Then - Actions
                Set random_hero = (Random integer number between 1 and random_count)
                Unit - Create 1 hero[random_data[random_hero]] for (Triggering player) at ((Triggering player) start location) facing Default building facing (270.0) degrees
                Game - Display to (All enemies of (Triggering player)) the text: (playername[(Player number of (Triggering player))] + ( has randomed  + (Proper name of (Last created unit))))
                Set random_count = (random_count - 1)
                Player Group - Pick every player in (All players) and do (Actions)
                    Loop - Actions
                        Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
            Else - Actions

Player 2?
 

exge

New Member
Reaction score
15
yes, me when i test it .. i get heroes fine ... but they somtimes repeat ... and theres the problem cos none of my spells are mui

@Deathtomato > Your version doessnt fix the problem... i need a hero to be taken out of a array when it is randomed ....
 
M

Maximus

Guest
I've ever tasted that. Don't try it at World Edit or the result will be the same.
 

exge

New Member
Reaction score
15
@Maximus using world edit is ok, cos i disabled the fixed random seed ... but i still get repeat heroes !! :banghead: :banghead: :banghead:
 
M

Maximus

Guest
Testing Map at World Editor will give same result. If you play it through other (as long as it isn't Test Map at World Editor) it will work. Trust me.
 

Anything.

New Member
Reaction score
69
Maximus said:
Testing Map at World Editor will give same result. If you play it through other (as long as it isn't Test Map at World Editor) it will work. Trust me.
Naaah. Not if he disables the seeds ;)
 

exge

New Member
Reaction score
15
yes.. i disabled the fixed random seed ... but im still getting repeats .... :banghead:
 

exge

New Member
Reaction score
15
its okay .. im not scolding you ... :p well i did try it out .. heck i even tried it out on bnet with a few friends ... still didnt work ...
 
M

Maximus

Guest
sorry, then. :D
but I just think this is easier:
set Hero[1] = ...
set Hero[2] = ...
set Hero[3] = ...

Then:

For Each player who plays
set Random_Integer = Random integer between 1 - ...
Create 1 Hero[Random_Integer] for (picked player) at TempPoint facing Default...

sorry of anything wrong again :p .
 

exge

New Member
Reaction score
15
it doesnt work, like i said i need it such that Player X selects a hero by random, that hero cant and never will be able to be randomed by any other player
and no .. i dont mean .. disable training/construciton of the unit... cos that will only make it unalbe to buy that unit ...
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
exge said:
Code:
hero arr
    Events
        Map initialization
    Conditions
    Actions
        Set hero[1] = Shaman
        Set hero[2] = Lich
        Set hero[3] = Shadow Priest
        Set hero[4] = Teeveseth
        Set hero[5] = Hydromancer
        Set hero[6] = Fire Revenant
        Set hero[7] = Night Assasin
        Set random_count = 7
        For each (Integer A) from 1 to 7, do (Actions)
            Loop - Actions
                Set random_data[(Integer A)] = (Integer A)

Code:
random
    Events
        Player - Player 2 (Blue) types a chat message containing -random as An exact match
    Conditions
    Actions
        Set random_data[random_hero] = random_count
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                random_count Greater than or equal to 1
            Then - Actions
                Set random_hero = (Random integer number between 1 and random_count)
                Unit - Create 1 hero[random_data[random_hero]] for (Triggering player) at ((Triggering player) start location) facing Default building facing (270.0) degrees
                Game - Display to (All enemies of (Triggering player)) the text: (playername[(Player number of (Triggering player))] + ( has randomed  + (Proper name of (Last created unit))))
                Set random_count = (random_count - 1)
                Player Group - Pick every player in (All players) and do (Actions)
                    Loop - Actions
                        Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
            Else - Actions

I've seen these triggers before... I think phyrex1an posted them. Would you mind posting the original post?
 

exge

New Member
Reaction score
15
its ok .. i fixed it ... ok heres the solution ... its really stupid

change map initialization to time elapsed 1 sec ... :banghead: :banghead: :banghead:
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
exge said:
its ok .. i fixed it ... ok heres the solution ... its really stupid

change map initialization to time elapsed 1 sec ... :banghead: :banghead: :banghead:

Lol :p

Not your fault, I probably would've done the same thing, except for the fact that I almost never use map initialization. You can use time elapsed 0.00 seconds too though.. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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