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!
Let's say you are in the part of issuing the order of repair.
Your first action would be adding the peasant to a unit group to ensure that the repair has been initiated and that he is still repairing. Then, another trigger will check the three order events:
Events
Unit - A unit Is issued an order targeting an object
Unit - A unit Is issued an order targeting a point
Unit - A unit Is issued an order with no target
The condition will be set to check whether the (Triggering unit) is in the unit group. If it is, then order the unit to stop, wait 0.00 seconds and order it again to use Storm Bolt on the tent.
In order to issue the order towards the right tent, you can use a hashtable, where you will save the tent to the peasant, e.g.
Set Unit1 = (Attacked unit)
Set Point1 = (Position of (Attacked unit))
Unit - Create 1 Peasant for (Triggering player) at Point1 facing Default building degrees
Unit - Order (Last created unit) to Human Peasant - Repair (Attacked unit)
Hashtable - Save handle of (Attacked unit) as (Key tent) of (Key(Last created unit)) in Hashtable
Unit Group - Add (Last created unit) to RepairGroup
Custom script: call RemoveLocation (udg_Point1)
Then, in the trigger that you will storm bolt the tent,
Set LoadUnit = (Load (Key tent) of (Key(Triggering unit)) from Hashtable)
Unit - Order (Triggering unit) to Human Mountain King - Storm Bolt LoadUnit
Hashtable - Clear all child hashtables of (Key(Triggering unit)) in Hashtable
Unit Group - Remove (Triggering unit) from RepairGroup
why don't you create a periodic timer that will check if the Tent's hitpoints is already full instead of ordering the peasant to storm bolt the Tent? you can turn on the periodic trigger once the peasant starts repairing the Tent.
This, ronojales, will not check when the peasant has been issued another order and the trigger will keep running, even if the peasant is not fulfilling the act of repair.
What you asked there has nothing to do with the use of the hashtable in my example. You just need to save the tent to the peasant, so that "he knows" which tent to Storm Bolt. Otherwise, you can't retrieve the proper target, can you?
P.S. Don't hate something, just because you are not familiar with it. Efficiency > Boredom
just thought that the all that the peasant has to do is repair that damaged building, since kaizar said the peasant will appear once the building is damaged, and will be removed once it is done repairing.
~but oh wait, using periodic trigger will not check which peasant repaired a Tent. if units attack different Tents then someone finishes repairing a Tent every peasant repairing or not might disappear.
What you asked there has nothing to do with the use of the hashtable in my example. You just need to save the tent to the peasant, so that "he knows" which tent to Storm Bolt. Otherwise, you can't retrieve the proper target, can you?
P.S. Don't hate something, just because you are not familiar with it. Efficiency > Boredom
I see, so you didn't fullfill what i was in need of help? =/
I meant by building, anythign other than tent, the tent is where the peasant comes from, and the building is like, next to the tent, let's say a tower.
When the tower takes dmg, peasant gets out of his tent, repairs then after tower has his life at max, the peasant returns bak to his tent, I couldn't find any event to help me find the peasant that was done with repairing.
The tent and the peasants are invulnerable, and both are owned by computer.
Edit: I think I can find a way to check if tower has 100% HP in which case i can then order the peasant to return bak to his tent, though, it has to be periodic, and might cause lag in-game as there will be many towers and many peasants and tents.
(Unit-type of GDD_DamagedUnit) Equal to (==) Guard Tower
Actions
Set Unit_GT_Pesant[1] = GDD_DamagedUnit
Unit - Create 1 Peasant for (Owner of Unit_GT_Pesant[1]) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Set Unit_GT_Pesant[2] = (Last created unit)
Unit - Order Unit_GT_Pesant[2] to Human Peasant - Repair Unit_GT_Pesant[1]
Trigger - Turn on Check <gen>
Check
Events
Time - Every 0.10 seconds of game time
Conditions
(Percentage life of Unit_GT_Pesant[1]) Equal to (==) 100.00
Actions
Unit - Order Unit_GT_Pesant[2] to Move To (Center of (Playable map area))
Trigger - Turn off (This trigger)
i use GDD damage detection sistem
(unable to find link to it)
this would work but for a single peasant only
(... i chould make it for more of them but im tired)
(Unit-type of GDD_DamagedUnit) Equal to (==) Guard Tower
Actions
Set Unit_GT_Pesant[1] = GDD_DamagedUnit
Unit - Create 1 Peasant for (Owner of Unit_GT_Pesant[1]) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Set Unit_GT_Pesant[2] = (Last created unit)
Unit - Order Unit_GT_Pesant[2] to Human Peasant - Repair Unit_GT_Pesant[1]
Trigger - Turn on Check <gen>
Check
Events
Time - Every 0.10 seconds of game time
Conditions
(Percentage life of Unit_GT_Pesant[1]) Equal to (==) 100.00
Actions
Unit - Order Unit_GT_Pesant[2] to Move To (Center of (Playable map area))
Trigger - Turn off (This trigger)
i use GDD damage detection sistem
(unable to find link to it)
this would work but for a single peasant only
(... i chould make it for more of them but im tired)
Man, you either use hashtables or periodic. Its not our problem that you can't spent 5minutes to learn something new, since it isn't hard.
You either use hashtables/peridoc/checking order events or you dont want your trigger at all =)
Pharaoh_ already said above nice solution. I'll just paste periodic one. Uses Unit Indexer and GDD. 852024 is the id of order "repair".
Its just an egzample, you modify it as you desire.
get worker
Events
Game - GDD_Event becomes Equal to 0.00
Conditions
(Unit-type of GDD_DamagedUnit) Equal to Farm
Actions
Set tempp = (Position of GDD_DamagedUnit)
Unit - Create 1 Chłop for (Owner of GDD_DamagedUnit) at tempp facing Domyślna orientacja budynku degrees
It either needs to be timer or wait or peasent wont get order at all.
I checked it many times, and if I'm not mistaken last time with situation about casting abilities it was you who told that Stop order is issued before casting . You were right, and here lies the same problem. Either use loop that orders peasant to repair (like every 0.5) or we use wait while creating.
For MUI I recommend removing wait, and adding loop described above, and as it was said already in my previous post I just gave an egzample. Was tired after discovering that order is issued before unit is created, therefore returning null so I needed to use some kind of delay to make it work properly.
I checked it 100 times, and if I'm not remember last time about casting abilities it was you who told that Stop order is issued before casting. You were right, and he lies the same problem.
Man, you either use hashtables or periodic. Its not our problem that you can't spent 5minutes to learn something new, since it isn't hard.
You either use hashtables/peridoc/checking order events or you dont want your trigger at all =)
Pharaoh_ already said above nice solution. I'll just paste periodic one. Uses Unit Indexer and GDD. 852024 is the id of order "repair".
Its just an egzample, you modify it as you desire.
get worker
Events
Game - GDD_Event becomes Equal to 0.00
Conditions
(Unit-type of GDD_DamagedUnit) Equal to Farm
Actions
Set tempp = (Position of GDD_DamagedUnit)
Unit - Create 1 Chłop for (Owner of GDD_DamagedUnit) at tempp facing Domyślna orientacja budynku degrees
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.