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

[General] How to disable an ability when close to a gold mine?

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
Hi.

I have a horse with the "return gold" ability. The horse stands near a gold mine so peasents can move from the gold mine to the horse with the gold. Just like they carry gold from gold mine to town hall.

But if the horse is standing next to the gold mine, only 1 peasent is needed because there is no distance to walk. That is boring. I want to have a line of peasents working.


How can I do to disable the "return gold" ability if the horse is to near the gold mine?
 
Level 10
Joined
Nov 5, 2008
Messages
536
I was thinking of adding an aura around the gold mine. When a unit enters that aura it looses the ability "return gold", hence the peasents can´t give gold to the horse until it moves a bit away from the mine.

How can I do this in an effective way?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Prevent the horse from standing near to the mine :)

Event- A unit comes within *YourRange*, (600 should be fine) of *YourMine*
Condition- Unit = Horse
Action- Order unit to Stop.

IF you can still get near to the mine with the horse, order the unit to move to a point with offset 5,5 towards Horse facing angle x -1 (I'm not so sure, but should be something like that, I have never worked with offsets)

You have to add one event for each gold mine, OR on map init do:

Set Group = Units in Playable Map Area matching - Unit Type of Matching unit = Gold mine.
- Pick every unit in Group and do multiple actions
--> Loop:
----> For each Integer A from 1 to (Number of units in Group)
-----> Loop
-------> Trigger: Add to 'The_Trigger_I_told_You_Before' the Event: 'A unit comes within 600 range of (Picked Unit).
-> call DestroyGroup(udg_Group)

There. The system will automatically add each Gold Mine to the event, so you don't have to do it manually.
 
Level 9
Joined
Apr 26, 2011
Messages
403
1, create a region for gold mine (region is rectangle, but should be fine ? )

2, create a trigger for "unit enter region", if horse enter, horse will stop, and add this horse to variable or group (so your peasant know which horse is in which gold mine region)

3, create a trigger for "unit leave region". if peasant leave this region, order him to stop, move to horse, remove skill or whatever you want. (you can use this trigger for horse too if you want do something after horse leave gold mine)
 
IF you can still get near to the mine with the horse, order the unit to move to a point with offset 5,5 towards Horse facing angle x -1 (I'm not so sure, but should be something like that, I have never worked with offsets)
The Angle between gold mine and horse will be better. (for no problem with knockback and others)
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
1, create a region for gold mine (region is rectangle, but should be fine ? )

2, create a trigger for "unit enter region", if horse enter, horse will stop, and add this horse to variable or group (so your peasant know which horse is in which gold mine region)

3, create a trigger for "unit leave region". if peasant leave this region, order him to stop, move to horse, remove skill or whatever you want. (you can use this trigger for horse too if you want do something after horse leave gold mine)

Use this one.
 
Status
Not open for further replies.
Top