• 🏆 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)

Status
Not open for further replies.
Level 4
Joined
Oct 13, 2009
Messages
43
hi guys, need help with trigger. need something like- Unit owned by random player comes within range xx of unit "A" (unit A" is rescuable, (its tower)) so question is "how to make unit "A" rescuable again when unit owned by player leaves unit "a"?:ogre_hurrhurr:? help plz
 
Level 10
Joined
Mar 31, 2009
Messages
732
Pre-defined global player variable: towerOwner

Event - unit comes in range of unit

Condition - towerOwner is equal to null

Actions:
set towerOwner = owner of (Entering Unit)
Change owner of THE_TOWER to towerOwner

Event - unit leaves the range of unit

Condition - towerOwner is not equal to No Unit
Condition - count(units in range of tower) equal to zero

Actions:
set towerOwner = null
Change owner of THE_TOWER to Neutral Passive
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
help me make that veriable plzzz =) have problem with them always..

It isn't simple as Teelo mentioned. Here I tested lots of thing and this is the best I could do:

(if you find any leaks just fix it I may have missed it)

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set CurrentOwner = Neutral Passive
      • Set GuardTower = Scout Tower 0000 <gen>
      • Set Tower_Position = (Position of GuardTower)
      • Countdown Timer - Start Timer as a Repeating timer that will expire in 0.01 seconds
  • Tower Owner
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Set UnitInRange = (Units within 800.00 of Tower_Position)
      • Unit Group - Remove GuardTower from UnitInRange
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in UnitInRange) Equal to 0
        • Then - Actions
          • Set CurrentOwner = Neutral Passive
          • Unit - Change ownership of GuardTower to CurrentOwner and Change color
          • Set IsTowerOwned = False
        • Else - Actions
          • Unit Group - Pick every unit in UnitInRange and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IsTowerOwned Equal to False
                • Then - Actions
                  • Set IsTowerOwned = True
                  • Set CurrentOwner = (Owner of (Picked unit))
                  • Unit - Change ownership of GuardTower to CurrentOwner and Change color
                • Else - Actions
                  • Unit Group - Remove all units from UnitInRange
                  • Set UnitInRange = (Units within 800.00 of Tower_Position matching ((Owner of (Matching unit)) Equal to CurrentOwner))
                  • Unit Group - Remove GuardTower from UnitInRange
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in UnitInRange) Equal to 0
                    • Then - Actions
                      • Set CurrentOwner = (Owner of (Picked unit))
                      • Unit - Change ownership of GuardTower to CurrentOwner and Change color
                    • Else - Actions
      • Unit Group - Remove all units from UnitInRange
 
Status
Not open for further replies.
Top