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
 
explain more......plz
I don't understand what is a random trigger
 
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
 
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
 
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>
 
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: 194
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: 201
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!
 
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
 
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
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]
 
>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?
 
>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?
 
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: 196
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
 
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: 197
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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