• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Anyone know a good tutorial for me?

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2009
Messages
108
Im looking for a neat tutorial on how to make a TOTALLY random hero selector. im using dialog and dialog btns. but i cnt seem to get a random one working. i try make Int_Var a "random" number between 1 and 24 then if certain number u get this hero. 1 thing... it always ends up on 19 :confused:

so what im asking does anyone know a good tutorial for random integers or something so i can get a RANDOM hero.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Your trigger has to look like this:

Note that RandomInteger is integer variable.

  • Random Hero
    • Events
      • -------- Events here --------
    • Conditions
      • -------- Conditions here --------
    • Actions
      • Set RandomInteger = (Random integer number between 1 and 24)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 1
        • Then - Actions
          • -------- Hero Creating Actions here (Create hero 1) --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 2
        • Then - Actions
          • -------- Hero Creating Actions here (Create hero 2) --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 3
        • Then - Actions
          • -------- Hero Creating Actions here (Create hero 3) --------
        • Else - Actions
      • -------- And so on... --------
''RandomInteger Equal to 1'' is located in ''Integer Comparison''
 
Level 31
Joined
Apr 17, 2009
Messages
3,572
It's not a mistake in the triggers, it's a problem of the editor.
When you test your map, the game always takes the same random number; in your case 19. But it will be right working in a game on battlenet or sumthing like that. I think you can change in the world editor somewhere at Advanced to not take always the same number. Maybe someone else knows.
 
Level 4
Joined
Apr 7, 2009
Messages
108
leme try.....
[(TRIGGER]TESTING PLZ WORK
Events
Conditions
Actions
[(/TRIGGER]

{EDIT}
  • TESTING PLZ WORK
    • Events
    • Conditions
    • Actions
 
Last edited by a moderator:
Level 16
Joined
Jul 21, 2008
Messages
1,121
In previous trigger, you are creating new If in else.


Instead of this;
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
    • Then - Actions
      • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomHero Equal to 23
        • Then - Actions
          • -------- And so on... --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 23
            • Then - Actions
              • -------- And so on... --------
It has to look like this:


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
    • Then - Actions
      • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
      • Then - Actions
        • -------- And so on... --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
      • Then - Actions
        • -------- And so on... --------
 
Level 4
Joined
Apr 7, 2009
Messages
108
now i cnt break 3 time rule. here goes long trigger
  • random generator
    • Events
      • Dialog - A dialog button is clicked for DialogAr
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Clicked dialog button) Equal to DialogBtnRandom
        • Then - Actions
          • Set RandomHero = (Random integer number between 1 and 24)
          • -------- If number is certain number then --------
          • -------- hero will spawn, but my problem is --------
          • -------- it is always 19. and you think --------
          • -------- that b.net will fix it??? --------
          • -------- how will i figure that out then.... --------
          • -------- guess ill learn the hard way :D --------
          • -------- and one last thing. --------
          • -------- how you create white button that hides/shows info --------
          • -------- (see following url) --------
          • -------- [url]http://www.hiveworkshop.com/forums/triggers-and-scripts-269/spell-review-template-131971/[/url] --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 1
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 2
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 3
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 4
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 5
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 6
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 7
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 8
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 9
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 10
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 11
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 12
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 13
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 14
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 15
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 16
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 17
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 18
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 19
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 20
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 21
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 22
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 23
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 24
            • Then - Actions
              • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
            • Else - Actions
        • Else - Actions
{EDIT}
all the paladins WILL be changed later on
 
Last edited by a moderator:
Level 3
Joined
Feb 18, 2005
Messages
50
In previous trigger, you are creating new If in else.


Instead of this;
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
    • Then - Actions
      • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomHero Equal to 23
        • Then - Actions
          • -------- And so on... --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomHero Equal to 23
            • Then - Actions
              • -------- And so on... --------
It has to look like this:


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
    • Then - Actions
      • Unit - Create 1 Paladin for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
      • Then - Actions
        • -------- And so on... --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RandomHero Equal to 23
      • Then - Actions
        • -------- And so on... --------


actually, good sir, they call it an "if-else" ladder. It's commonly used in programming languages like C++. The beauty of the if-else ladder is when a condition is actually found to be true, the rest of the ladder is ignored. I would imagine that would make an if-else ladder more efficient than a set of 24 if statements.

I mean, if you don't use the if-else ladder, the if-else system is only half as useful >.>

If you could clarify why you don't like if-else ladders, that would clear up some confusion on my end xD

EDIT:
all the paladins WILL be changed later on

from a quick look, your trigger looks like it works.
 
Level 4
Joined
Apr 7, 2009
Messages
108
well heres why i dnt like if-ladder, when you do if laddrer long enuf you start curving right and then you gotta start scrolling left and right and not just up and down
 
Level 3
Joined
Feb 18, 2005
Messages
50
haha, well that is a bit of an issue, but I was more of talking to Child_0f_Bodom because hea advised that you stay away from them.
 
Level 4
Joined
Apr 7, 2009
Messages
108
wana know wats "funner" then randoming a hero.... making a hero kill hero, hero deaths, and hero kills units multiboard for 12 players......well over 500 actions :D

{EDIT}
Current Mission:
Invitable Massacre-
Terrain: complete
Units: 5%
Triggers & Misc: 25%

(please tell me if game sounds like a game u'd want to try if you see it)
 
Last edited by a moderator:
Level 3
Joined
Feb 18, 2005
Messages
50
2 things:
1 - Please start using the "edit" function when you have something else to add to your post.
2 - I would have to see the game to see if i was interested xD
 
Level 4
Joined
Apr 7, 2009
Messages
108
i mean say ur bored and ur in lookin around at custom games and you come across one named "Inevitable Massacre". does that game "attract" you? or is it a boring or stupid name?

{EDIT}
also i got another problem here too on defeat conditions.
  • Defeat Test
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Tier 0
          • (Unit-type of (Dying unit)) Equal to Human Tier 1
          • (Unit-type of (Dying unit)) Equal to Human Tier 2
          • (Unit-type of (Dying unit)) Equal to Human Tier 3
          • (Unit-type of (Dying unit)) Equal to Human Tier 4
          • (Unit-type of (Dying unit)) Equal to Human Tier 5
          • (Unit-type of (Dying unit)) Equal to Human Tier 6
          • (Unit-type of (Dying unit)) Equal to Orc Tier 1
          • (Unit-type of (Dying unit)) Equal to Orc Tier 2
          • (Unit-type of (Dying unit)) Equal to Orc Tier 3
          • (Unit-type of (Dying unit)) Equal to Orc Tier 4
          • (Unit-type of (Dying unit)) Equal to Orc Tier 5
          • (Unit-type of (Dying unit)) Equal to Orc Tier 6
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit))) and do (Actions)
            • Loop - Actions
              • Unit - Kill (Picked unit)
          • Dialog - Change the title of DialogDefeat to (You + ((Name of (Owner of (Dying unit))) + , are defeated.))
          • Dialog - Create a dialog button for DialogDefeat labelled Leave
          • Set DialogBtnLeave = (Last created dialog Button)
          • Dialog - Create a dialog button for DialogDefeat labelled Continue
          • Set DialogBtnContinue = (Last created dialog Button)
          • Dialog - Show DialogDefeat for (Owner of (Dying unit))
        • Else - Actions
 
Last edited by a moderator:
  • Angry
Reactions: Rui
Level 7
Joined
Mar 13, 2008
Messages
228
well before I say anythign else use the fucking EDIT button, you have already double posted like 6 times in this thread.


and when your creating a condition scroll down to the Or multiple, and put all the conditiond in there.
and you leak in pick every unit
 
Status
Not open for further replies.
Top