Randomise trigger

wewso

New Member
Reaction score
11
This is a trigger, which should give each of 12 integers in one array a unique random number from 1 to 12. The problem is that it doesnt work propperly

Varaibles I use:
Random_Numbers - Integer Array
Random_Final - Integer Array
Temp_Integer - Integer

The init:

Code:
Init
    Events
        Map initialization
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Set Random_Numbers[(Integer A)] = (Integer A)



The bugged trigger:

Code:
Randomize
    Events
        Player - Player 1 (Red) skips a cinematic sequence
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Set Temp_Integer = (Random integer number between 1 and (13 - (Integer A)))
                Set Random_Final[(Integer A)] = Random_Numbers[Temp_Integer]
                Set Random_Numbers[Temp_Integer] = (13 - (Integer A))
                Game - Display to (All players) the text: (String(Random_Final[(Integer A)]))

Thanks for hlp guys :thup:
 

UndeadDragon

Super Moderator
Reaction score
447
Why are you doing: (Random integer number between 1 and (13 - (Integer A))), why don't you just do a random number between 1 and 12?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Set Random_Numbers[Temp_Integer] = (13 - (Integer A))

You sure this shouldn't be:
Set Random_Numbers[Temp_Integer] = Random_Numbers[(13 - (Integer A))]


> The problem is that it doesn't work

"It doesn't work" is not a very good problem description.
 

wewso

New Member
Reaction score
11
oh now I see my mistake :thup: tnx ace

I wrote it in my bioligy class, but I haven t rewritten it correctly to the comp.
Actualy the lecture was about deseases like leprosy and plague and it was very good to think about stg else.
 
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