• 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.

[Trigger] Limit Number of units that can attack another unit

Status
Not open for further replies.
Level 3
Joined
May 24, 2012
Messages
57
Trying to make a trigger that limits the amount of units that can attack a specific unit to 1 at any given time. Is this possible? Heres my scenario my workers harvest "food" by attacking a farm but i want it so only one worker can attack a farm at a time. I am pretty new to usinig triggers but have been figuring it out at a decent pace {thanks to this forum :)}.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
That took a little longer than expected.

This basic version only supports one "Farm" unit type. Let me know if it should support more. I might make it into a more advanced and useful system.

To install, copy both folders into your map, making sure you have "Automatically create unknown variables" enabled in your editor preferences.
Set your unit types in the "LAS Config" trigger.
 

Attachments

  • LimitAttackersSystem001.w3x
    22.2 KB · Views: 77
Level 3
Joined
May 24, 2012
Messages
57
quick note so i tested it in the link you gave me worked perfect for how i wanted it.copied over to the map i'm workinig on set the LAS Config trigger for the unit i dont want more than one attacker for. but now it wont work...
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Did you also copy the unit indexer?

Which unit are you setting the system for?

Please post the config triggers. (right click on the trigger in the bottom-right view and select "copy as text", and paste it here inside
  • brackets)
  • EDIT: I extended the system to work on many unit types. See [url]http://www.hiveworkshop.com/forums/spells-569/gui-limit-attackers-system-1-00-a-226133/[/url] if you want to use it.
 
Last edited:
Level 3
Joined
May 24, 2012
Messages
57
LAS Config
Events
Map initialization
Conditions
Actions
Set LAS_Limit = 1
Set LAS_SetCooldown = 3.00
Set LAS_UnitType = Farm 1
-------- Don't edit below --------
Unit Group - Pick every unit in (Units of type LAS_UnitType) and do (Actions)
Loop - Actions
Unit Group - Add (Picked unit) to LAS_FarmGroup

(Not sure what a trigger bracket is or how to use it).... but this is the trigger in my map the only thinig i have changed about any of them is the LAS_UnitType = Farm 1

EDIT: The trigger worked fine before i changed the unit to "Farm 1" by default it was selecting the Human farm but the Farm 1 is a custom unit based off of the farm. the default farm in my map is actually a "house"
 
Level 3
Joined
May 24, 2012
Messages
57
how do i post the map? every link on google takes me to some phony site...

EDIT: nvm was using quick reply (sorry im new to forums)
 
Status
Not open for further replies.
Top