Help with random heros.

tbjl2006

New Member
Reaction score
5
I'm making Rpg and at the beginning you control i wisp like usual but you can step on a circle of power and choose your hero or you can step on a circle and get 1 of the four heros at random. Am i going to have to do this with Jass or is it impossible? Thanks in advance.
 

InfectedWithDrew

I used to go here a lot.
Reaction score
95
o_O

You create an integer variable. When a unit steps on the circle, you set it equal to a random integer between 1 and four. If it is 1, you get the hero that you decide is first. If it is 2, then you get the second hero, etc.
 

tbjl2006

New Member
Reaction score
5
and how do you do that im a little new at TFT

Edit: Found variables and made a integer var. But what should it value be and I don't know how to do the rest. I feel a little dumb.
 
S

Sunny_D

Guest
that would be a trigger like that: (create the integer variable as no array)

Code:
Trigger Unit steps on CircleOfPower that chooses a random hero
    Events
        Unit - A unit comes within 256.00 of "CircleRandom"
    Conditions
    Actions
[COLOR="Blue"]        ---- setting the integer variable to [B]math - random number[/B] ----[/COLOR]
        Set MyIntegerVariable = (Random integer number between 1 and 4)
[COLOR="Blue"]        ---- the first if-then-else is running when the random number was 1 ----[/COLOR]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [COLOR="Blue"]---- this is an integer comparison ----[/COLOR]
                MyIntegerVariable Equal to 1
            Then - Actions
                Unit - Create 1 "MyFirstHero" for (Owner of (Triggering unit)) at (Region) facing Default building facing (270.0) degrees
            Else - Actions
[COLOR="Blue"]        ---- the second if-then-else is running when the random number was 2 ----[/COLOR]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                MyIntegerVariable Equal to 1
            Then - Actions
                Unit - Create 1 "MySecondHero" for (Owner of (Triggering unit)) at (Region) facing Default building facing (270.0) degrees
            Else - Actions
[COLOR="Blue"]        ---- etc ... one for each random hero with the corresponding integer value ----[/COLOR]
 

Tom Jones

N/A
Reaction score
437
Another way of doing it:
Code:
Actions
    Set uid[1] = Paladin
    Set uid[2] = Archmage
    Set uid[3] = Mountain King
    Set uid[4] = Blood Mage
    Unit - Create 1 uid[(Random integer number between 1 and 4)] for *Some Player at *Somewhere* facing *Something* degrees
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top