Random problem

Jeroen

New Member
Reaction score
0
Random problem (Complete)

most random triggers is bast on a hero that can be picked forever
but what if you can pick only 1 hero from that class?

oké i got 3 triggers
all 3 triggers can be random picked
Code:
Pick hero priester (enabled) <gen>
Pick hero paladin (enabled) <gen>
Pick hero warlock (enabled) <gen>
if i pick a hero then 2 triggers remain for random
Code:
Pick hero priester (enabled) <gen>
Pick hero paladin (disabled) <gen>
Pick hero warlock (enabled) <gen>
so now only 2 triggers can be random picked
can some one help me make this :shades:
Btw 3 players
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
explain more......plz
I don't understand what is a random trigger
 

Jeroen

New Member
Reaction score
0
This "Pick hero priester (enabled)" is a map for a trigger
this is whats in side this trigger

Trigger:
  • Pick hero priester
    • Events
    • unit - A unit enters priester &lt;gen&gt;
    • Conditions
    • (Unit-type of (Entering unit)) Equal to Shade
    • Actions
    • Unit - Remove (Entering unit) from the game
    • Unit - Create 1 priester for (Owner of (Triggering unit)) at (Player 7 (Green) start location) facing Default building facing degrees
    • Set Player01 = (Last created unit)
    • Trigger - Turn off (This trigger)


so if a unit enters then this trigger wel be turned OFF Hero is Picked can't pick this hero!@ "Pick hero priester (disabled) <gen>"

& now if a other player walks in the random trigger
the random trigger have to pick a trigger thats NOT disabled!!
so i tink like this?
Trigger:
  • Random hero pick
    • Events
    • unit - A unit enters Random hero &lt;gen&gt;
    • Conditions
    • (Unit-type of (Entering unit)) Equal to Shade
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Action)
    • If - Conditions
    • chack all trigger that is enabled
    • and put it is Random_hero
    • Then - Action
    • wel this turns on that trigger a random_hero
    • Else - Action
 

Happy

Well-Known Member
Reaction score
71
if i get it right you want a circle or something like that where the players can walk in and get a random hero but none of the already picked...i hope its right.

then just add an if/then/else with (boolean variable) "if priest_boolean is false then do nothing else create ..."

this way round you have to set the variable for every unit you can choose to false if its chosen and the trigger checks if it can be chosen or not.


hope it helps...

greetz happy
 

Jeroen

New Member
Reaction score
0
if i get it right you want a circle or something like that where the players can walk in and get a random hero but none of the already picked...i hope its right.

then just add an if/then/else with (boolean variable) "if priest_boolean is false then do nothing else create ..."

this way round you have to set the variable for every unit you can choose to false if its chosen and the trigger checks if it can be chosen or not.


hope it helps...

greetz happy

wel this is for 1 trigger...
but i have 3 trigger how do you put it in there?
plz use the:
Trigger:
  • [ /WC3] system...
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_3">
    • <li class="lastopen"><span class="default">Random hero pick</span>
    • <ul>
    • <li class="tree"><span class="events">Events</span></li>
    • <li class="tree"><span class="unit">unit - A unit enters Random hero &amp;lt;gen&amp;gt;</span></li>
    • <li class="tree"><span class="conditions">Conditions</span></li>
    • <li class="tree"><span class="default">(Unit-type of (Entering unit)) Equal to Shade</span></li>
    • <li class="tree"><span class="actions">Actions</span></li>
    • <li class="lasttree"><span class="default">.....</span></li>
    • </ul>
    • </li>
    • </ul>
    • </div></div>
 

Dyslexia://

New Member
Reaction score
13
Demo Map

I've created a demo map that does:

-Only allows one hero for anyone to get [Example if someone gets a Paladin, that's the only Paladin in the game. Ever.]
- Has a Random function that makes a Unique hero that no one has. If none are present it does nothing.
- Also tracks dead heroes, won't allow you to choose dead ones. You can't random them.

Demo Map Instructions:
- Buy a Hero, and he's gone from the list of heroes you can buy for everyone.
- Type -random for a random hero, he will disappear from the list of heroes you can buy for everyone.
- Type -kill to randomly kill one selected unit [make sure you aren't clicking on the Tavern or the Circle of Power :p]
 

Attachments

  • Dyslexia Test Map.w3x
    22.7 KB · Views: 193

Jeroen

New Member
Reaction score
0
I've created a demo map that does:

-Only allows one hero for anyone to get [Example if someone gets a Paladin, that's the only Paladin in the game. Ever.]
- Has a Random function that makes a Unique hero that no one has. If none are present it does nothing.
- Also tracks dead heroes, won't allow you to choose dead ones. You can't random them.

Demo Map Instructions:
- Buy a Hero, and he's gone from the list of heroes you can buy for everyone.
- Type -random for a random hero, he will disappear from the list of heroes you can buy for everyone.
- Type -kill to randomly kill one selected unit [make sure you aren't clicking on the Tavern or the Circle of Power :p]

wel that is what i seek but not in a Tavern
plz convert it to triggers i have already tryd some test but i can't get it to work good it crad's the game... plz take a look
 

Attachments

  • Random, Repick TesT Map.w3x
    21.9 KB · Views: 200

Jeroen

New Member
Reaction score
0
or you need to fix your map because if i tpye: -random
then this wil go in action:
Trigger:
  • Random hero
    • Events
      • Player - Player 1 (Red) types a chat message containging -random as An exact match
      • Player - Player 2 (Red) types a chat message containging -random as An exact match
    • Conditions
    • Actions
      • Set Rand_Num = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units of type Dyslexia)) Equal to 0
        • Then - Actions
          • Unit - Create 1 Dyslexia for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
          • Player Group - Pink every player in (All players) and do (Action)
            • Loop - Actions
              • Player - Limit training of Dyslexia to 0 for (Picked player)
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Do nothing
      • If -
        • ... and 2 more functions

but if (Red) type: -random
i get hero Dyslexia then Player - Limit training of Dyslexia to 0 for (Picked player)
oké hero picked!
but if (Blue) type: -random
and the: Set Rand_Num = (Random integer number between 1 and 3)
is 1 then here is your problem..
Blue does not get his hero... and why? because of this:
Trigger:
  • Random hero
    • Events
      • Player - Player 1 (Red) types a chat message containging -random as An exact match
      • Player - Player 2 (Red) types a chat message containging -random as An exact match
    • Conditions
    • Actions
      • Set Rand_Num = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units of type Dyslexia)) Equal to 0
        • Then - Actions
          • Unit - Create 1 Dyslexia for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
          • Player Group - Pink every player in (All players) and do (Action)
            • Loop - Actions
              • Player - Limit training of Dyslexia to 0 for (Picked player)
            • Else - Actions
              • Do nothing
        • Else - Actions
          • ////////////////////////////////////////////////////////////////////////////////////////////////////
          • ////// HERE NEED TO COME A FUNCTION THAT SET A NEW NUMBER IN THE INTEGER //////
          • ///////////// and pick a new random hero! and not this one... already picked! //////////////
          • ////////////////////////////////////////////////////////////////////////////////////////////////////
      • If -
        • ... and 2 more functions

Good luck!
 

kaboo

New Member
Reaction score
45
hero picking through entering region + random (no same heroes)

firstly i'd like to say that its very ineffective since you have to create new trigger for every single hero, but ok, here it is

Trigger:
  • map init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set random_count = 9
      • Set pick[1] = pick 1 &lt;gen&gt;
      • Set pick[2] = pick 2 &lt;gen&gt;
      • Set pick[3] = pick 3 &lt;gen&gt;
      • Set pick[4] = pick 4 &lt;gen&gt;
      • Set pick[5] = pick 5 &lt;gen&gt;
      • Set pick[6] = pick 6 &lt;gen&gt;
      • Set pick[7] = pick 7 &lt;gen&gt;
      • Set pick[8] = pick 8 &lt;gen&gt;
      • Set pick[9] = pick 9 &lt;gen&gt;
      • //you have to store all pick triggers into a trigger array variable
      • For each (Integer A) from 1 to random_count, do (Actions)
        • Loop - Actions
          • Set random_data[(Integer A)] = (Integer A)


Trigger:
  • pick 1
    • Events
      • Unit - A unit enters pick 1 region
    • Conditions
    • Actions
      • Unit - Create 1 hero 1 for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit - Remove (Triggering unit) from the game
      • Set random_data[1] = random_count
      • Set random_count = (random_count - 1)


Trigger:
  • pick 2
    • Events
      • Unit - A unit enters pick 2 region
    • Conditions
    • Actions
      • Unit - Create 1 hero 2 for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit - Remove (Triggering unit) from the game
      • Set random_data[2] = random_count
      • Set random_count = (random_count - 1)


the same with other pick triggers

Trigger:
  • random
    • Events
      • Unit - A unit enters random pick region
    • Conditions
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Set random_trigger = (Random integer number between 1 and random_count)
      • Trigger - Run pick[random_data[random_trigger]] (ignoring conditions)
      • Set random_data[random_trigger] = random_count
      • Set random_count = (random_count - 1)


copied from world-editor-tutorial, just changed it to triggers
 

Jeroen

New Member
Reaction score
0
does not work good
if i pick the 3 heros and enter the random <gen> in again
i get more heros...
and how to make the repick?
here have a look for your self!
 

Attachments

  • Random, Repick TesT Map2.w3x
    22 KB · Views: 188

kaboo

New Member
Reaction score
45
replace all these lines
Trigger:
  • Set Random_Count = (Random_Count - 1)

with this
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Random_Count Equal to 0
    • Then - Actions
      • Do nothing
    • Else - Actions
      • Set Random_Count = (Random_Count - 1)

and i dont know why, but there is a flaw in the randoming


edit: random flaw solved too
just replace all these
Trigger:
  • Set Random_Data[X] = Random_Count

with this
Trigger:
  • Set Random_Data[X] = Random_Data[Random_Count]
 

HydraRancher

Truth begins in lies
Reaction score
197
>and i dont know why, but there is a flaw in the randoming

Click File > Preferences. In one of the tabs, untick "Fixed Random Seed"

Are you talking about that?
 

kaboo

New Member
Reaction score
45
>and i dont know why, but there is a flaw in the randoming

Click File > Preferences. In one of the tabs, untick "Fixed Random Seed"

Are you talking about that?
nope,
when it randomed #2 and after that #1 the 3rd random was not #3 as it should be, but #2 again
and this means, that random used here is not correct, someone should fix it


@Jeroen
everyone will control only one hero or more?
 

Jeroen

New Member
Reaction score
0
i tried so what everything i can't get it to work. like i sayed before i am Not Intelligence enough for this

some pls! open this map and edited it with the good triggers
and host this for there i can take over Thank you.
Code:
Commands in this map:
-repick
lol
 

Attachments

  • Random, Repick TesT Map4.w3x
    28.4 KB · Views: 195

Anachron

New Member
Reaction score
53
You should use pool.
JASS:
globals
    private intpool ip = intpool.create()
endglobals

function Example takes nothing returns nothing
    call ip.addInt(&#039;HEROID1&#039;, 1.0) //Adds 1 as an integer entry with weight 1.0
    call ip.addInt(&#039;HEROID2&#039;, 1.0) //Adds 2 as an integer entry with weight 1.0
endfunction

function Random takes nothing returns integer
    local integer rand = ip.getRandomInt()
    call ip.removeInt(rand)   //Removes the random entry
    return rand
endfunction
 

kaboo

New Member
Reaction score
45
only one hero
then you dont need to test, what will happen if there will be more peasants than heroes :)


and heres the map with working random
 

Attachments

  • Random, Repick TesT Map3.w3x
    21.7 KB · Views: 195
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