All random Trigger help

Craigimus

New Member
Reaction score
0
straight to business :p

29 heroes with possibility of having 30 heroes

player types -random

gives random hero between the 29 - 30

and doesnt let them -random again to get 2 heroes

one hero per player.



Also allrandom mode (after clicking a dialog button)

doing the same as above but without the -random bit


I've set all the heroes in an array
[1] ------ [29]

i just need the trigger to stop people getting the same heroes and repeating to get more then one hero.


Thanks in advance.
 

Samael88

Evil always finds a way
Reaction score
181
gives random hero between the 29 - 30

You would need to set the random number 1 to 29:confused: That is if you are current only getting the last unit
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
So the 30th hero is a hidden hero? Your wording is kinda confusing...
 

Craigimus

New Member
Reaction score
0
i hvae 29 heroes made but i might be making a 30th hero im undecided.

forget about the hero number i need help with the triggering xD lol
 

Craigimus

New Member
Reaction score
0
This is the triggers i tried but whenever i click the dialog to start the random hero game error's and closes.

Any ideas what is causing this ?


Code:
Events
    Map initialization
Conditions
Actions
    Set AllHeroes = 29
    Set HeroesLeft = 29
    Set RandomHero[1] = Dragon Knight
    Set RandomHero[2] = Jaina
    Set RandomHero[3] = Blood Mage
    Set RandomHero[4] = Larodar
    Set RandomHero[5] = Muradin Bronzebeard
    Set RandomHero[6] = Sylvanas Windrunner
    Set RandomHero[7] = Blademaster
    Set RandomHero[8] = Far Seer
    Set RandomHero[9] = Tauren Chieftain
    Set RandomHero[10] = Shadow Hunter
    Set RandomHero[11] = Blademaster of Blackrock Clan
    Set RandomHero[12] = Tree
    Set RandomHero[13] = Lich
    Set RandomHero[14] = Dreadlord
    Set RandomHero[15] = Crypt Lord
    Set RandomHero[16] = Tichondrius
    Set RandomHero[17] = Sylvanas
    Set RandomHero[18] = Priestess of the Moon
    Set RandomHero[19] = Warden
    Set RandomHero[20] = Ghost
    Set RandomHero[21] = Illidan
    Set RandomHero[22] = Furion
    Set RandomHero[23] = Illidan (Evil)
    Set RandomHero[24] = Dark Ranger
    Set RandomHero[25] = Beastmaster
    Set RandomHero[26] = Pandaren Brewmaster
    Set RandomHero[27] = Pit Lord
    Set RandomHero[28] = Sith Lord
    Set RandomHero[29] = Tichondrius
     Do Multiple ActionsFor each (Integer A) from 1 to 29, do (Actions)
        Loop - Actions
            Set SingleHeroes[(Integer A)] = (Integer A)


Code:
Setting AllRandom
    Events
        Dialog - A dialog button is clicked for Setting_Dialog
    Conditions
        (Clicked dialog button) Equal to (==) Setting_AllRandom
    Actions
         Do Multiple ActionsFor each (Integer A) from 1 to 29, do (Actions)
            Loop - Actions
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) slot status) Equal to (==) Is playing
                        ((Player((Integer A))) controller) Equal to (==) User
                    Then - Actions
                        Set AllHeroes = (Random integer number between 1 and HeroesLeft)
                        Unit - Create 1 RandomHero[SingleHeroes[AllHeroes]] for (Player((Integer A))) at (Position of Icy Treasure Box 0033 <gen>) facing Default building facing (270.0) degrees
                        Set SingleHeroes[AllHeroes] = HeroesLeft
                        Set HeroesLeft = (HeroesLeft - 1)
                    Else - Actions




This one is if i used the command -random

im not sure what to put after taht one xD




Code:
Random Hero
    Events
        Player - Player 1 (Red) types a chat message containing -random as An exact match
        Player - Player 2 (Blue) types a chat message containing -random as An exact match
        Player - Player 3 (Teal) types a chat message containing -random as An exact match
        Player - Player 4 (Purple) types a chat message containing -random as An exact match
        Player - Player 5 (Yellow) types a chat message containing -random as An exact match
        Player - Player 6 (Orange) types a chat message containing -random as An exact match
        Player - Player 7 (Green) types a chat message containing -random as An exact match
        Player - Player 8 (Pink) types a chat message containing -random as An exact match
    Conditions
    Actions
 

emilemil1

New Member
Reaction score
20
ok i dont have editor available so i will try to make it simple without writing code :)

at initialization you put each unit in an array like you have done

then for the allrandom you repeat this for all players that are playing and that are not computers: (for each integer A from 1 to X do actions)

-----

set integer = random number between 1 and (number of heroes)

if (your hero array [integer] is equal to (chosen) then -randomize it again-

XXXrepeat this a couple of times (maybe 100 times) to make sure that nobody will get the same hero as someone elseXXX

create unit of type (your hero array [integer]) at (starting position) for player number of (integer A)

set (your hero array [integer]) = (chosen)

-----

then for the -random trigger you do exacly the same but without repeating it for every single player like you would do in a allrandom trigger

you will need a unit type that counts as a (chosen) unit so that one wont be picked again by the trigger. If you want to be really sure that the player got a hero you could do:

-----

set group = units owned by player [integer A] matching (matching unit is a hero equal to true)

if number of units in group is equal to 0 then do

set player = player with player number [integer A]

run (trigger that does exacly like a -random trigger but with (triggering player) replaced with [player]

call DestroyGroup (udg_group)

-----

Since i dont have a editor in front of me i cant test it sry :) but im pretty sure it works

EDIT: or you can make one of each hero type in a region owned by neutral passive and then make the trigger pick a unit in the region and create a unit of that type for the player, then remove that unit from the region

that would actually be alot easyer but you may not want to have a box of units on you map :) for the looks
 

Craigimus

New Member
Reaction score
0
Since i have a box where all the heroes i have are there i think using that last part would be good but i dont quite understand how to trigger it up xD

Setting AllRandom
Events
Dialog - A dialog button is clicked for Setting_Dialog
Conditions
(Clicked dialog button) Equal to (==) Setting_AllRandom
Actions


then what would it be ?


Random Hero
Events
Player - Player 1 (Red) types a chat message containing -random as An exact match
Player - Player 2 (Blue) types a chat message containing -random as An exact match
Player - Player 3 (Teal) types a chat message containing -random as An exact match
Player - Player 4 (Purple) types a chat message containing -random as An exact match
Player - Player 5 (Yellow) types a chat message containing -random as An exact match
Player - Player 6 (Orange) types a chat message containing -random as An exact match
Player - Player 7 (Green) types a chat message containing -random as An exact match
Player - Player 8 (Pink) types a chat message containing -random as An exact match
Conditions
Actions

And i need the trigger part for that one as well


and i need to cancel each trigger so each player can only use -random once and if they are choosing a hero tat they cant double click 2 heroes to recieve 2 heroes.
 

Craigimus

New Member
Reaction score
0
ok ive encountered another problem :S

i have a trigger set out to give random heroes from the region and remove them as well

but the heroes randomly given are the same hero each time :S
how do i change it so the heroes change each time. ? :S
 

13lade619

is now a game developer :)
Reaction score
399
when a user rolls a number already chosen, random again.
add the past rolls to some condition..

i.e.

last user had 5 as random.
next user also had 5, roll again until the rolled number is not 5.

so... if the 4th user..

random != x
random != y
random != z

x,y,z being the last randomed numbers.
 

Craigimus

New Member
Reaction score
0
nonono

each player recieves a different hero

but each time i restart the game i recieve the same hero like each player as the same hero as from the previous game.


Setting AllRandom
Events
Dialog - A dialog button is clicked for Setting_Dialog
Conditions
(Clicked dialog button) Equal to (==) Setting_AllRandom
Actions
Unit - Move (Random unit from (Units in Heros <gen>)) instantly to (Center of Red <gen>)


that trigger gives me the same hero each time i restart the map .....
 

dragonhord

Knowledge is true opinion. - Plato
Reaction score
82
In your triggers you can just set an array... I.E. an integer array... Lets say you call it RandomVar... Make sure it's an array. When you do -ar set your RandomVar[Player(Integer A)] = RandomVar[Player(Integer A)] + 1... Then in your random trigger just add a condition that says RandomVar[Player Number of Triggering Player] = 0... If I get what you mean... That way no one can -random... And in order to prevent people getting the same hero... I believe the DotA Template, even though it's old, features something of that nature... You could always check that out... And just so you know... When you are in world editor and you click "Test Map" anything that uses random integers will roll the same number no matter what... It's only on actual games that you get a random number... Which is probably why you get the same hero no matter what...
 

Craigimus

New Member
Reaction score
0
Ahhh okies so if i create local game with map it will be different each time xD

no wonder lols my bad =]
 

DrEvil

FCRI Associate!
Reaction score
111
Hey if you want a quick AR system why not check out mine ?

Easy to configure , Hero , If they are playing , where to spawn .

BTW - Its in jass , but its not that hard if you edit what you need to edit

All-Random System
 
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