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: 190

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: 199

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: 187

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: 193

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: 194
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top