• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[AI] Ai request (i think)

Status
Not open for further replies.
Level 2
Joined
Jun 16, 2007
Messages
13
hi im making a map and im curious if any1 can make a unit ai pathing type thing in which when a certain unit path works like this

-=terrain x=tresure chest

unit=ill just use this cause its cool looking lol: :spell_breaker:

basically its like this the spell breaker walks by a item
--------------X-----------------
------:spell_breaker:>---------------------

and temporarily changes where hes going and picks up the item (and it displays a (target) found a/the (item name))

---------:spell_breaker:>--X---------------- spell breaker found treasure
------------------------------

is this possible and how?
 
Level 3
Joined
May 27, 2007
Messages
43
Let me see if I got what you meant. You want units to check if there are items around them and, if so, they get it and keep doing their previous order?

It can be done with triggers, all you need is to set a repeating timer that checks if there are any items close to the units you'd like to be able to pick items and if so, you can save the unit's order, send it to pick up the item and then reorder then with the order you just saved.
 
Level 2
Joined
Jun 10, 2007
Messages
19
Yes, heres the coding.
Variables Needed
-- IntegerAVar -- Integer Variable (for player numbers)
-- Heros [12 array variable] -- You would need to set this at the very beggining of the map. This is for the specific unit (Whoever u want).
  • Hero Pick Up Item
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set IntegerAVar = (IntegerAVar + 1)
      • If (All Conditions are True) then do )Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(IntegerAVar)) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Order Heros[IntegerAVar] to Right-Click (Random item in (Region centered at (Position of Heros[IntegerAVar]) with size (600.00, 600.00)))
          • --------This should allow the hero to pick up the item and if there is no item he will have no target so he will not move--------
        • Else - Actions
 
Status
Not open for further replies.
Top