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

[Solved] Who is the "entering unit within range" in here?

Level 17
Joined
Jun 2, 2009
Messages
1,141
  • OrderSeysi
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = True
      • Set TempCreep[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
      • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])
  • CreepBulduSeysi
    • Events
    • Conditions
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to True
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = False
I cannot pass this condition.
When i replace this zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to True
with this one zBool_BotCreepBuldu[(Player number of (Owner of zU_AIHero[3]))] Equal to True This trigger runs.

How can i detect owner of (unit comes within 256 of TempCreep[(Player number of (Owner of (Triggering unit)))]?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,566
  • Unit - A unit Is issued an order targeting an object
^ (Triggering unit) = The Unit that was issued an order. NOT the object.

  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])
^ zU_AIHero[(Player number of (Owner of (Triggering unit)))] = The Hero belonging to the Player that issued an order.

In CreepBulduSeysi, (Triggering unit) is the unit that has come within range of your Hero.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,566
What is X? The target of the issued order?

Then use (Target unit of issued order):
  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of (Target unit of issued order))
Or just add the Unit to a Unit Group and do periodic checks around it.

Every 1 second -> Pick every unit in ComeWithinRangeGroup -> Pick every other unit within 256 range of (Picked unit) -> Do stuff if you find a hero.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Uhm. Then let me show you something. Why this trigger works then?

I am right clicking the unit in the map

  • OrderSeysi
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = True
      • Set TempCreep[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
      • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])

And i can see this trigger runs.

  • CreepBulduSeysi
    • Events
    • Conditions
      • zBool_BotCreepBuldu[(Player number of (Owner of zU_AIHero[(Player number of (Owner of (Triggering unit)))]))] Equal to True
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = False
      • Game - Display to (All players) the text: (Name of the current trigger)
Here is the details.

I am ordering my AI to right click one of the units (i can see name of the clicked unit as debug message)
Then i want to run action if the AI comes near 256 of the clicked unit.
This runs without any periodic events.
Update: Let me try your solution first, then i will reply.
Update 2: Not worked
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,566
The clicked unit is the (Target unit of issued order).

Now read this line:
  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])
"A unit comes within 256.00 of zu_AIHero"

That doesn't say "A unit comes within 256.00 of clicked unit", it says the Hero.

Understand that you only have a reference to the (Triggering unit) when using the "A unit comes within range" event. So you can only get the Hero later on.

This line is nonsense to me:
  • zBool_BotCreepBuldu[(Player number of (Owner of zU_AIHero[(Player number of (Owner of (Triggering unit)))]))] Equal to True
This is how you can check if a Hero came near the clicked unit:
  • CreepBulduSeysi
    • Events
    • Conditions
      • ((Triggering unit) is a Hero)) Equal to True
    • Actions
      • Game - Display to (All players) the text: "A hero came near a clicked unit"
If you want to be able to check information about the Clicked unit as well then you'll need to use a Unit Group/Periodic setup like I described before.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
This is bit of confusing to me. And believe me or not, it is my 3'rd day with this system and still i cannot do that.

  • OrderSeysi
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Ordered unit) Equal to TempUnit
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = True
      • Set TempCreep[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
      • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])
      • Game - Display to (All players) the text: (Name of (Target unit of issued order))
      • Game - Display to (All players) the text: (TempCreep bu + (Name of TempCreep[(Player number of (Owner of (Ordered unit)))]))
  • CreepBulduSeysi
    • Events
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: (Name of the current trigger)
      • Game - Display to (All players) the text: ((Name of (Triggering unit)) + Name of Triggering Unit)
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = False
When hero comes near 256 of unit, this trigger still not running and still i cannot detect the problem.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,566
Let's try this a third time.

THIS IS WRONG:
  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of zU_AIHero[(Player number of (Owner of (Triggering unit)))])
THIS IS CORRECT:
  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of (Target unit of issued order))
(Target unit of issued order) = The unit you clicked.

zU_AIHero[(Player number of (Owner of (Triggering unit)))]) = The HERO of the OWNER of the unit you clicked.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Yesterday i did many tests on "empty test map" now i am importing my system into my map. This is how it looks like (it is from yesterday, i was updated message it works for now)

TempCreep sets from this trigger. First of all i am picking units within 5000 range and detecting them, after i do that i am setting Boolean to True, then right clicking on the unit.

  • Unit Group - Pick every unit in (Units within 5000.00 of (Position of TempUnit)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in zUG_CreepsDevil) Equal to True
          • ((Picked unit) is alive) Equal to True
          • ((Picked unit) is in EBENGRUP) Equal to False
          • zBool_BotCreepBuldu[(Player number of (Owner of TempUnit))] Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit is in zUG_LanerDevilBOT) Equal to True
              • (Point-value of (Picked unit)) Equal to 91
            • Then - Actions
              • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnit))] = True
              • Unit - Order TempUnit to Right-Click (Picked unit)
              • Cinematic - Ping minimap for (All players) at (Position of (Picked unit)) for 1.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit is in zUG_LanerDevilMID) Equal to True
                  • (Point-value of (Picked unit)) Equal to 92
                • Then - Actions
                  • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnit))] = True
                  • Unit - Order TempUnit to Right-Click (Picked unit)
                  • Cinematic - Ping minimap for (All players) at (Position of (Picked unit)) for 1.00 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempUnit is in zUG_LanerDevilTOP) Equal to True
                      • (Point-value of (Picked unit)) Equal to 93
                    • Then - Actions
                      • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnit))] = True
                      • Unit - Order TempUnit to Right-Click (Picked unit)
                      • Cinematic - Ping minimap for (All players) at (Position of (Picked unit)) for 1.00 seconds
                    • Else - Actions
        • Else - Actions
After the AI managed to right click on the unit, i was did like this.

  • OrderSeysi
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to True
    • Actions
      • Set TempCreep[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
      • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 250.00 of TempCreep[(Player number of (Owner of (Triggering unit)))])
And this is the result

  • CreepBulduSeysi
    • Events
    • Conditions
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of zU_AIHero[(Player number of (Owner of (Triggering unit)))]))] Equal to True
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = False
My tests from yesterday was succesful.

But you said this is correct

Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 256.00 of (Target unit of issued order))

But my trigger just like this for now

Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 250.00 of TempCreep[(Player number of (Owner of (Triggering unit)))])

I hope both are the same. Today i will import it in my map and start to tests, then i will let you know the result.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,566
I hope both are the same.
They're the same. You set TempCreep to the (Target unit of issued order), what other Unit would it be?

This looks a little weird to me:
  • Conditions
    • zBool_BotCreepBuldu[(Player number of (Owner of zU_AIHero[(Player number of (Owner of (Triggering unit)))]))] Equal to True
Isn't this the same thing?:
  • Conditions
    • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit))] Equal to True
Anyway, if it works, good.
 
Last edited:
Top