HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

unit detection system

11-28-2007, 09:48 PM#1
Crimsongg137
i was trying to figure out how i would make the computer realize that a unit is in a certain area and would attack it but yet roam. any ideas?
11-28-2007, 10:28 PM#2
cohadar
Trigger:
Unit Enters Region
Collapse Events
Unit - A unit enters DangerZone <gen>
Conditions
Collapse Actions
Unit - Order Monster - A3 0077 <gen> to Attack (Entering unit)
11-28-2007, 11:59 PM#3
Crimsongg137
idono i was looking forward in more of a unit enters region attack random unit in region but once it aquires that postions i want it to roam or attack...
11-29-2007, 07:13 AM#4
cohadar
The "roam" ability is called Wander (neutral)
11-29-2007, 03:49 PM#5
Crimsongg137
i no that but still i want to create something more advance liek if you attack one unit , unit with in range would assist that unit. i was thinking of something different. i need something more advanced

I believe i found the trigger i was looking for woo hehe
Trigger:
Zombie Attack
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units owned by Player 5 (Yellow) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Collapse Unit Group - Pick every unit in (Units owned by Player 6 (Orange) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Collapse Unit Group - Pick every unit in (Units owned by Player 7 (Green) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Collapse Unit Group - Pick every unit in (Units owned by Player 8 (Pink) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
11-29-2007, 06:50 PM#6
Deaod
please, if you want to share GUI code, use "[trigger]" codes, like cohadar did.
2nd: the code you posted will leak some groups, and since you execute that trigger every second this code will cause the map to lag badly in advanced game time.
You can fix those leaks by adding a custom script, which is
Trigger:
Custom Script: set bj_wantDestroyGroup = true

as you have to add this before every "Group - Pick Units ... " this will have to look like
Trigger:
Zombie Attack
Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Custom Script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by Player 5 (Yellow) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Custom Script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by Player 6 (Orange) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Custom Script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by Player 7 (Green) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))
Custom Script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by Player 8 (Pink) matching ((Current order of (Matching unit)) Equal to (Order(none)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by (Random player from (All players controlled by a User player)) matching (((Matching unit) is A structure) Equal to False))))

Please note that custom script is basically pure JASS and as such VERY case sensitive.

Hope I could help.

Deaod