• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Pick 1 random unit in range - WTF

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

.... this is so ******

I just want to pick 1 random unit, but why the fking hell this never works =O

  • Frozen Love
    • Events
      • Time - Timer[3] expires
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Random 1 units from (Units within 1850.00 of (Position of Diablos Mother 0001 <gen>))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • ((Picked unit) is dead) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of Diablos Mother 0001 <gen>)) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Works!
              • Set FrozenLove = (Picked unit)
              • Unit - Create 1 Dummy (Frozen Love Slow) for (Owner of Diablos Mother 0001 <gen>) at (Position of FrozenLove) facing (Position of FrozenLove)
              • Set FrozenLoveSlowingUnit = (Last created unit)
              • Unit - Set level of Slow for FrozenLoveSlowingUnit to 1
              • Unit - Order FrozenLoveSlowingUnit to Human Sorceress - Slow FrozenLove
              • Game - Display to (All players) the text: Works!
            • Else - Actions
      • Trigger - Turn on Frozen Love Slowing <gen>
      • Wait 4.00 seconds
      • Trigger - Turn off Frozen Love Slowing <gen>
      • Unit - Remove FrozenLoveSlowingUnit from the game
      • Unit - Create 1 Dummy (Frozen Love) for (Owner of Diablos Mother 0001 <gen>) at (Position of FrozenLove) facing (Position of FrozenLove)
      • Trigger - Turn on Frozen Love Aoe Frost <gen>
      • Wait 4.00 seconds
      • Trigger - Turn off Frozen Love Aoe Frost <gen>
1) You see the 2 Game massage actions. No one of them will shown!

2) Bloody don't look at the leaks, just explain me why this isn't working

3) Event is ok!

4) And yes, I put enemies around so they can be picked ofc.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Sorry this doesn't work the first time. ( I posted some days ago the problem with this matching stuff ).

After this matching stuff didn't work, I created the posted trigger.

Edit: LoL Maker wasn't you the one that try to help me with the other problem? =O

Edit 2: I tested it again with matching unit - no effect ( and yes I use matching unit not picked unit =D )
 
Level 3
Joined
Apr 29, 2009
Messages
32
Dr.Boom said:
Seas =)

Sorry this doesn't work the first time. ( I posted some days ago the problem with this matching stuff ).

After this matching stuff didn't work, I created the posted trigger.

Edit: LoL Maker wasn't you the one that try to help me with the other problem? =O

Edit 2: I tested it again with matching unit - no effect ( and yes I use matching unit not picked unit =D )

Judging from this post you only changed picked unit to matching unit.

  • Unit Group - Pick every unit in (Units within 1850.00 of (Center of (Playable map area)) matching (((Unit-type of (Matching unit)) Not equal to Diablos Mother) and ((((Diablos Mother 0001) belongs to an enemy of (Owner of (Matching Unit))) Equal to True) and ((Matching unit) Not equal to (Dying unit and do (Actions)
    • Loop - Actions
Try this if you haven't allready done that.

Edit: I think I might forgot the Random unit part. :(

This is the right one:
  • Unit Group - Pick every unit in (Random 1 units from (Units within 1850.00 of (Position of (Diablos Mother 0001)) matching (((Unit-type of (Matching unit)) Not equal to Diablos Mother) and ((((Matching unit) belongs to an enemy of (Owner of (Diablos Mother))) Equal to True) and ((Matching unit) Not equal to (Dying Unit)) and do (Actions)
    • Loop - Actions
 
Seas =)

Sorry this doesn't work the first time. ( I posted some days ago the problem with this matching stuff ).

After this matching stuff didn't work, I created the posted trigger.

Edit: LoL Maker wasn't you the one that try to help me with the other problem? =O

Edit 2: I tested it again with matching unit - no effect ( and yes I use matching unit not picked unit =D )

can you post the new trigger?
 
Level 6
Joined
Mar 20, 2008
Messages
208
This might help ya, I've found that the game will pick units in the same order and way when iterating through groups. (Don't have proof, but it does feel like it.)

So that pick 1 random unit could be essentially picking the same unit each time you run that script. I do suggest rebuilding the conditions, but if you try moving the units around it might work.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

1) Yes I know that this random stuff pick always the same unit and I know you can turn this off and I did it already. Problem is, no unit is picked.

2) No I don't forget something in the actions .....

3) In my first post there is the newest trigger I got atm. As baassee said I used:
  • Unit Group - Pick every unit in (Random 1 units from (Units within 1850.00 of (Position of Diablos Mother 0001 <gen>) matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of Diablos Mother 0001 <gen>)) Equal to True)))) and do (Actions)
    • Loop - Actions
but this don't work to. I bloody don't know why - I can't see any mistake.
 
Level 1
Joined
Dec 4, 2009
Messages
4
Did you try to look if the "random seed" is actived in the editor/files/preferences?

try to tick the case...
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Sorry but this wont work as well =S

But I used it now as onix_NOOB said it and this will work up to one point: So I need some help again:

  • Frozen Love Copy
    • Events
      • Time - Timer[3] expires
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 1850.00 of (Position of Diablos Mother 0001 <gen>) matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of Diablos Mother 0001 <gen>)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to FrozenLoveGrp
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Random 1 units from FrozenLoveGrp) and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: Works!
          • Set FrozenLove = (Picked unit)
      • Unit - Create 1 Dummy (Frozen Love Slow) for (Owner of Diablos Mother 0001 <gen>) at (Position of FrozenLove) facing (Position of FrozenLove)
      • Game - Display to (All players) the text: Works!
      • Set FrozenLoveSlowingUnit = (Last created unit)
      • Unit - Set level of Sloww for FrozenLoveSlowingUnit to 1
      • Game - Display to (All players) the text: Works!
      • Unit - Order FrozenLoveSlowingUnit to Human Sorceress - Slow FrozenLove
      • Game - Display to (All players) the text: Works!
The last "Game - Display bla bla" don't show up, so I guess here is the "Unit - Order FrozenLoveSlowingUnit to Human Sorceress - Slow FrozenLove" uncorrect. Maybe someone can help with this?

1) Yes the created unit has slow - and slow is modified fine.
 
Level 3
Joined
Oct 4, 2009
Messages
42
Guys guys guys!
This has tons of leaks...

Dude, try this one...
  • Issue with UG
    • Events
    • Conditions
    • Actions
      • Set Temp_Location = (Position of (==Your unit==)
      • -------- First, set the location/point of the unit. --- VARIABLE (Point) --------
      • Set Temp_Group1 = (Units within 1850.00 of Temp_Location)
      • -------- Now, set ALL units near the target, don't worry we will pick out 1 random in the next action --- VARIABLE: (Unit Group) --------
      • Set Temp_Group2 = (Random 1 units from Temp_Group1)
      • -------- Ok with this variable, we have picked out 1 random unit from all units near the main unit... --- VARIABLE: (Unit Group) --------
      • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (((Picked unit) is alive) Equal to True) and (((Picked unit) belongs to an enemy of (Owner of (==Your unit==))) Equal to True)
            • Then - Actions
              • -------- Do your actions here... Finish the trigger with these Custom Scrips: --------
              • Custom script: call RemoveLocation(Temp_Location)
              • Custom script: call DestroyGroup(udg_Temp_Group1)
              • Custom script: call DestroyGroup(udg_Temp_Group2)
            • Else - Actions
 
Level 9
Joined
Jun 7, 2008
Messages
440
Is Timer[3] even stared? I didnt know the timer arrays would work as An event. I remember trying once, to the same effect. If I remember correctly, it didn't work for me. I could be wrong though.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

1) As Maker already said, this isn't about leaks and ofc I know that there are leaks, but this wasn't important for the moment for me.

2) @ CrueIIntentions: Sure the timer was started all the time ( =O ) ;)

3) @ onix_noob: No I don't add the spell to the dummy unit, because it has it already. The reason why I set this to level 1 is, because I use other levels of this spell for other events and so that there are no problems, I did that action.

4) But now: Everything works now. Thanks to all who helped me!!!! +rep ofc.

5) But I still don't know why my first 2 triggers didn't work with "Pick 1 random Unit in range" T_T
 
Status
Not open for further replies.
Top