Random Pick problem

-Brainiac-

New Member
Reaction score
7
Hi there, my random hero pick trigger works fine just that I spawn all random heroes to One point ( And since I have two teams with heroes I want them to spawn on two different locations.. For my random hero pick trigger I followed a Tut by Ryoko: http://world-editor-tutorials.thehelper.net/herotavern.php )

So far i'm not an expert on making triggers but I had the idea to dublicate the if then else trigger with a condition that the players are an ally of player 1 and 5 (1/4 team 1 5/8 team 2)

Trigger:
  • Random Hero Pick
    • 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
      • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
      • Game - Display to (All players) the text: Hello ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: Hello ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
          • Set Random_Hero = (Random integer number between 1 and Random_Count)
          • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Triggering player) at (Center of Heroes North &lt;gen&gt;) facing Default building facing degrees
          • Game - Display to (All players) the text: (A player has randomed + (Name of (Last created unit)))
          • Selection - Select (Last created unit) for (Triggering player)
          • Player - Add -425 to (Triggering player) Current gold
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
          • Set Random_Data[Random_Hero] = Random_Count
          • Set Random_Count = (Random_Count - 1)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)


That's it, don't know if my idea fits here. If not someone with a suggestion?

Regards
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Just simply add an "If" inside the "If" XD

Like:
Trigger:
  • Random Hero Pick
    • 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
      • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
      • Game - Display to (All players) the text: Hello ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: Hello ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
          • Set Random_Hero = (Random integer number between 1 and Random_Count)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering player) is an ally of (Player 1 (Red))) Equal to True
            • Then - Actions
              • Set TempPoint = (Center of Heroes North &lt;gen&gt;)
              • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Triggering player) at TempPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
              • Set TempPoint = (Center of Heroes South &lt;gen&gt;)
              • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Triggering player) at TempPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
          • Game - Display to (All players) the text: (A player has randomed + (Name of (Last created unit)))
          • Selection - Select (Last created unit) for (Triggering player)
          • Player - Add -425 to (Triggering player) Current gold
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
          • Set Random_Data[Random_Hero] = Random_Count
          • Set Random_Count = (Random_Count - 1)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)


Note: Freehanded ;) And also, your trigger leaked a point:)
Code:
Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Triggering player) at [COLOR="Red"](Center of Heroes North <gen>)[/COLOR] facing Default building facing degrees

:p
 

-Brainiac-

New Member
Reaction score
7
Just simply add an "If" inside the "If" XD

Note: Freehanded ;) And also, your trigger leaked a point:)
Code:
Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Triggering player) at [COLOR="Red"](Center of Heroes North <gen>)[/COLOR] facing Default building facing degrees

:p

Thanks! Works now ^^

Oh yea, quick question here.
Added frostnova to human mage, but the mage refuses to use this spell... how come? (frostnova is a hero spell ? I have to set it to unit? or a different reason? (can't check it now...)

Regards
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, don't know, but maybe they won't use unit abilities ? :eek:
(Do you mean the AI, or can't you manually make him cast it ? :S)
 

-Brainiac-

New Member
Reaction score
7
The AI

(Don't have to make an AI script or something like that right?)

Oh btw, tomorrow I put it in Open Beta! :D

Tested it today with a friend of me, still has some minor buggs but tomorrow I'll share it with the world :D
 
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