• 🏆 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] {help}-giving units in region a value.

Status
Not open for further replies.
Level 4
Joined
Oct 15, 2008
Messages
77
alright! (i know this leaks ill get to it later)

  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 5
      • Then - Actions
        • Set forklightingdummy = (Random unit from (Units of type forked lighting (dummy) (Dummy)))
        • Set local_group = (Units in (Rect centered at (Target point of ability being cast) with size (1500.00, 1500.00)))
        • Unit - Create 1 forked lighting (dummy) (Dummy) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Create 1 forked lighting (dummy) (Dummy) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Create 1 forked lighting (dummy) (Dummy) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Create 1 forked lighting (dummy) (Dummy) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Create 1 forked lighting (dummy) (Dummy) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Set level of Chain lighting (custom) for forklightingdummy to 5
        • Wait 0.02 seconds
        • Unit Group - Pick every unit in (Units of type forked lighting (dummy) (Dummy)) and do (Actions)
          • Loop - Actions
            • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning (Random unit from local_group)
        • Wait 3.00 seconds
        • Unit Group - Pick every unit in (Units of type forked lighting (dummy) (Dummy)) and do (Actions)
          • Loop - Actions
            • Unit - Remove (Picked unit) from the game
        • Custom script: call DestroyGroup(udg_local_group)
      • Else - Actions
        • Do nothing
how would i go about giving a value to each one of the units selected in the Local_group so i can instead of doing this
  • Unit Group - Pick every unit in (Units of type forked lighting (dummy) (Dummy)) and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning
so i can have them each cast the chain lighting at a giving value of a unit. cause atm, if theres only one unit in the region they will all cast at that one unit. i know i can fix that, but if i can get the units values i will be able to do it that way as well and that's what im looking for.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
How about an Integer A [1 to (Count Units of type forked lightning (Dummy)] and make a trigger for them like.

  • Set TempTarget = (Random unit of local_group)
  • Unit - Order (Integer A) to Orc Far Seer - Chain Lightning TempTarget
  • Unit - Remove TempTarget from local_group
If I'm right, this should cause the first unit in Integer A to use this trigger first, then the second, then the third, etc. until there are no more dummy units. All units in local_group will be hit only once, and only when there are more or just as much dummy units then units in local_group. If there are more dummy units then units in local_group, the other dummy units will not perform any actions in this trigger, since they got no target.

If this doesn't work, I think I got another idea, but it's a bit more complicated.
 
Level 4
Joined
Oct 15, 2008
Messages
77
so here's what i ended up with as to so far. everything is running fine till it comes time for them to cast chain lighting and they do nothing
  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 5
      • Then - Actions
        • Set forklightingdummy = (Random unit from (Units of type forked lighting (dummy) (Dummy)))
        • Set local_group = (Units in (Rect centered at (Target point of ability being cast) with size (500.00, 500.00)))
        • Unit - Create 5 forked lighting (dummy) (Dummy) for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
        • Unit - Set level of Chain lighting (custom) for forklightingdummy to 5
        • Set dummyunitgroup = (Units of type forked lighting (dummy) (Dummy))
        • Wait 0.02 seconds
        • For each (Integer A) from 1 to (Number of units in dummyunitgroup), do (Actions)
          • Loop - Actions
            • Set TempTarget = (Random unit from local_group)
            • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning TempTarget
            • Unit Group - Destroy unit group Temp_Group
            • Unit Group - Destroy unit group dummyunitgroup
        • Wait 3.00 seconds
        • Unit Group - Pick every unit in (Units of type forked lighting (dummy) (Dummy)) and do (Actions)
          • Loop - Actions
            • Unit - Remove (Picked unit) from the game
      • Else - Actions
        • Do nothing
 
Last edited:
Level 18
Joined
Aug 23, 2008
Messages
2,319
You need to add the command 'Unit - Remove TempTarget from local_group', so you don't get the same target twice. Also you need to place the 'Unit Groups - Destroy unit group' commands outside the Integer A loop.

if that doesn't help, then place a Game Text Message in the trigger to see at which point the trigger fails.
 
Level 4
Joined
Oct 15, 2008
Messages
77
alright so the only thing im unable to find which is stopping everything is the "integer A" unit function

  • Unit - Order (Integer A) to Orc Far Seer - Chain Lightning TempTarget
i've been looking like crazy and am unable to find the arithmetic
 
Level 4
Joined
Oct 15, 2008
Messages
77
alright, so here we go, thanks to you avator, you helped me figure out the rest of what i needed to do. currently im trying to go through and fix the rest of the leaks which is a PITA.

+rep to you
here's what i got so far!..
  • forked lighting 1 Copy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Forked Lighting (custom)
    • Actions
      • Set forklightingdummy = forked lighting (dummy) (Dummy)
      • Set Temp_Point = (Position of (Triggering unit))
      • Wait 0.10 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Random 1 units from (Units within 450.00 of (Position of (Target unit of ability being cast)) matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
            • Loop - Actions
              • Set unit_group[(integer + 1)] = (Picked unit)
              • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
              • Unit - Add a 1.00 second Summoned Unit expiration timer to (Last created unit)
              • Unit - Set level of Chain lighting (custom) for (Last created unit) to 1
              • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
          • Custom script: call RemoveLocation (udg_Temp_Point)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 2
            • Then - Actions
              • Unit Group - Pick every unit in (Random 2 units from (Units within 450.00 of (Position of (Target unit of ability being cast)) matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
                • Loop - Actions
                  • Set unit_group[(integer + 1)] = (Picked unit)
                  • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
                  • Unit - Add a 1.00 second Summoned Unit expiration timer to (Last created unit)
                  • Unit - Set level of Chain lighting (custom) for (Last created unit) to 2
                  • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
              • Custom script: call RemoveLocation (udg_Temp_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 3
                • Then - Actions
                  • Unit Group - Pick every unit in (Random 3 units from (Units within 450.00 of (Position of (Target unit of ability being cast)) matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
                    • Loop - Actions
                      • Set unit_group[(integer + 1)] = (Picked unit)
                      • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
                      • Unit - Add a 1.00 second Summoned Unit expiration timer to (Last created unit)
                      • Unit - Set level of Chain lighting (custom) for (Last created unit) to 3
                      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
                  • Custom script: call RemoveLocation (udg_Temp_Point)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 4
                    • Then - Actions
                      • Unit Group - Pick every unit in (Random 4 units from (Units within 450.00 of (Position of (Target unit of ability being cast)) matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
                        • Loop - Actions
                          • Set unit_group[(integer + 1)] = (Picked unit)
                          • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
                          • Unit - Add a 1.00 second Summoned Unit expiration timer to (Last created unit)
                          • Unit - Set level of Chain lighting (custom) for (Last created unit) to 4
                          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to 5
                        • Then - Actions
                          • Unit Group - Pick every unit in (Random 5 units from (Units within 450.00 of (Position of (Target unit of ability being cast)) matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
                            • Loop - Actions
                              • Set unit_group[(integer + 1)] = (Picked unit)
                              • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
                              • Unit - Add a 1.00 second Summoned Unit expiration timer to (Last created unit)
                              • Unit - Set level of Chain lighting (custom) for (Last created unit) to 5
                              • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                        • Else - Actions
 
Level 9
Joined
May 27, 2006
Messages
498
First off: Why the hell are you storing a unit-type into a variable? Omg.
  • Set forklightingdummy = forked lighting (dummy) (Dummy) // <- WTF?
Secondly: You've created a whole new if/then/else block just to check the ability level of a unit and to set dummy's ability level to that integer. You would do that instead:
  • Unit - Set level of (dummy forked lightning) for (your_unit) to (Level of (Forked Lightning) for (your_unit2)))
And it would make your trigger 5 times shorter.

Plus, you're still leaking lots of unit groups and locations.

In addition, (Units within 450.00 of (Position of (Target unit of ability being cast)) can't work due to the wait action you included in your trigger. Each unit event-response gets cleared after any wait action, excluding Triggering unit.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • forked lighting 1 Copy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Forked Lighting (custom)
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set tempunit = (Target unit of ability being cast)
      • Set temppoint2 = (Position of tempunit)
      • Wait 0.10 seconds
      • For each Integer A from 1 to 5 do:
        • Loop - Actions:
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Forked Lighting (custom) for (Triggering unit)) Equal to Integer A
            • Then - Actions
              • Custom script: call bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Random Integer A units from (Units within 450.00 of temppoint2 matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))) and do (Actions)
                • Loop - Actions
                  • Set unit_group[(integer + 1)] = (Picked unit)
                  • Unit - Create 1 forklightingdummy for (Triggering player) at Temp_Point facing (Facing of (Triggering unit)) degrees
                  • Unit - Add a 2.00 second Summoned Unit expiration timer to (Last created unit)
                  • Unit - Set level of Chain lighting (custom) for (Last created unit) to Integer A
                  • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning unit_group[(integer + 1)]
          • Else - Actions
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call RemoveLocation (udg_temppoint2)
Freetyped :p
 
Last edited:
Level 4
Joined
Oct 15, 2008
Messages
77
lol,
  • Custom script: call bj_wantDestroyGroup = true
wants changing to
  • Custom script: set bj_wantDestroyGroup = true
........
anyways, i actually did have the integers in there from 1-5 and do exactly what squiggy posted except for the other leaks. anyways, ya, when i used the integer loop it wouldnt even create the unit.
 
Status
Not open for further replies.
Top