• 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.

[Trigger] Advanced hero selection system

Status
Not open for further replies.
Level 4
Joined
Oct 28, 2007
Messages
72
I was playing with array and just have idea to make AHSS all is working but;
let 1st you see how create regions and i use region array and set only reg 1-3 not 0000 one i used oooo only to activate trigger...

So i start my peasant is ready and i pick hero trigger do his thing and my peasant die.When i create another one and send him to other or to same hero then start to be messy trigger create same hero +old one and etc....
Also if i dont kill peasant before integers loop trigger wont do nothing..!?
here it is trigger:
  • scriptV1
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Peasant
    • Actions
      • Unit - Kill (Entering unit)
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in RegioN[(Integer A)])) Equal to 2
            • Then - Actions
              • Unit - Change ownership of (Random unit from (Units in RegioN[(Integer A)] owned by Neutral Passive)) to (Owner of (Entering unit)) and Change color
            • Else - Actions
i try with unit group 1st to add bouth units then to kill peasant and to create
same unit as 2nd one is...so my question is can somone tell me where is my leak?cuz the tool Leak cheker isnt working ...sorry for bad english
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RegioN[1] = Region 001 <gen>
      • Set RegioN[2] = Region 002 <gen>
      • Set RegioN[3] = Region 003 <gen>
Recall peasant
  • regain peasant
    • Events
      • Player - Player 1 (Red) types a chat message containing start as An exact match
    • Conditions
    • Actions
      • Unit - Create 1 Peasant for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
(Units in RegioN[(Integer A)]) and (Units in RegioN[(Integer A)] owned by Neutral Passive) are a newly created unit group, so that are the leaks.
You can completely get rid of the first unit group by changing the condition to "(entering unit) is in regionN[(IntegerA)]", for the second you'll have to create temporary unit group. (Then you'll have to kill the entering unit AFTER the test, not at the beginning)
Also, you should change the size of "Region 000", right now it looks like the peasant could enter region 000 without entering any of those 3 other regions.

I didn't quite understand whether you want to make each hero unique or not. If you want to, the easiest would be creating boolean array and storing whether the hero has already been picked.
 
Level 4
Joined
Oct 28, 2007
Messages
72
thank you for quick replay
a) i try with temp group it wont work,i add kiling unit under intriger
but triget jsut wont go so i need something to start trigger so i add
action that change entering unit hp to 98%...
b)my trigger is about not doing for every hero a lot of things
and yes i just stretch region so you can see it in normal 0000 region is corectly streched to fit this 3 regions.
I made i think perfect system and so easy but only one unit must be and that unit cant die its great system if you have more than 100 heroes,this system dont have any of variable pls check it and comment...
  • scriptv2
    • Events
      • Unit - A unit comes within 64.00 of Peasant 0004 <gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Neutral Passive
          • (Owner of Peasant 0004 <gen>) Not equal to Neutral Passive
    • Actions
      • Unit - Change ownership of (Triggering unit) to (Owner of Peasant 0004 <gen>) and Change color
      • Unit - Change ownership of Peasant 0004 <gen> to Neutral Passive and Change color
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Passive at (Position of (Triggering unit)) facing Default building facing degrees
trigger to start over normaly current hero will die or something if player want
to pick new one
  • regain peasant
    • Events
      • Player - Player 1 (Red) types a chat message containing start as An exact match
    • Conditions
    • Actions
      • Unit - Change ownership of Peasant 0004 <gen> to Player 1 (Red) and Change color
and normaly i would do better conditions for cheking what player type it and etc etc...only problem is that peasant must be selected i canot create unit of type peasant as event that start trigger but it helps me when player want to change hero...
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
.only problem is that peasant must be selected i canot create unit of type peasant as event that start trigger but it helps me when player want to change hero...
You actually can, there is action called "Trigger - Add Event", you can create a set of peasants in game init and assign them to this trigger with this action.

The problem of the triggers you posted is that you'll have to copy them for each player. (Also you have one location leak in "scriptv2")
If you wanted to create one universal trigger:
  • scriptv3
    • Events
      • -------will be added later-----
    • Conditions
      • (Owner of (Triggerig unit)) equals to Neutral Passive
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Set TempLoc = Position of (Triggering unit)
      • Unit Group - Pick units in (Units within 64 of TempLoc)
        • Loop
          • If - then -else
            • Conditions
              • Unit-type of (picked unit) equals to Peasant
            • Then
              • Unit - Create 1 (unit-type of (triggering unit) at TempLoc for Owner of (Picked unit)
              • Unit - Remove (Picked unit) from game
      • Custom script: call RemoveLocation( udg_TempLoc )
  • regain peasant
  • Events
    • Player - Player 1 (Red) types a chat message containing -repick as An exact match
    • Player - Player 2 (Blue) types a chat message containing -repick as An exact match
  • .....
  • Conditions
  • Actions
    • Set TempLoc = Center of (HeroPickAreaOrSomething)
    • Unit - Create 1 Peasant for (Triggering player) at TempLoc
    • Event - Add "Unit comes within 64 of (Last created unit)" to scriptv3
    • Custom script: call RemoveLocation( udg_TempLoc )
Also in init, run the same code as in "regain peasant" for each player
 
Level 4
Joined
Oct 28, 2007
Messages
72
Oh yea i forgot about that...i didn't play with editor long time XD
Tnx gona try that...and post resoults...
 
Level 4
Joined
Oct 28, 2007
Messages
72
++++

It wont work event cant be added or it is idk...maybe somthing else is wrong
or i mess up with remove location script?
Btw if i create 8 peasants for 8 players wont be only last one that can activate trigger?
  • scriptv2
    • Events
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Passive
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Set TmpLOC = (Position of (Triggering unit))
      • Unit Group - Pick every unit in (Units within 64.00 of TmpLOC) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Peasant
            • Then - Actions
              • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Picked unit)) at TmpLOC facing Default building facing degrees
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • Custom script: call RemoveLocation( udg_TmpLOC )
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as An exact match
    • Conditions
    • Actions
      • Set TmpLOC = ((Triggering player) start location)
      • Unit - Create 1 Peasant for (Triggering player) at TmpLOC facing Default building facing degrees
      • Trigger - Add to scriptv2 <gen> the event (Unit - A unit comes within 64.00 of (Last created unit))
      • Custom script: call RemoveLocation( udg_TmpLOC )
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
Hmm, strange, it should work like this.
You can add 8 events to a trigger, so it can work for 8 players.
Try debugging it, put some Game text in scriptv2 and see, if it even launches. Maybe, like it is for triggers, when unit comes within the range, it still won't be picked by (Units in range), so try increasing the range (64 in event and like 70-80 in (units in range of...))
 
Status
Not open for further replies.
Top