• 🏆 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] Detect Damaging Unit

Status
Not open for further replies.
Level 16
Joined
Oct 12, 2008
Messages
1,570
Hi people,
im working on something, but i got a problem,,
When a unit cuts a tree, i need it to be added to a unit group,,
But when more peasants are around the same tree, it adds them all to the group, but they dont need to be in it (yet)
So, how can i detect which unit is the unit damaging the tree?

tnx :grin:
Yixx,,

EDIT: Dont mind if it is a few Jass lines, but preferably not a whole Jass Trigger,, IF you got an answer but its Jass, please do post it!
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
3rd resource? No!
Just normal trees,,
Ill show you the whole trigger:
  • Check REAL
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set zz_Destr_Array = 1
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is dead) Equal to False
              • ((Picked destructible) is invulnerable) Equal to False
              • (Current life of (Picked destructible)) Less than zz_Destr_Life[zz_Destr_Array]
              • Or - Any (Conditions) are true
                • Conditions
                  • (Substring((Name of (Picked destructible)), ((Length of (Name of (Picked destructible))) - 3), (Length of (Name of (Picked destructible))))) Equal to Tree
                  • (Substring((Name of (Picked destructible)), ((Length of (Name of (Picked destructible))) - 8), (Length of (Name of (Picked destructible))))) Equal to Tree Wall
            • Then - Actions
              • Set zz_Destr_Group = (Units within 150.00 of (Position of (Picked destructible)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in zz_Destr_Group) Greater than 0
                • Then - Actions
                  • Unit Group - Pick every unit in zz_Destr_Group and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current order of (Picked unit)) Equal to (Order(smart))
                        • Then - Actions
                          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
                          • Game - Display to (All players) the text: (String((Custom value of (Picked unit))))
                        • Else - Actions
                • Else - Actions
            • Else - Actions
          • Set zz_Destr_Life[zz_Destr_Array] = (Current life of (Picked destructible))
          • Set zz_Destr_Array = (zz_Destr_Array + 1)
The thing is, every unit around the tree has the same order: Smart,,
So it will add custom value to every unit!
But that is not what i need,, i need the unit that,, how shall i say it:
Last cut the tree, that means last got lumber, that means the one that last played the 'harvest' animation,
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Nah, I just meant that I will trigger it without the harvest ability.

Try to find help by someone else, if I have not enough time.

But I hope I find enough time to make a new harvest system for you.

Omg? Like creating an all new ability that does nothing but with triggers, it will do what i want?
Ill try that, and get back to you later,,
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
You said you didnt have time now, so im trying, and if i dont have a solution by the time you DO have time, please Do try! If you are still willing to

I think i found a solution, im not letting the unit use an other ability, im checking with the lvl of an other ability if the unit has waited long enough (it takes 1.1 sec for the unit to cut again, so if lvl of 'ready' = 11, i increase custom value, )
 
Status
Not open for further replies.
Top