- Joined
- Apr 22, 2020
- Messages
- 430
Can somebody tell me how to trigger a hero to siphon mana a unit or a hero when its mana pool is below 400?
Is it for a specific unit or generic ? If it's the first then you can do this :
If it's the latter, then remove the event on the above trigger and do this at Map Initialization :
Siphon Mana
Events
Unit - Blood Mage 0000 <gen>'s mana becomes Less than 400.00
Conditions
Actions
Set Point = (Position of (Triggering unit))
Unit - Order (Triggering unit) to Human Blood Mage - Siphon Mana (Random unit from (Units within 600.00 of Point matching ((Mana of (Matching unit)) Greater than 0.00)))
Custom script: call RemoveLocation (udg_Point)
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Trigger - Add to Siphon Mana <gen> the event (Unit - (Picked unit)'s mana becomes Less than 400.00))
Okay a little bit confusing can you just embed the trigger here? I only rely on embeded triggers to fully understand the triggers and also does this trigger need to have a variable?It will take at least 2 triggers to produce the intended effect.
First trigger: (Logic flow)
Event: Every <period> seconds of game-time
Actions:
Pick all units in <container group> and do the following:
Set <enemy count> to 0
Enumerate units within range of picked unit.
Pick all units in <enumerated group> and do the following:
(Check if picked unit is alive and an enemy)
If (Condition is true) then
Add 1 to <enemy count>
Endif
(Check if enemy count is greater than or equal to 6)
If (Condition) then
Order picked unit to Starfall
Endif
Second trigger:
Actions
Add desired unit to the <container group>
Okay a little bit confusing can you just embed the trigger here? I only rely on embeded triggers to fully understand the triggers and also does this trigger need to have a variable?
Thank you so much you have helped me alot and can i ask what's the use of the second trigger and why is it separated from the other trigger? And also as i have asked before does this trigger have a variable if thier are can you tell me what type of variable they are thanks! (Sorry for keep asking questions i just really wanna make sure that i have understood this trigger)Alright. Here's the first trigger: (Both triggers require variables and first trigger is not optimized yet to remove memory leaks)
The second trigger
Events
Game: Every <period> seconds of game-time
Conditions
Actions
Unit Group - Pick all units in <container group> and do (Loop - Actions)
Loop - Actions
Set <enemy count> = 0
Set <temp unit> = (Picked unit)
Unit Group - Pick all units in (units in <desired range> range of (Position of <temp unit>) and do (Loop - Actions)
Loop - Actions
If (All Conditions are True) then do (Then - Actions) else do (Else - Actions)
If - Conditions
(Picked unit) is alive Equal to True
(Picked unit) belongs to an enemy of (Owner of <temp unit>) Equal to true
Then - Actions
Set <enemy count> = <enemy count> + 1
Else - Actions
If (All Conditions are True) then do (Then - Actions) else do (Else - Actions)
If - Conditions
<enemy count> Greater than or Equal to 6
Then - Actions
Unit - Order <temp unit> to Night Elf Priestess of the Moon - Starfall
Else - Actions
Events
Conditions
Actions
Unit Group - Add <desired unit> to <container group>
Thank you so much for your help! Now my AI Heroes will be much more usefull.The second trigger is for adding a desired unit (who can cast Starfall) into the container group. The second trigger is a plain trigger which adds a desired unit. Due to the ambiguity of the desired unit, I have left it as is.
The two triggers presented require variables.
<container group> is a unit group variable.
<enemy count> is an integer.
<temp unit> is a unit.
Well okay sorry for the late reply but the Enemy count (Integer) does not appear in If conditions - (Enemy count) greater than equal to 6 only the temp unit variable why is this?The second trigger is for adding a desired unit (who can cast Starfall) into the container group. The second trigger is a plain trigger which adds a desired unit. Due to the ambiguity of the desired unit, I have left it as is.
The two triggers presented require variables.
<container group> is a unit group variable.
<enemy count> is an integer.
<temp unit> is a unit.