Creating random integers, how?

MissKerrigan

Active Member
Reaction score
23
Hello,

I want to pick 2 random integers between 1-9 but it may NOT be the same
Later in game I also wanna pick 3 random integers, also not the same ones

Anyone can help me? :)

MissKerrigan
 

X-maul

AKA: Demtrod
Reaction score
201
Used the search in the editor; if your search random, there will be a function named Random Integer, and then you just use that, it wont be the same, unless you save it in a variable, and refer to that variable when you need the old random again.
 

Phubar

Ultra Cool Member
Reaction score
30
At the start set in another trigger
Set "First number"= 0
Set "Second number"= 0
Set "Trhird number"= 0

Then when you want a number run this trigger

Code:
Repeat (actions) forever
      Set "Chosen number"= Random integer between 1 to 9
    If
      Or
        "Chosen Number"= "First Number"
        "Chosen Number"= "Second Number"
        "Chosen Number"= "Thrird Number"
      Then *do nothing*
      Else
           If "First number"= 0
                then
                        Set "Chosen number"= "First number"
                else
                         if "second number"= 0
                             then Set "Chosen number"= "Second number"
                             else Set "Chosen number"= "Third number"
        Interrupt repeat
 

MissKerrigan

Active Member
Reaction score
23
In my case the variable is the type behavior with the array of 9 (9 different behaviors)

WHAT would happen if I just create 3 random behaviors on a single unit? would it be possible that the unit gets 2 of the same? because it would NOT be random then
 

Phubar

Ultra Cool Member
Reaction score
30
Just set the behavior as "yourvariable"[First number] or "yourvariable"[Second number] or"yourvariable"[Third number].

No, if you use that trigger it wont happen.
 

MissKerrigan

Active Member
Reaction score
23
Sorry I'm not understanding this, but it's cool

I already found some work-arround option:

- If I want 1 behavior on the unit I add 1 integer between 1-9
- If I want 2 behaviors on a unit I add 1 integer between 1-5 AND an integer between 6-9
- Finally, if I want 3 behaviors I add an integer between 1-3, one between 4-6 and at last one between 7-9

It works now, but the only slightly problem is that certain behaviors wont combo on units

well..... I can live with that
 
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